]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix windows build.
authorMichael Jerris <mike@jerris.com>
Sat, 16 Jun 2007 03:56:44 +0000 (03:56 +0000)
committerMichael Jerris <mike@jerris.com>
Sat, 16 Jun 2007 03:56:44 +0000 (03:56 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5381 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/libteletone/src/libteletone_detect.c
libs/libteletone/teletone.def
src/include/switch_cpp.h
src/switch_cpp.cpp

index a1d95abcd49fd9c82aab722afeecde467ff6ccaf..14eb1688dad0b40d00c95748f2d72b91dd0b96d6 100644 (file)
@@ -126,7 +126,7 @@ void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
     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 @@ void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state,
     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 @@ void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *ma
                        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 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
                        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 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
 
                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 @@ int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
                        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 @@ int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
                }
         /* 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;
                        }
index b518aeb2ac9825c15271fa13f8afc452862bd84b..79c60619ad3f3afa7263ebdfd6c9d211cbc4e591 100644 (file)
@@ -5,7 +5,6 @@ teletone_destroy_session
 teletone_init_session\r
 teletone_set_map\r
 teletone_set_tone\r
-teletone_goertzel_result\r
 teletone_goertzel_update\r
 teletone_dtmf_get\r
 teletone_dtmf_detect\r
index 32ae0023278db9bedab4e8e4ad4750ffc87d3a68..2d6609b2cfe48ad7eb33870affb7940091d37edf 100644 (file)
@@ -28,7 +28,7 @@ typedef struct input_callback_state {
                               // 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 {
index 4c30b4c939e9a1b23417e97b8cf6fbcd9e796409..8a26b3a19819aa61d09b2a2e6b28eabf024b9573 100644 (file)
@@ -212,8 +212,6 @@ int CoreSession::streamfile(char *file, int starting_sample_count) {
 
     switch_status_t status;
     switch_file_handle_t fh = { 0 };
-    unsigned int samps;
-    unsigned int pos = 0;
        char *prebuf;
 
     sanity_check(-1);