Restructure: Move dtmf from common code to 'libdtmf'

This commit is contained in:
Andreas Eversberg
2017-11-15 18:45:56 +01:00
parent 17b34fbae6
commit fd3a4d7ac2
11 changed files with 31 additions and 23 deletions

View File

@@ -22,6 +22,7 @@ nmt_SOURCES = \
nmt_LDADD = \
$(COMMON_LA) \
libdmssms.a \
$(top_builddir)/src/libdtmf/libdtmf.a \
$(top_builddir)/src/common/libmobile.a \
$(top_builddir)/src/common/libcommon.a \
$(top_builddir)/src/libtimer/libtimer.a \

View File

@@ -148,8 +148,8 @@ int dsp_init_sender(nmt_t *nmt, double deviation_factor)
nmt->dial_phaseshift65536 = 65536.0 / ((double)nmt->sender.samplerate / DIALTONE_HZ);
PDEBUG(DDSP, DEBUG_DEBUG, "dial_phaseshift = %.4f\n", nmt->dial_phaseshift65536);
/* dtmf */
dtmf_init(&nmt->dtmf, 8000);
/* dtmf, generate tone relative to speech level */
dtmf_encode_init(&nmt->dtmf, 8000, 1.0 / SPEECH_LEVEL);
nmt->dmp_frame_level = display_measurements_add(&nmt->sender, "Frame Level", "%.1f %% (last)", DISPLAY_MEAS_LAST, DISPLAY_MEAS_LEFT, 0.0, 150.0, 100.0);
nmt->dmp_frame_quality = display_measurements_add(&nmt->sender, "Frame Quality", "%.1f %% (last)", DISPLAY_MEAS_LAST, DISPLAY_MEAS_LEFT, 0.0, 100.0, 100.0);
@@ -342,7 +342,7 @@ void sender_receive(sender_t *sender, sample_t *samples, int length, double __at
if (nmt->compandor)
expand_audio(&nmt->cstate, samples, count);
if (nmt->dsp_mode == DSP_MODE_DTMF)
dtmf_tone(&nmt->dtmf, samples, count);
dtmf_encode(&nmt->dtmf, samples, count);
spl = nmt->sender.rxbuf;
pos = nmt->sender.rxbuf_pos;
for (i = 0; i < count; i++) {

View File

@@ -1454,7 +1454,7 @@ static void rx_active(nmt_t *nmt, frame_t *frame)
break;
}
digit = nmt_value2digit(frame->digit);
dtmf_set_tone(&nmt->dtmf, digit);
dtmf_encode_set_tone(&nmt->dtmf, digit);
PDEBUG_CHAN(DNMT, DEBUG_INFO, "Received (odd) digit %c.\n", digit);
nmt->mft_num++;
break;
@@ -1477,7 +1477,7 @@ static void rx_active(nmt_t *nmt, frame_t *frame)
break;
}
digit = nmt_value2digit(frame->digit);
dtmf_set_tone(&nmt->dtmf, digit);
dtmf_encode_set_tone(&nmt->dtmf, digit);
PDEBUG_CHAN(DNMT, DEBUG_INFO, "Received (even) digit %c.\n", digit);
nmt->mft_num++;
break;

View File

@@ -1,7 +1,7 @@
#include "../common/sender.h"
#include "../libtimer/timer.h"
#include "../common/compandor.h"
#include "../common/dtmf.h"
#include "../libdtmf/dtmf_encode.h"
#include "../common/call.h"
#include "../common/fsk.h"
#include "../common/goertzel.h"
@@ -77,7 +77,7 @@ typedef struct nmt {
sender_t sender;
nmt_sysinfo_t sysinfo;
compandor_t cstate;
dtmf_t dtmf;
dtmf_enc_t dtmf;
struct transaction *trans; /* pointer to transaction, if bound to channel */
/* sender's states */