DTMF: Now allows to give duration and pause for digit

Also the dtmf encoder will return less samples, if the digit(+pause)
ends, so that the caller call set the next digit to play seamlessly.

A reset function allows to clear the decoder states, to prevent glitches
when re-attaching to an interrupted stream.
This commit is contained in:
Andreas Eversberg
2022-09-29 20:02:50 +02:00
parent a756ba8fd9
commit b60c844b4f
9 changed files with 74 additions and 44 deletions

View File

@@ -96,7 +96,7 @@ int main(void)
for (i = 0; i < 16; i++) {
printf("Testing digit '%c' encoding and decoding:\n", test_digits[i]);
memset(samples, 0, sizeof(samples[0]) * SAMPLERATE);
dtmf_encode_set_tone(&dtmf_enc, test_digits[i]);
dtmf_encode_set_tone(&dtmf_enc, test_digits[i], 1.0, 0.0);
dtmf_encode(&dtmf_enc, samples + SAMPLERATE / 10, SAMPLERATE / 20);
got_digit = 0;
dtmf_decode(&dtmf_dec, samples, SAMPLERATE);