[Freeswitch-trunk] [commit] r6454 - freeswitch/trunk/libs/libteletone/src

Freeswitch SVN anthm at freeswitch.org
Fri Nov 30 18:30:40 EST 2007


Author: anthm
Date: Fri Nov 30 18:30:40 2007
New Revision: 6454

Modified:
   freeswitch/trunk/libs/libteletone/src/libteletone_detect.c

Log:
update

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.c	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.c	Fri Nov 30 18:30:40 2007
@@ -230,7 +230,7 @@
 			
 			mt->energy += famp*famp;
 
-			for(x = 0; x < mt->tone_count; x++) {
+			for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
 				v1 = mt->gs[x].v2;
 				mt->gs[x].v2 = mt->gs[x].v3;
 				mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp);
@@ -247,13 +247,13 @@
 		}
 
 		eng_sum = 0;
-		for(x = 0; x < mt->tone_count; x++) {
+		for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
 			eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x]));
 			eng_sum += eng_all[x];
 		}
 
 		gtest = 0;
-		for(x = 0; x < mt->tone_count; x++) {
+		for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
 			gtest += teletone_goertzel_result (&mt->gs2[x]) < eng_all[x] ? 1 : 0;
 		}
 
@@ -281,7 +281,7 @@
 		}
 
 		/* Reinitialise the detector for the next block */
-		for(x = 0; x < mt->tone_count; x++) {
+		for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) {
 			goertzel_init (&mt->gs[x], &mt->tdd[x]);
 			goertzel_init (&mt->gs2[x], &mt->tdd[x]);
 		}



More information about the Freeswitch-trunk mailing list