/* Decode DTMF tones, queue result in separate sk_buf for later examination. Parameters: s = pointer to state-struct. buf = input audio data len = size of audio data. fmt = audio data format (0 = ulaw, 1 = alaw)  */
void isdn_audio_calc_dtmf(modem_info *info, unsigned char *buf, int len, int fmt)
/* Decode DTMF tones, queue result in separate sk_buf for later examination. Parameters: s = pointer to state-struct. buf = input audio data len = size of audio data. fmt = audio data format (0 = ulaw, 1 = alaw)  */
void isdn_audio_calc_dtmf(modem_info *info, unsigned char *buf, int len, int fmt)
{
	dtmf_state *s = info->dtmf_state;
	int i;
	int c;
	while (len) {
		c = DTMF_NPOINTS - s->idx;
		if (c > len)
			c = len;
		if (c <= 0)
			break;
		for (i = 0; i < c; i++) {
			if (fmt)
				s->buf[s->idx++] =
				    isdn_audio_alaw_to_s16[*buf++] >> (15 - AMP_BITS);
			else
				s->buf[s->idx++] =
				    isdn_audio_ulaw_to_s16[*buf++] >> (15 - AMP_BITS);
		}
		if (s->idx == DTMF_NPOINTS) {
			isdn_audio_goertzel(s->buf, info);
			s->idx = 0;
		}
		len -= c;
	}
}