diff options
Diffstat (limited to 'code')
| -rw-r--r-- | code/client/cl_main.c | 9 | ||||
| -rw-r--r-- | code/client/cl_scrn.c | 36 | ||||
| -rw-r--r-- | code/client/client.h | 1 | 
3 files changed, 43 insertions, 3 deletions
| diff --git a/code/client/cl_main.c b/code/client/cl_main.c index a7734c6..56343f8 100644 --- a/code/client/cl_main.c +++ b/code/client/cl_main.c @@ -39,6 +39,7 @@ cvar_t	*cl_voipVADThreshold;  cvar_t	*cl_voipSend;  cvar_t	*cl_voipSendTarget;  cvar_t	*cl_voipGainDuringCapture; +cvar_t	*cl_voipShowMeter;  cvar_t	*voip;  #endif @@ -382,8 +383,9 @@ void CL_CaptureVoip(void)  				speexFrames++;  			} -			clc.voipPower = voipPower / (32768.0f * 32768.0f * -			              ((float) (clc.speexFrameSize * speexFrames))); +			clc.voipPower = (voipPower / (32768.0f * 32768.0f * +			                 ((float) (clc.speexFrameSize * speexFrames)))) * +			                 100.0f;  			if ((useVad) && (clc.voipPower < cl_voipVADThreshold->value)) {  				CL_VoipNewGeneration();  // no "talk" for at least 1/4 second. @@ -3088,7 +3090,8 @@ void CL_Init( void ) {  	cl_voipSendTarget = Cvar_Get ("cl_voipSendTarget", "all", 0);  	cl_voipGainDuringCapture = Cvar_Get ("cl_voipGainDuringCapture", "0.2", CVAR_ARCHIVE);  	cl_voipUseVAD = Cvar_Get ("cl_voipUseVAD", "0", CVAR_ARCHIVE); -	cl_voipVADThreshold = Cvar_Get ("cl_voipVADThreshold", "0.0025", CVAR_ARCHIVE); +	cl_voipVADThreshold = Cvar_Get ("cl_voipVADThreshold", "0.25", CVAR_ARCHIVE); +	cl_voipShowMeter = Cvar_Get ("cl_voipShowMeter", "1", CVAR_ARCHIVE);  	voip = Cvar_Get ("voip", "1", CVAR_USERINFO | CVAR_ARCHIVE | CVAR_LATCH);  	// This is a protocol version number. diff --git a/code/client/cl_scrn.c b/code/client/cl_scrn.c index fd4c38b..f3e6faf 100644 --- a/code/client/cl_scrn.c +++ b/code/client/cl_scrn.c @@ -344,6 +344,39 @@ void SCR_DrawDemoRecording( void ) {  /* +================= +SCR_DrawVoipMeter +================= +*/ +void SCR_DrawVoipMeter( void ) { +	char	buffer[16]; +	char	string[256]; +	int limit, i; + +	if (!cl_voipShowMeter->integer) +		return; + +	if (!cl_voipSend->integer) +		return; + +	limit = (int) (clc.voipPower * 10.0f); +	if (limit > 10) +		limit = 10; + +	for (i = 0; i < limit; i++) +		buffer[i] = '*'; +	while (i < 10) +		buffer[i++] = ' '; +	buffer[i] = '\0'; + +	sprintf( string, "VoIP: [%s]", buffer ); +	SCR_DrawStringExt( 320 - strlen( string ) * 4, 10, 8, string, g_color_table[7], qtrue, qfalse ); +} + + + + +/*  ===============================================================================  DEBUG GRAPH @@ -486,6 +519,9 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {  			// always supply STEREO_CENTER as vieworg offset is now done by the engine.  			CL_CGameRendering(stereoFrame);  			SCR_DrawDemoRecording(); +			#if USE_VOIP +			SCR_DrawVoipMeter(); +			#endif  			break;  		}  	} diff --git a/code/client/client.h b/code/client/client.h index 682b3cf..3fbceff 100644 --- a/code/client/client.h +++ b/code/client/client.h @@ -416,6 +416,7 @@ extern	cvar_t	*cl_voipVADThreshold;  extern	cvar_t	*cl_voipSend;  extern	cvar_t	*cl_voipSendTarget;  extern	cvar_t	*cl_voipGainDuringCapture; +extern	cvar_t	*cl_voipShowMeter;  extern	cvar_t	*voip;  #endif | 
