Esempio n. 1
0
MPF_DECLARE(void) mpf_dtmf_detector_get_frame(
								struct mpf_dtmf_detector_t *detector,
								const struct mpf_frame_t *frame)
{
	if ((detector->band & MPF_DTMF_DETECTOR_OUTBAND) &&
		(frame->type & MEDIA_FRAME_TYPE_EVENT) &&
		(frame->event_frame.event_id <= DTMF_EVENT_ID_MAX) &&
		(frame->marker == MPF_MARKER_START_OF_EVENT))
	{
		if (detector->band & MPF_DTMF_DETECTOR_INBAND) {
			detector->band &= ~MPF_DTMF_DETECTOR_INBAND;
			apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Out-of-band digit arrived, turning "
				"in-band DTMF detector off");
		}
		mpf_dtmf_detector_add_digit(detector, mpf_event_id_to_dtmf_char(
			frame->event_frame.event_id));
		return;
	}

	if ((detector->band & MPF_DTMF_DETECTOR_INBAND) && (frame->type & MEDIA_FRAME_TYPE_AUDIO)) {
		apr_int16_t *samples = frame->codec_frame.buffer;
		apr_size_t i;

		for (i = 0; i < frame->codec_frame.size / 2; i++) {
			goertzel_sample(detector, samples[i]);
			if (++detector->nsamples >= detector->wsamples) {
				goertzel_energies_digit(detector);
				detector->nsamples = 0;
			}
		}
	}
}
Esempio n. 2
0
File: dsp.c Progetto: OPSF/uClinux
static inline void goertzel_update(goertzel_state_t *s, short *samps, int count)
{
	int i;
	
	for (i=0;i<count;i++) 
		goertzel_sample(s, samps[i]);
}
Esempio n. 3
0
//For all samples, update the goertzel_state_t variable
void CGoertzelDTMFFax::goertzel_update(goertzel_state_t* s, short* samps, int count)
{
    int i;

    for (i=0;i<count;i++) 
		goertzel_sample(s, samps[i]);
}