r1365 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jun 4 17:49:16 EDT 2008


Author: icculus
Date: 2008-06-04 17:49:15 -0400 (Wed, 04 Jun 2008)
New Revision: 1365

Modified:
   trunk/code/client/cl_cgame.c
   trunk/code/client/cl_main.c
   trunk/code/client/cl_parse.c
   trunk/code/client/client.h
Log:
VoIP: client can now specify targets for voice transmission.


Modified: trunk/code/client/cl_cgame.c
===================================================================
--- trunk/code/client/cl_cgame.c	2008-06-04 05:28:54 UTC (rev 1364)
+++ trunk/code/client/cl_cgame.c	2008-06-04 21:49:15 UTC (rev 1365)
@@ -928,6 +928,7 @@
 			speex_bits_reset(&clc.speexDecoderBits[i]);
 			clc.speexDecoder[i] = speex_decoder_init(&speex_nb_mode);
 			clc.voipIgnore[i] = qfalse;
+			clc.voipGain[i] = 1.0f;
 		}
 		speex_encoder_ctl(clc.speexEncoder, SPEEX_GET_FRAME_SIZE,
 		                  &clc.speexFrameSize);

Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c	2008-06-04 05:28:54 UTC (rev 1364)
+++ trunk/code/client/cl_main.c	2008-06-04 21:49:15 UTC (rev 1365)
@@ -190,6 +190,20 @@
 	}
 }
 
+static
+void CL_UpdateVoipGain(const char *idstr, float gain)
+{
+	if ((*idstr >= '0') && (*idstr <= '9')) {
+		const int id = atoi(idstr);
+		if (gain < 0.0f)
+			gain = 0.0f;
+		if ((id >= 0) && (id < MAX_CLIENTS)) {
+			clc.voipGain[id] = gain;
+			Com_Printf("VoIP: player #%d gain now set to %f\n", id, gain);
+		}
+	}
+}
+
 void CL_Voip_f( void )
 {
 	const char *cmd = Cmd_Argv(1);
@@ -213,6 +227,8 @@
 		CL_UpdateVoipIgnore(Cmd_Argv(2), qtrue);
 	} else if (strcmp(cmd, "unignore") == 0) {
 		CL_UpdateVoipIgnore(Cmd_Argv(2), qfalse);
+	} else if (strcmp(cmd, "gain") == 0) {
+		CL_UpdateVoipGain(Cmd_Argv(2), atof(Cmd_Argv(3)));
 	} else if (strcmp(cmd, "muteall") == 0) {
 		Com_Printf("VoIP: muting incoming voice\n");
 		CL_AddReliableCommand("voip muteall");

Modified: trunk/code/client/cl_parse.c
===================================================================
--- trunk/code/client/cl_parse.c	2008-06-04 05:28:54 UTC (rev 1364)
+++ trunk/code/client/cl_parse.c	2008-06-04 21:49:15 UTC (rev 1365)
@@ -647,6 +647,8 @@
 		return qtrue;  // all channels are muted with extreme prejudice.
 	else if (clc.voipIgnore[sender])
 		return qtrue;  // just ignoring this guy.
+	else if (clc.voipGain[sender] == 0.0f)
+		return qtrue;  // too quiet to play.
 
 	return qfalse;  // !!! FIXME: implement per-channel muting.
 }
@@ -758,7 +760,7 @@
 			Com_DPrintf("VoIP: playback %d bytes, %d samples, %d frames\n",
 			            written * 2, written, i);
 			S_RawSamples(sender + 1, written, 8000, 2, 1,
-			             (const byte *) decoded, 1.0f);  // !!! FIXME: hardcoding!
+			             (const byte *) decoded, clc.voipGain[sender]);  // !!! FIXME: hardcoding!
 			written = 0;
 		}
 

Modified: trunk/code/client/client.h
===================================================================
--- trunk/code/client/client.h	2008-06-04 05:28:54 UTC (rev 1364)
+++ trunk/code/client/client.h	2008-06-04 21:49:15 UTC (rev 1365)
@@ -239,6 +239,7 @@
 	void *speexDecoder[MAX_CLIENTS];
 	byte voipIncomingGeneration[MAX_CLIENTS];
 	int voipIncomingSequence[MAX_CLIENTS];
+	float voipGain[MAX_CLIENTS];
 	qboolean voipIgnore[MAX_CLIENTS];
 	qboolean voipMuteAll;
 




More information about the quake3-commits mailing list