r1392 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jun 25 01:50:45 EDT 2008


Author: icculus
Date: 2008-06-25 01:50:44 -0400 (Wed, 25 Jun 2008)
New Revision: 1392

Modified:
   trunk/code/client/cl_main.c
   trunk/code/client/cl_scrn.c
   trunk/code/client/client.h
Log:
VoIP: Added cheapie VoIP meter.


Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-06-25 05:50:15 UTC (rev 1391)
+++ trunk/code/client/cl_main.c	2008-06-25 05:50:44 UTC (rev 1392)
@@ -39,6 +39,7 @@
 cvar_t	*cl_voipSend;
 cvar_t	*cl_voipSendTarget;
 cvar_t	*cl_voipGainDuringCapture;
+cvar_t	*cl_voipShowMeter;
 cvar_t	*voip;
 #endif
 
@@ -382,8 +383,9 @@
 				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 @@
 	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.

Modified: trunk/code/client/cl_scrn.c
===================================================================
--- trunk/code/client/cl_scrn.c	2008-06-25 05:50:15 UTC (rev 1391)
+++ trunk/code/client/cl_scrn.c	2008-06-25 05:50:44 UTC (rev 1392)
@@ -344,6 +344,39 @@
 
 
 /*
+=================
+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 @@
 			// 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;
 		}
 	}

Modified: trunk/code/client/client.h
===================================================================
--- trunk/code/client/client.h	2008-06-25 05:50:15 UTC (rev 1391)
+++ trunk/code/client/client.h	2008-06-25 05:50:44 UTC (rev 1392)
@@ -416,6 +416,7 @@
 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
 




More information about the quake3-commits mailing list