From 3f025790eaf0ff0221edf3538c7062c7c11e1920 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sat, 16 Jun 2007 03:56:44 +0000 Subject: [PATCH] fix windows build. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5381 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/libteletone/src/libteletone_detect.c | 44 +++++++++++------------ libs/libteletone/teletone.def | 1 - src/include/switch_cpp.h | 2 +- src/switch_cpp.cpp | 2 -- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/libs/libteletone/src/libteletone_detect.c b/libs/libteletone/src/libteletone_detect.c index a1d95abcd4..14eb1688da 100644 --- a/libs/libteletone/src/libteletone_detect.c +++ b/libs/libteletone/src/libteletone_detect.c @@ -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; } diff --git a/libs/libteletone/teletone.def b/libs/libteletone/teletone.def index b518aeb2ac..79c60619ad 100644 --- a/libs/libteletone/teletone.def +++ b/libs/libteletone/teletone.def @@ -5,7 +5,6 @@ teletone_destroy_session teletone_init_session teletone_set_map teletone_set_tone -teletone_goertzel_result teletone_goertzel_update teletone_dtmf_get teletone_dtmf_detect diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 32ae002327..2d6609b2cf 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -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 { diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 4c30b4c939..8a26b3a198 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -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);