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]);
}
}
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]);
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]);
}
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);
}
}
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];
}
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);
}
}
}
/* 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;
}