engine: client: voice: fixed hanging voice status

This commit is contained in:
SNMetamorph
2022-08-19 04:14:25 +03:00
committed by Alibek Omarov
parent 2f5f5ef0a6
commit 74707551ae
3 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -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
+10 -1
View File
@@ -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 );
}
+1
View File
@@ -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 );