[Freeswitch-svn] [commit] r5381 - in freeswitch/trunk: libs/libteletone libs/libteletone/src src src/include

Freeswitch SVN mikej at freeswitch.org
Fri Jun 15 23:56:44 EDT 2007


Author: mikej
Date: Fri Jun 15 23:56:44 2007
New Revision: 5381

Modified:
   freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
   freeswitch/trunk/libs/libteletone/teletone.def
   freeswitch/trunk/src/include/switch_cpp.h
   freeswitch/trunk/src/switch_cpp.cpp

Log:
fix windows build.

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 Jun 15 23:56:44 2007
@@ -126,7 +126,7 @@
     for (i = 0;  i < samples;  i++) {
         v1 = goertzel_state->v2;
         goertzel_state->v2 = goertzel_state->v3;
-        goertzel_state->v3 = goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i];
+        goertzel_state->v3 = (float)(goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i]);
     }
 }
 
@@ -140,17 +140,17 @@
     dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0;
 
     for (i = 0;  i < GRID_FACTOR;  i++) {
-        theta = M_TWO_PI*(dtmf_row[i]/(float)sample_rate);
-        dtmf_detect_row[i].fac = 2.0*cos(theta);
+        theta = (float)(M_TWO_PI*(dtmf_row[i]/(float)sample_rate));
+        dtmf_detect_row[i].fac = (float)(2.0f*cos(theta));
 
-        theta = M_TWO_PI*(dtmf_col[i]/(float)sample_rate);
-        dtmf_detect_col[i].fac = 2.0*cos(theta);
+        theta = (float)(M_TWO_PI*(dtmf_col[i]/(float)sample_rate));
+        dtmf_detect_col[i].fac = (float)(2.0f*cos(theta));
     
-        theta = M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate);
-        dtmf_detect_row_2nd[i].fac = 2.0*cos(theta);
+        theta = (float)(M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate));
+        dtmf_detect_row_2nd[i].fac = (float)(2.0f*cos(theta));
 
-        theta = M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate);
-        dtmf_detect_col_2nd[i].fac = 2.0*cos(theta);
+        theta = (float)(M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate));
+        dtmf_detect_col_2nd[i].fac = (float)(2.0f*cos(theta));
     
 		goertzel_init (&dtmf_detect_state->row_out[i], &dtmf_detect_row[i]);
     	goertzel_init (&dtmf_detect_state->col_out[i], &dtmf_detect_col[i]);
@@ -196,8 +196,8 @@
 			break;
 		}
 		mt->tone_count++;
-		theta = M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate);
-		mt->tdd[x].fac = 2.0 * cos(theta);
+		theta = (float)(M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate));
+		mt->tdd[x].fac = (float)(2.0f * cos(theta));
 		goertzel_init (&mt->gs[x], &mt->tdd[x]);
 		goertzel_init (&mt->gs2[x], &mt->tdd[x]);
 	}
@@ -230,11 +230,11 @@
 			for(x = 0; x < mt->tone_count; x++) {
 				v1 = mt->gs[x].v2;
 				mt->gs[x].v2 = mt->gs[x].v3;
-				mt->gs[x].v3 = mt->gs[x].fac * mt->gs[x].v2 - v1 + famp;
+				mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp);
     
 				v1 = mt->gs2[x].v2;
 				mt->gs2[x].v2 = mt->gs2[x].v3;
-				mt->gs2[x].v3 = mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp;
+				mt->gs2[x].v3 = (float)(mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp);
 			}
 		}
 
@@ -245,7 +245,7 @@
 
 		eng_sum = 0;
 		for(x = 0; x < mt->tone_count; x++) {
-			eng_all[x] = teletone_goertzel_result (&mt->gs[x]);
+			eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x]));
 			eng_sum += eng_all[x];
 		}
 
