[asterisk-commits] bbryant: branch bbryant/noise_reduction_and_agc r114851 - /team/bbryant/noise...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 29 15:05:06 CDT 2008


Author: bbryant
Date: Tue Apr 29 15:05:06 2008
New Revision: 114851

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114851
Log:
Update branch again.

Modified:
    team/bbryant/noise_reduction_and_agc/funcs/func_speex.c

Modified: team/bbryant/noise_reduction_and_agc/funcs/func_speex.c
URL: http://svn.digium.com/view/asterisk/team/bbryant/noise_reduction_and_agc/funcs/func_speex.c?view=diff&rev=114851&r1=114850&r2=114851
==============================================================================
--- team/bbryant/noise_reduction_and_agc/funcs/func_speex.c (original)
+++ team/bbryant/noise_reduction_and_agc/funcs/func_speex.c Tue Apr 29 15:05:06 2008
@@ -47,7 +47,7 @@
 #define DEFAULT_AGC_LEVEL 8000.0
 
 struct speex_direction_info {
-	uint8_t denoise;
+	int denoise;
 	float agclevel;
 	SpeexPreprocessState *preprocess_state;
 };
@@ -57,12 +57,6 @@
 	struct speex_direction_info tx, rx;
 };
 
-/*struct denoise_info {
-	struct ast_audiohook audiohook;
-	uint8_t tx_enabled, rx_enabled;
-	SpeexPreprocessState *preprocess_state;
-};*/
-
 static void destroy_callback(void *data) 
 {
 	struct speex_info *si = data;
@@ -82,6 +76,7 @@
 	struct ast_datastore *datastore = NULL;
 	struct speex_info *si = NULL;
 	struct speex_direction_info *sdi = NULL;
+	int agcenabled;
 
 	/* If the audiohook is stopping it means the channel is shutting down.... but we let the datastore destroy take care of it */
 	if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE)
@@ -98,8 +93,13 @@
 
 	sdi = (direction = AST_AUDIOHOOK_DIRECTION_READ) ? &si->rx : &si->tx;
 
+	agcenabled = !!sdi->agclevel;
+
 	speex_preprocess_ctl(sdi->preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, &sdi->denoise);
-	speex_preprocess_ctl(sdi->preprocess_state, SPEEX_PREPROCESS_SET_AGC_LEVEL, &sdi->agclevel);
+	speex_preprocess_ctl(sdi->preprocess_state, SPEEX_PREPROCESS_SET_AGC, &agcenabled);
+	if (agcenabled)
+		speex_preprocess_ctl(sdi->preprocess_state, SPEEX_PREPROCESS_SET_AGC_LEVEL, &sdi->agclevel);
+
 	speex_preprocess(sdi->preprocess_state, frame->data, NULL);
 
 	return 0;
@@ -127,7 +127,6 @@
 	} else {
 		si = datastore->data;
 	}
-
 	
 	if (!strcasecmp(cmd, "agc")) {
 		if (!strcasecmp(data, "tx") && !sscanf(value, "%f", agcval))




More information about the asterisk-commits mailing list