From cd82c923711556a2755b5ab97dfcee12ed5d7cd1 Mon Sep 17 00:00:00 2001 From: icculus Date: Sat, 5 Jul 2008 04:38:16 +0000 Subject: VOIP: Added cvar cl_voipCaptureMult to boost gain on recorded bits. git-svn-id: svn://svn.icculus.org/quake3/trunk@1403 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/client/cl_main.c | 9 ++++++++- code/client/client.h | 1 + voip-readme.txt | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/code/client/cl_main.c b/code/client/cl_main.c index 56343f8..98b8644 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_voipCaptureMult; cvar_t *cl_voipShowMeter; cvar_t *voip; #endif @@ -268,6 +269,7 @@ Record more audio from the hardware if required and encode it into Speex static void CL_CaptureVoip(void) { + const float audioMult = cl_voipCaptureMult->value; const qboolean useVad = (cl_voipUseVAD->integer != 0); qboolean initialFrame = qfalse; qboolean finalFrame = qfalse; @@ -304,6 +306,8 @@ void CL_CaptureVoip(void) dontCapture = qtrue; // playing back a demo. else if ( voip->integer == 0 ) dontCapture = qtrue; // client has VoIP support disabled. + else if ( audioMult == 0.0f ) + dontCapture = qtrue; // basically silenced incoming audio. cl_voipSend->modified = qfalse; @@ -362,8 +366,10 @@ void CL_CaptureVoip(void) // check the "power" of this packet... for (i = 0; i < clc.speexFrameSize; i++) { - const float s = fabs((float) sampptr[i]); + const float flsamp = (float) sampptr[i]; + const float s = fabs(flsamp); voipPower += s * s; + sampptr[i] = (int16_t) ((flsamp) * audioMult); } // encode raw audio samples into Speex data... @@ -3089,6 +3095,7 @@ void CL_Init( void ) { 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); + cl_voipCaptureMult = Cvar_Get ("cl_voipCaptureMult", "2.0", CVAR_ARCHIVE); cl_voipUseVAD = Cvar_Get ("cl_voipUseVAD", "0", CVAR_ARCHIVE); cl_voipVADThreshold = Cvar_Get ("cl_voipVADThreshold", "0.25", CVAR_ARCHIVE); cl_voipShowMeter = Cvar_Get ("cl_voipShowMeter", "1", CVAR_ARCHIVE); diff --git a/code/client/client.h b/code/client/client.h index 3fbceff..42d4b0a 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_voipCaptureMult; extern cvar_t *cl_voipShowMeter; extern cvar_t *voip; #endif diff --git a/voip-readme.txt b/voip-readme.txt index 7b99eef..05320c5 100644 --- a/voip-readme.txt +++ b/voip-readme.txt @@ -94,6 +94,12 @@ cl_voipShowMeter: Set to "1" (the default) to show a volume meter as you are game can "hear" you. Set to "0" to disable the display of the meter. +cl_voipCaptureMult: Multiply recorded audio by this value after denoising. + Defaults to 2.0 to _double_ the volume of your voice. + This is to make you more audible if denoising eats away + too much data. Set this to 1.0 to get no change, less to + be quieter. + Console commands: -- cgit v1.2.3