diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index f65166f1..5a6201ff 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1503,6 +1503,7 @@ void CL_Disconnect( void ) cls.connect_time = 0; cls.changedemo = false; cls.max_fragment_size = FRAGMENT_MAX_SIZE; // reset fragment size + Voice_Disconnect(); CL_Stop_f(); // send a disconnect message to the server @@ -1514,7 +1515,6 @@ void CL_Disconnect( void ) // clear the network channel, too. Netchan_Clear( &cls.netchan ); - Voice_RecordStop(); IN_LockInputDevices( false ); // unlock input devices diff --git a/engine/client/voice.c b/engine/client/voice.c index 1e8de7ee..d06c1147 100644 --- a/engine/client/voice.c +++ b/engine/client/voice.c @@ -323,6 +323,16 @@ void Voice_RecordStart( void ) Voice_Status( -1, true ); } +void Voice_Disconnect( void ) +{ + int i; + + Voice_RecordStop(); + for( i = 0; i <= 32; i++ ) { + Voice_Status( i, false ); + } +} + void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames ) { int samples = opus_decode( voice.decoder, data, size, (short *)voice.decompress_buffer, voice.frame_size / voice.width * frames, false ); @@ -380,6 +390,5 @@ void Voice_PlayerTalkingAck(int playerIndex) void Voice_StartChannel( uint samples, byte *data, int entnum ) { SND_ForceInitMouth( entnum ); - Voice_Status( entnum, true ); S_RawEntSamples( entnum, samples, voice.samplerate, voice.width, voice.channels, data, 255 ); } diff --git a/engine/client/voice.h b/engine/client/voice.h index e5072896..caabeede 100644 --- a/engine/client/voice.h +++ b/engine/client/voice.h @@ -77,6 +77,7 @@ void Voice_Idle( float frametime ); qboolean Voice_IsRecording( void ); void Voice_RecordStop( void ); void Voice_RecordStart( void ); +void Voice_Disconnect( void ); void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames ); qboolean Voice_GetLoopback( void ); void Voice_LocalPlayerTalkingAck( void );