mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: small code fixes related to voice chat
This commit is contained in:
parent
ae97eae42f
commit
97879430e9
@ -1700,14 +1700,14 @@ CL_ParseVoiceData
|
|||||||
void CL_ParseVoiceData( sizebuf_t *msg )
|
void CL_ParseVoiceData( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int size, idx, frames;
|
int size, idx, frames;
|
||||||
unsigned char received[8192];
|
static byte received[8192];
|
||||||
|
|
||||||
idx = MSG_ReadByte( msg ) + 1;
|
idx = MSG_ReadByte( msg ) + 1;
|
||||||
|
|
||||||
frames = MSG_ReadByte( msg );
|
frames = MSG_ReadByte( msg );
|
||||||
|
|
||||||
size = MSG_ReadShort( msg );
|
size = MSG_ReadShort( msg );
|
||||||
size = Q_min( size, 8192 );
|
size = Q_min( size, sizeof( received ));
|
||||||
|
|
||||||
MSG_ReadBytes( msg, received, size );
|
MSG_ReadBytes( msg, received, size );
|
||||||
|
|
||||||
@ -3149,13 +3149,6 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
case svc_director:
|
case svc_director:
|
||||||
CL_ParseDirector( msg );
|
CL_ParseDirector( msg );
|
||||||
break;
|
break;
|
||||||
case svc_voiceinit:
|
|
||||||
CL_ParseVoiceInit( msg );
|
|
||||||
break;
|
|
||||||
case svc_voicedata:
|
|
||||||
CL_ParseVoiceData( msg );
|
|
||||||
cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
|
||||||
break;
|
|
||||||
case svc_resourcelocation:
|
case svc_resourcelocation:
|
||||||
CL_ParseResLocation( msg );
|
CL_ParseResLocation( msg );
|
||||||
break;
|
break;
|
||||||
|
@ -306,9 +306,9 @@ void Voice_RecordStart( void )
|
|||||||
Voice_Status( -1, true );
|
Voice_Status( -1, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Voice_AddIncomingData( int ent, byte *data, uint size, uint frames )
|
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||||
{
|
{
|
||||||
int samples = opus_decode( voice.decoder, (const byte*)data, size, (short *)voice.decompress_buffer, voice.frame_size / voice.width * frames, false );
|
int samples = opus_decode( voice.decoder, data, size, (short *)voice.decompress_buffer, voice.frame_size / voice.width * frames, false );
|
||||||
|
|
||||||
if ( samples > 0 )
|
if ( samples > 0 )
|
||||||
Voice_StartChannel( samples, voice.decompress_buffer, ent );
|
Voice_StartChannel( samples, voice.decompress_buffer, ent );
|
||||||
|
@ -61,7 +61,7 @@ void Voice_Idle( float frametime );
|
|||||||
qboolean Voice_IsRecording( void );
|
qboolean Voice_IsRecording( void );
|
||||||
void Voice_RecordStop( void );
|
void Voice_RecordStop( void );
|
||||||
void Voice_RecordStart( void );
|
void Voice_RecordStart( void );
|
||||||
void Voice_AddIncomingData( int ent, byte *data, uint size, uint frames );
|
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames );
|
||||||
qboolean Voice_GetLoopback( void );
|
qboolean Voice_GetLoopback( void );
|
||||||
void Voice_LocalPlayerTalkingAck( void );
|
void Voice_LocalPlayerTalkingAck( void );
|
||||||
void Voice_PlayerTalkingAck( int playerIndex );
|
void Voice_PlayerTalkingAck( int playerIndex );
|
||||||
|
@ -341,4 +341,19 @@ void SNDDMA_Activate( qboolean active )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean VoiceCapture_Init( void )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean VoiceCapture_RecordStart( void )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VoiceCapture_RecordStop( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -418,6 +418,8 @@ extern convar_t sv_stopspeed;
|
|||||||
extern convar_t sv_maxspeed;
|
extern convar_t sv_maxspeed;
|
||||||
extern convar_t sv_wateralpha;
|
extern convar_t sv_wateralpha;
|
||||||
extern convar_t sv_wateramp;
|
extern convar_t sv_wateramp;
|
||||||
|
extern convar_t sv_voiceenable;
|
||||||
|
extern convar_t sv_voicequality;
|
||||||
extern convar_t sv_stepsize;
|
extern convar_t sv_stepsize;
|
||||||
extern convar_t sv_maxvelocity;
|
extern convar_t sv_maxvelocity;
|
||||||
extern convar_t sv_rollangle;
|
extern convar_t sv_rollangle;
|
||||||
|
@ -2587,7 +2587,7 @@ void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !Cvar_VariableInteger( "sv_voiceenable" ) )
|
if ( (int)sv_voiceenable.value == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MSG_ReadBytes( msg, received, size );
|
MSG_ReadBytes( msg, received, size );
|
||||||
@ -2599,6 +2599,7 @@ void SV_ParseVoiceData( sv_client_t *cl, sizebuf_t *msg )
|
|||||||
|
|
||||||
length = size;
|
length = size;
|
||||||
|
|
||||||
|
// 6 is a number of bytes for other parts of message
|
||||||
if ( MSG_GetNumBytesLeft( &cur->datagram ) < length + 6 )
|
if ( MSG_GetNumBytesLeft( &cur->datagram ) < length + 6 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ void SV_WriteVoiceCodec( sizebuf_t *msg )
|
|||||||
{
|
{
|
||||||
MSG_BeginServerCmd( msg, svc_voiceinit );
|
MSG_BeginServerCmd( msg, svc_voiceinit );
|
||||||
MSG_WriteString( msg, "opus" );
|
MSG_WriteString( msg, "opus" );
|
||||||
MSG_WriteByte( msg, Cvar_VariableInteger( "sv_voicequality" ));
|
MSG_WriteByte( msg, (int)sv_voicequality.value );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user