fix windows build.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5381 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
365b8c515d
commit
3f025790ea
|
@ -126,7 +126,7 @@ void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
|
||||||
for (i = 0; i < samples; i++) {
|
for (i = 0; i < samples; i++) {
|
||||||
v1 = goertzel_state->v2;
|
v1 = goertzel_state->v2;
|
||||||
goertzel_state->v2 = goertzel_state->v3;
|
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;
|
dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0;
|
||||||
|
|
||||||
for (i = 0; i < GRID_FACTOR; i++) {
|
for (i = 0; i < GRID_FACTOR; i++) {
|
||||||
theta = M_TWO_PI*(dtmf_row[i]/(float)sample_rate);
|
theta = (float)(M_TWO_PI*(dtmf_row[i]/(float)sample_rate));
|
||||||
dtmf_detect_row[i].fac = 2.0*cos(theta);
|
dtmf_detect_row[i].fac = (float)(2.0f*cos(theta));
|
||||||
|
|
||||||
theta = M_TWO_PI*(dtmf_col[i]/(float)sample_rate);
|
theta = (float)(M_TWO_PI*(dtmf_col[i]/(float)sample_rate));
|
||||||
dtmf_detect_col[i].fac = 2.0*cos(theta);
|
dtmf_detect_col[i].fac = (float)(2.0f*cos(theta));
|
||||||
|
|
||||||
theta = M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate);
|
theta = (float)(M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate));
|
||||||
dtmf_detect_row_2nd[i].fac = 2.0*cos(theta);
|
dtmf_detect_row_2nd[i].fac = (float)(2.0f*cos(theta));
|
||||||
|
|
||||||
theta = M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate);
|
theta = (float)(M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate));
|
||||||
dtmf_detect_col_2nd[i].fac = 2.0*cos(theta);
|
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->row_out[i], &dtmf_detect_row[i]);
|
||||||
goertzel_init (&dtmf_detect_state->col_out[i], &dtmf_detect_col[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;
|
break;
|
||||||
}
|
}
|
||||||
mt->tone_count++;
|
mt->tone_count++;
|
||||||
theta = M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate);
|
theta = (float)(M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate));
|
||||||
mt->tdd[x].fac = 2.0 * cos(theta);
|
mt->tdd[x].fac = (float)(2.0f * cos(theta));
|
||||||
goertzel_init (&mt->gs[x], &mt->tdd[x]);
|
goertzel_init (&mt->gs[x], &mt->tdd[x]);
|
||||||
goertzel_init (&mt->gs2[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++) {
|
for(x = 0; x < mt->tone_count; x++) {
|
||||||
v1 = mt->gs[x].v2;
|
v1 = mt->gs[x].v2;
|
||||||
mt->gs[x].v2 = mt->gs[x].v3;
|
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;
|
v1 = mt->gs2[x].v2;
|
||||||
mt->gs2[x].v2 = mt->gs2[x].v3;
|
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;
|
eng_sum = 0;
|
||||||
for(x = 0; x < mt->tone_count; x++) {
|
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];
|
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++) {
|
for(x = 0; x < GRID_FACTOR; x++) {
|
||||||
v1 = dtmf_detect_state->row_out[x].v2;
|
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].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;
|
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].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;
|
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].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;
|
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].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 */
|
/* We are at the end of a DTMF detection block */
|
||||||
/* Find the peak row and the peak column */
|
/* Find the peak row and the peak column */
|
||||||
row_energy[0] = teletone_goertzel_result (&dtmf_detect_state->row_out[0]);
|
row_energy[0] = (float)(teletone_goertzel_result (&dtmf_detect_state->row_out[0]));
|
||||||
col_energy[0] = teletone_goertzel_result (&dtmf_detect_state->col_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++) {
|
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]) {
|
if (row_energy[i] > row_energy[best_row]) {
|
||||||
best_row = i;
|
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]) {
|
if (col_energy[i] > col_energy[best_col]) {
|
||||||
best_col = i;
|
best_col = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ teletone_destroy_session
|
||||||
teletone_init_session
|
teletone_init_session
|
||||||
teletone_set_map
|
teletone_set_map
|
||||||
teletone_set_tone
|
teletone_set_tone
|
||||||
teletone_goertzel_result
|
|
||||||
teletone_goertzel_update
|
teletone_goertzel_update
|
||||||
teletone_dtmf_get
|
teletone_dtmf_get
|
||||||
teletone_dtmf_detect
|
teletone_dtmf_detect
|
||||||
|
|
|
@ -28,7 +28,7 @@ typedef struct input_callback_state {
|
||||||
// eg, PyThreadState *threadState
|
// eg, PyThreadState *threadState
|
||||||
void *extra; // currently used to store a switch_file_handle_t
|
void *extra; // currently used to store a switch_file_handle_t
|
||||||
char *funcargs; // extra string that will be passed to callback function
|
char *funcargs; // extra string that will be passed to callback function
|
||||||
};
|
} input_callback_state;
|
||||||
|
|
||||||
|
|
||||||
class CoreSession {
|
class CoreSession {
|
||||||
|
|
|
@ -212,8 +212,6 @@ int CoreSession::streamfile(char *file, int starting_sample_count) {
|
||||||
|
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
switch_file_handle_t fh = { 0 };
|
switch_file_handle_t fh = { 0 };
|
||||||
unsigned int samps;
|
|
||||||
unsigned int pos = 0;
|
|
||||||
char *prebuf;
|
char *prebuf;
|
||||||
|
|
||||||
sanity_check(-1);
|
sanity_check(-1);
|
||||||
|
|
Loading…
Reference in New Issue