• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revisión123b79757a68ebfa3f982384f9d22de910711467 (tree)
Tiempo2023-10-26 11:02:45
AutorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Renamed some voice chat CVars and CCMDs, and made minor changes to the "voice chat options" menu code.

Cambiar Resumen

Diferencia incremental

diff -r 90dfedfc1642 -r 123b79757a68 src/voicechat.cpp
--- a/src/voicechat.cpp Wed Oct 25 21:35:08 2023 -0400
+++ b/src/voicechat.cpp Wed Oct 25 22:02:45 2023 -0400
@@ -70,16 +70,16 @@
7070 // CONSOLE VARIABLES
7171
7272 // [AK] If enabled, clients can transmit audio based on voice activity.
73-CVAR( Bool, snd_recordvoiceactivity, false, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
73+CVAR( Bool, voice_recordactivity, false, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
7474
7575 // [AK] Enables noise suppression while transmitting audio.
76-CVAR( Bool, snd_suppressnoise, true, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
76+CVAR( Bool, voice_suppressnoise, true, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
7777
7878 // [AK] Allows the client to load a custom RNNoise model file.
79-CVAR( String, snd_noisemodelfile, "", CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
79+CVAR( String, voice_noisemodelfile, "", CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
8080
8181 // [AK] Which input device to use when recording audio.
82-CUSTOM_CVAR( Int, snd_recorddriver, 0, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
82+CUSTOM_CVAR( Int, voice_recorddriver, 0, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
8383 {
8484 VOIPController &instance = VOIPController::GetInstance( );
8585
@@ -92,7 +92,7 @@
9292 }
9393
9494 // [AK] How sensitive voice activity detection is, in decibels.
95-CUSTOM_CVAR( Float, snd_recordsensitivity, -50.0f, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
95+CUSTOM_CVAR( Float, voice_recordsensitivity, -50.0f, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
9696 {
9797 const float clampedValue = clamp<float>( self, MIN_DECIBELS, 0.0f );
9898
@@ -101,7 +101,7 @@
101101 }
102102
103103 // [AK] Controls the volume of the input device.
104-CUSTOM_CVAR( Float, snd_recordvolume, 1.0f, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
104+CUSTOM_CVAR( Float, voice_recordvolume, 1.0f, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG )
105105 {
106106 const float clampedValue = clamp<float>( self, 0.0f, 2.0f );
107107
@@ -110,7 +110,7 @@
110110 }
111111
112112 // [AK] Controls the volume of everyone's voices on the client's end.
113-CUSTOM_CVAR( Float, snd_voicechatvolume, 1.0f, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG | CVAR_NOINITCALL )
113+CUSTOM_CVAR( Float, voice_outputvolume, 1.0f, CVAR_ARCHIVE | CVAR_NOSETBYACS | CVAR_GLOBALCONFIG | CVAR_NOINITCALL )
114114 {
115115 const float clampedValue = clamp<float>( self, 0.0f, 2.0f );
116116
@@ -225,7 +225,7 @@
225225 }
226226
227227 // [AK] Lists all recording devices that are currently connected.
228-CCMD( snd_listrecorddrivers )
228+CCMD( voice_listrecorddrivers )
229229 {
230230 TArray<FString> recordDriverList;
231231 VOIPController::GetInstance( ).RetrieveRecordDrivers( recordDriverList );
@@ -339,9 +339,9 @@
339339 }
340340
341341 // [AK] Load a custom RNNoise model file if we can. Otherwise, use the built-in model.
342- if ( strlen( snd_noisemodelfile ) > 0 )
342+ if ( strlen( voice_noisemodelfile ) > 0 )
343343 {
344- const char *fileName = snd_noisemodelfile.GetGenericRep( CVAR_String ).String;
344+ const char *fileName = voice_noisemodelfile.GetGenericRep( CVAR_String ).String;
345345 FILE *modelFile = fopen( fileName, "r" );
346346
347347 if ( modelFile != nullptr )
@@ -550,7 +550,7 @@
550550 {
551551 isRecordButtonPressed = true;
552552
553- if ( snd_recordvoiceactivity == false )
553+ if ( voice_recordactivity == false )
554554 {
555555 if ( IsVoiceChatAllowed( ))
556556 StartTransmission( TRANSMISSIONTYPE_BUTTON, true );
@@ -573,7 +573,7 @@
573573 // now, or using voice activity detection? We'll check if we have enough new
574574 // samples recorded to fill an audio frame that can be encoded and sent out.
575575 // This also applies while testing the microphone.
576- if (( transmissionType != TRANSMISSIONTYPE_OFF ) || ( snd_recordvoiceactivity ) || ( isTesting ))
576+ if (( transmissionType != TRANSMISSIONTYPE_OFF ) || ( voice_recordactivity ) || ( isTesting ))
577577 {
578578 unsigned int recordPosition = 0;
579579
@@ -689,10 +689,10 @@
689689 float rms = 0.0f;
690690
691691 for ( unsigned int i = 0; i < RECORD_SAMPLES_PER_FRAME; i++ )
692- uncompressedBuffer[i] = clamp<float>( voicechat_ByteArrayToFloat( soundBuffer + i * SAMPLE_SIZE ) * snd_recordvolume, -1.0f, 1.0f );
692+ uncompressedBuffer[i] = clamp<float>( voicechat_ByteArrayToFloat( soundBuffer + i * SAMPLE_SIZE ) * voice_recordvolume, -1.0f, 1.0f );
693693
694694 // [AK] Denoise the audio frame.
695- if (( snd_suppressnoise ) && ( denoiseState != nullptr ))
695+ if (( voice_suppressnoise ) && ( denoiseState != nullptr ))
696696 {
697697 for ( unsigned int i = 0; i < RECORD_SAMPLES_PER_FRAME; i++ )
698698 uncompressedBuffer[i] *= SHRT_MAX;
@@ -716,7 +716,7 @@
716716 // [AK] Check if the audio frame should actually be sent. This is always the
717717 // case while pressing the "voicerecord" button, or if the sound intensity
718718 // exceeds the minimum threshold. If testing, then always send it.
719- if (( transmissionType == TRANSMISSIONTYPE_BUTTON ) || ( rms >= snd_recordsensitivity ) || ( isTesting ))
719+ if (( transmissionType == TRANSMISSIONTYPE_BUTTON ) || ( rms >= voice_recordsensitivity ) || ( isTesting ))
720720 {
721721 // [AK] If we're using voice activity, and not transmitting audio already,
722722 // then start transmitting now.
@@ -792,14 +792,14 @@
792792 {
793793 if ( numRecordDrivers > 0 )
794794 {
795- if ( snd_recorddriver >= numRecordDrivers )
795+ if ( voice_recorddriver >= numRecordDrivers )
796796 {
797- Printf( "Record driver %d doesn't exist. Using 0 instead.\n", *snd_recorddriver );
797+ Printf( "Record driver %d doesn't exist. Using 0 instead.\n", *voice_recorddriver );
798798 recordDriverID = 0;
799799 }
800800 else
801801 {
802- recordDriverID = snd_recorddriver;
802+ recordDriverID = voice_recorddriver;
803803 }
804804
805805 if ( system->recordStart( recordDriverID, recordSound, true ) != FMOD_OK )
@@ -1527,7 +1527,7 @@
15271527 // muting the local player's.
15281528 if ( player == static_cast<unsigned>( consoleplayer ))
15291529 {
1530- channel->setVolume( snd_recordvolume );
1530+ channel->setVolume( voice_recordvolume );
15311531 }
15321532 else
15331533 {
@@ -1794,21 +1794,21 @@
17941794 const float rmsVolume = VOIPController::GetInstance( ).GetTestRMSVolume( );
17951795
17961796 // [AK] Only draw the "background" bar if it will be visible.
1797- if (( snd_recordsensitivity < 0.0f ) && ( rmsVolume < 0.0f ))
1797+ if (( voice_recordsensitivity < 0.0f ) && ( rmsVolume < 0.0f ))
17981798 DrawBar( MAKERGB( 64, 64, 64 ), barStartX, y );
17991799
18001800 // [AK] Draw the "sensitivity" bar if it will be visible.
1801- if (( snd_recordsensitivity > MIN_DECIBELS ) && ( snd_recordsensitivity > rmsVolume ))
1802- DrawBar( MAKERGB( 0, 115, 15 ), barStartX, y, ( MIN_DECIBELS - snd_recordsensitivity ) / MIN_DECIBELS );
1801+ if (( voice_recordsensitivity > MIN_DECIBELS ) && ( voice_recordsensitivity > rmsVolume ))
1802+ DrawBar( MAKERGB( 0, 115, 15 ), barStartX, y, ( MIN_DECIBELS - voice_recordsensitivity ) / MIN_DECIBELS );
18031803
18041804 if ( rmsVolume > MIN_DECIBELS )
18051805 {
18061806 // [AK] Draw the "RMS" bar if it will be visible.
1807- if ( rmsVolume > snd_recordsensitivity )
1807+ if ( rmsVolume > voice_recordsensitivity )
18081808 DrawBar( MAKERGB( 20, 255, 50 ), barStartX, y, ( MIN_DECIBELS - rmsVolume ) / MIN_DECIBELS );
18091809
18101810 // [AK] Draw a "shadow" of the sensitivity bar over the RMS bar.
1811- const float diff = MIN<float>( rmsVolume, snd_recordsensitivity );
1811+ const float diff = MIN<float>( rmsVolume, voice_recordsensitivity );
18121812 DrawBar( MAKERGB( 0, 170, 0 ), barStartX, y, ( MIN_DECIBELS - diff ) / MIN_DECIBELS );
18131813 }
18141814 }
diff -r 90dfedfc1642 -r 123b79757a68 wadsrc/static/menudef.za
--- a/wadsrc/static/menudef.za Wed Oct 25 21:35:08 2023 -0400
+++ b/wadsrc/static/menudef.za Wed Oct 25 22:02:45 2023 -0400
@@ -150,15 +150,15 @@
150150 Title "VOICE CHAT OPTIONS"
151151 Class "VoiceChatMenu"
152152
153- Option "Allow voice chat", "cl_novoicechat", "NoYes"
154- Option "Input device", "snd_recorddriver", "ZA_RecordDrivers"
155- Slider "Input volume", "snd_recordvolume", 0, 2, 0.1
156- Slider "Output volume", "snd_voicechatvolume", 0, 2, 0.1
157- Option "Use voice activity", "snd_recordvoiceactivity", "YesNo"
158- Slider "Voice sensitivity (dB)", "snd_recordsensitivity", -100, 0, 5
153+ Option "Allow voice chat", "cl_novoicechat", "NoYes"
154+ Option "Input device", "voice_recorddriver", "ZA_RecordDrivers"
155+ Slider "Input volume", "voice_recordvolume", 0.0, 2.0, 0.1
156+ Slider "Output volume", "voice_outputvolume", 0.0, 2.0, 0.1
157+ Option "Use voice activity", "voice_recordactivity", "YesNo"
158+ Slider "Voice sensitivity (dB)", "voice_recordsensitivity", -100, 0, 5
159159 StaticText " "
160- Option "Use noise suppression", "snd_suppressnoise", "YesNo"
161- TextField "RNNoise model file", "snd_noisemodelfile"
160+ Option "Use noise suppression", "voice_suppressnoise", "YesNo"
161+ TextField "RNNoise model file", "voice_noisemodelfile", "voice_suppressnoise"
162162
163163 // [AK] Tip message for testing the microphone.
164164 StaticText " "
Show on old repository browser