@@ -325,19 +325,19 @@
 			for(x = 0; x < GRID_FACTOR; x++) {
 				v1 = dtmf_detect_state->row_out[x].v2;
 				dtmf_detect_state->row_out[x].v2 = dtmf_detect_state->row_out[x].v3;
-				dtmf_detect_state->row_out[x].v3 = dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp;
+				dtmf_detect_state->row_out[x].v3 = (float)(dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp);
     
 				v1 = dtmf_detect_state->col_out[x].v2;
 				dtmf_detect_state->col_out[x].v2 = dtmf_detect_state->col_out[x].v3;
-				dtmf_detect_state->col_out[x].v3 = dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp;
+				dtmf_detect_state->col_out[x].v3 = (float)(dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp);
 
 				v1 = dtmf_detect_state->col_out2nd[x].v2;
 				dtmf_detect_state->col_out2nd[x].v2 = dtmf_detect_state->col_out2nd[x].v3;
-				dtmf_detect_state->col_out2nd[x].v3 = dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp;
+				dtmf_detect_state->col_out2nd[x].v3 = (float)(dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp);
         
 				v1 = dtmf_detect_state->row_out2nd[x].v2;
 				dtmf_detect_state->row_out2nd[x].v2 = dtmf_detect_state->row_out2nd[x].v3;
-				dtmf_detect_state->row_out2nd[x].v3 = dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp;
+				dtmf_detect_state->row_out2nd[x].v3 = (float)(dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp);
 			}
 
         }
@@ -348,15 +348,15 @@
 		}
         /* We are at the end of a DTMF detection block */
         /* Find the peak row and the peak column */
-        row_energy[0] = teletone_goertzel_result (&dtmf_detect_state->row_out[0]);
-        col_energy[0] = teletone_goertzel_result (&dtmf_detect_state->col_out[0]);
+        row_energy[0] = (float)(teletone_goertzel_result (&dtmf_detect_state->row_out[0]));
+        col_energy[0] = (float)(teletone_goertzel_result (&dtmf_detect_state->col_out[0]));
 
 		for (best_row = best_col = 0, i = 1;  i < GRID_FACTOR;  i++) {
-    	    row_energy[i] = teletone_goertzel_result (&dtmf_detect_state->row_out[i]);
+    	    row_energy[i] = (float)(teletone_goertzel_result (&dtmf_detect_state->row_out[i]));
             if (row_energy[i] > row_energy[best_row]) {
                 best_row = i;
 			}
-    	    col_energy[i] = teletone_goertzel_result (&dtmf_detect_state->col_out[i]);
+    	    col_energy[i] = (float)(teletone_goertzel_result (&dtmf_detect_state->col_out[i]));
             if (col_energy[i] > col_energy[best_col]) {
                 best_col = i;
 			}

Modified: freeswitch/trunk/libs/libteletone/teletone.def
==============================================================================
--- freeswitch/trunk/libs/libteletone/teletone.def	(original)
+++ freeswitch/trunk/libs/libteletone/teletone.def	Fri Jun 15 23:56:44 2007
@@ -5,7 +5,6 @@
 teletone_init_session
 teletone_set_map
 teletone_set_tone
-teletone_goertzel_result
 teletone_goertzel_update
 teletone_dtmf_get
 teletone_dtmf_detect

Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h	(original)
+++ freeswitch/trunk/src/include/switch_cpp.h	Fri Jun 15 23:56:44 2007
@@ -28,7 +28,7 @@
                               // eg, PyThreadState *threadState
     void *extra;              // currently used to store a switch_file_handle_t
     char *funcargs;           // extra string that will be passed to callback function 
-};
+} input_callback_state;
 
 
 class CoreSession {

Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp	(original)
+++ freeswitch/trunk/src/switch_cpp.cpp	Fri Jun 15 23:56:44 2007
@@ -212,8 +212,6 @@
 
     switch_status_t status;
     switch_file_handle_t fh = { 0 };
-    unsigned int samps;
-    unsigned int pos = 0;
 	char *prebuf;
 
     sanity_check(-1);



More information about the Freeswitch-svn mailing list