From 58f1c9a91226f4954a4799fab082f186923aa806 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sat, 3 Oct 2020 16:25:48 +0200 Subject: Add libraries from Osmocom-Analog --- src/libdtmf/dtmf_encode.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/libdtmf/dtmf_encode.h (limited to 'src/libdtmf/dtmf_encode.h') diff --git a/src/libdtmf/dtmf_encode.h b/src/libdtmf/dtmf_encode.h new file mode 100644 index 0000000..15ac05e --- /dev/null +++ b/src/libdtmf/dtmf_encode.h @@ -0,0 +1,14 @@ + +typedef struct dtmf_enc { + int samplerate; /* samplerate */ + char tone; /* current tone to be played */ + int pos; /* sample counter for tone */ + int max; /* max number of samples for tone duration */ + double phaseshift65536[2]; /* how much the phase of sine wave changes per sample */ + double phase65536[2]; /* current phase */ +} dtmf_enc_t; + +void dtmf_encode_init(dtmf_enc_t *dtmf, int samplerate, double dBm_level); +void dtmf_encode_set_tone(dtmf_enc_t *dtmf, char tone); +void dtmf_encode(dtmf_enc_t *dtmf, sample_t *samples, int length); + -- cgit v1.2.3