r1366 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jun 4 17:50:00 EDT 2008


Author: icculus
Date: 2008-06-04 17:50:00 -0400 (Wed, 04 Jun 2008)
New Revision: 1366

Modified:
   trunk/code/client/cl_cgame.c
   trunk/code/client/cl_input.c
   trunk/code/client/cl_main.c
   trunk/code/client/client.h
Log:
VoIP: functionality to adjust incoming audio gain, per-user.


Modified: trunk/code/client/cl_cgame.c
===================================================================
--- trunk/code/client/cl_cgame.c	2008-06-04 21:49:15 UTC (rev 1365)
+++ trunk/code/client/cl_cgame.c	2008-06-04 21:50:00 UTC (rev 1366)
@@ -935,6 +935,8 @@
 		clc.speexInitialized = qtrue;
 		clc.voipMuteAll = qfalse;
 		Cmd_AddCommand ("voip", CL_Voip_f);
+		Cvar_Set("cl_voipSendTarget", "all");
+		clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0x7FFFFFFF;
 	}
 #endif
 }

Modified: trunk/code/client/cl_input.c
===================================================================
--- trunk/code/client/cl_input.c	2008-06-04 21:49:15 UTC (rev 1365)
+++ trunk/code/client/cl_input.c	2008-06-04 21:50:00 UTC (rev 1366)
@@ -759,6 +759,33 @@
 	}
 
 	#if USE_VOIP
+	// Move cl_voipSendTarget from a string to a
+	if (cl_voipSendTarget->modified) {
+		const char *target = cl_voipSendTarget->string;
+		if ((*target == '\0') || (Q_stricmp(target, "all") == 0)) {
+			clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0x7FFFFFFF;
+		} else if (Q_stricmp(target, "none") == 0) {
+			clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0;
+		} else {
+			clc.voipTarget1 = clc.voipTarget2 = clc.voipTarget3 = 0;
+			const char *ptr = target;
+			do {
+				if ((*ptr == ',') || (*ptr == '\0')) {
+					const int val = atoi(target);
+					target = ptr + 1;
+					if ((val >= 0) && (val < 31)) {
+						clc.voipTarget1 |= (1 << (val-0));
+					} else if ((val >= 31) && (val < 62)) {
+						clc.voipTarget2 |= (1 << (val-31));
+					} else if ((val >= 62) && (val < 93)) {
+						clc.voipTarget3 |= (1 << (val-62));
+					}
+				}
+			} while (*(ptr++));
+		}
+		cl_voipSendTarget->modified = qfalse;
+	}
+
 	if (clc.voipOutgoingDataSize > 0) {  // only send if data.
 		MSG_WriteByte (&buf, clc_EOF);  // placate legacy servers.
 		MSG_WriteByte (&buf, clc_extension);
@@ -766,9 +793,9 @@
 		MSG_WriteByte (&buf, clc.voipOutgoingGeneration);
 		MSG_WriteLong (&buf, clc.voipOutgoingSequence);
 		MSG_WriteByte (&buf, clc.voipOutgoingDataFrames);
-		MSG_WriteLong (&buf, 0x7FFFFFFF);  // !!! FIXME: send to specific people.
-		MSG_WriteLong (&buf, 0x7FFFFFFF);  // !!! FIXME: send to specific people.
-		MSG_WriteLong (&buf, 0x7FFFFFFF);  // !!! FIXME: send to specific people.
+		MSG_WriteLong (&buf, clc.voipTarget1);
+		MSG_WriteLong (&buf, clc.voipTarget2);
+		MSG_WriteLong (&buf, clc.voipTarget3);
 		MSG_WriteShort (&buf, clc.voipOutgoingDataSize);
 		MSG_WriteData (&buf, clc.voipOutgoingData, clc.voipOutgoingDataSize);
 		clc.voipOutgoingSequence += clc.voipOutgoingDataFrames;

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-06-04 21:49:15 UTC (rev 1365)
+++ trunk/code/client/cl_main.c	2008-06-04 21:50:00 UTC (rev 1366)
@@ -35,6 +35,7 @@
 
 #if USE_VOIP
 cvar_t	*cl_voipSend;
+cvar_t	*cl_voipSendTarget;
 cvar_t	*cl_voipGainDuringCapture;
 cvar_t	*voip;
 #endif
@@ -3052,6 +3053,7 @@
 
 #if USE_VOIP
 	cl_voipSend = Cvar_Get ("cl_voipSend", "0", 0);
+	cl_voipSendTarget = Cvar_Get ("cl_voipSendTarget", "all", 0);
 	cl_voipGainDuringCapture = Cvar_Get ("cl_voipGainDuringCapture", "0.2", CVAR_ARCHIVE);
 	voip = Cvar_Get ("voip", "1", CVAR_USERINFO | CVAR_ARCHIVE | CVAR_LATCH);
 

Modified: trunk/code/client/client.h
===================================================================
--- trunk/code/client/client.h	2008-06-04 21:49:15 UTC (rev 1365)
+++ trunk/code/client/client.h	2008-06-04 21:50:00 UTC (rev 1366)
@@ -244,6 +244,9 @@
 	qboolean voipMuteAll;
 
 	// outgoing data...
+	int voipTarget1;  // these three ints make up a bit mask of 92 bits.
+	int voipTarget2;  //  the bits say who a VoIP pack is addressed to:
+	int voipTarget3;  //  (1 << clientnum). See cl_voipSendTarget cvar.
 	SpeexBits speexEncoderBits;
 	void *speexEncoder;
 	int voipOutgoingDataSize;
@@ -402,7 +405,11 @@
 #endif
 
 #if USE_VOIP
+// cl_voipSendTarget is a string: "all" to broadcast to everyone, "none" to
+//  send to no one, or a comma-separated list of client numbers:
+//  "0,7,2,23" ... an empty string is treated like "all".
 extern	cvar_t	*cl_voipSend;
+extern	cvar_t	*cl_voipSendTarget;
 extern	cvar_t	*cl_voipGainDuringCapture;
 extern	cvar_t	*voip;
 #endif




More information about the quake3-commits mailing list