r1373 - trunk/code/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Jun 7 10:39:50 EDT 2008
Author: icculus
Date: 2008-06-07 10:39:49 -0400 (Sat, 07 Jun 2008)
New Revision: 1373
Modified:
trunk/code/client/cl_cgame.c
trunk/code/client/cl_main.c
trunk/code/client/client.h
Log:
VoIP: Initial work on adding Speex preprocessor.
Modified: trunk/code/client/cl_cgame.c
===================================================================
--- trunk/code/client/cl_cgame.c 2008-06-07 14:38:46 UTC (rev 1372)
+++ trunk/code/client/cl_cgame.c 2008-06-07 14:39:49 UTC (rev 1373)
@@ -922,13 +922,21 @@
int i;
speex_bits_init(&clc.speexEncoderBits);
speex_bits_reset(&clc.speexEncoderBits);
+
clc.speexEncoder = speex_encoder_init(&speex_nb_mode);
speex_encoder_ctl(clc.speexEncoder, SPEEX_GET_FRAME_SIZE,
&clc.speexFrameSize);
speex_encoder_ctl(clc.speexEncoder, SPEEX_GET_SAMPLING_RATE,
- &clc.speexSamplingRate);
+ &clc.speexSampleRate);
+ clc.speexPreprocessor = speex_preprocess_state_init(clc.speexFrameSize,
+ clc.speexSampleRate);
+
+ i = 1;
+ speex_preprocess_ctl(clc.speexPreprocessor,
+ SPEEX_PREPROCESS_SET_DENOISE, &i);
+
for (i = 0; i < MAX_CLIENTS; i++) {
speex_bits_init(&clc.speexDecoderBits[i]);
speex_bits_reset(&clc.speexDecoderBits[i]);
Modified: trunk/code/client/cl_main.c
===================================================================
--- trunk/code/client/cl_main.c 2008-06-07 14:38:46 UTC (rev 1372)
+++ trunk/code/client/cl_main.c 2008-06-07 14:39:49 UTC (rev 1373)
@@ -345,6 +345,8 @@
voipPower = s; // !!! FIXME: this isn't very clever.
}
+ speex_preprocess_run(clc.speexPreprocessor, &sampbuffer[pos]);
+
// Encode raw audio samples into Speex data...
speex_bits_reset(&clc.speexEncoderBits);
speex_encode_int(clc.speexEncoder, &sampbuffer[pos],
@@ -1136,12 +1138,12 @@
int i;
speex_bits_destroy(&clc.speexEncoderBits);
speex_encoder_destroy(clc.speexEncoder);
+ speex_preprocess_state_destroy(clc.speexPreprocessor);
for (i = 0; i < MAX_CLIENTS; i++) {
speex_bits_destroy(&clc.speexDecoderBits[i]);
speex_decoder_destroy(clc.speexDecoder[i]);
}
}
-
Cmd_RemoveCommand ("voip");
#endif
Modified: trunk/code/client/client.h
===================================================================
--- trunk/code/client/client.h 2008-06-07 14:38:46 UTC (rev 1372)
+++ trunk/code/client/client.h 2008-06-07 14:39:49 UTC (rev 1373)
@@ -36,6 +36,7 @@
#if USE_VOIP
#include "speex/speex.h"
+#include "speex/speex_preprocess.h"
#endif
// file full of random crap that gets used to create cl_guid
@@ -248,6 +249,7 @@
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.
+ SpeexPreprocessState *speexPreprocessor;
SpeexBits speexEncoderBits;
void *speexEncoder;
int voipOutgoingDataSize;
More information about the quake3-commits
mailing list