26 #if !defined(_SPANDSP_DTMF_H_)
27 #define _SPANDSP_DTMF_H_
74 #define MAX_DTMF_DIGITS 128
76 typedef void (*digits_rx_callback_t)(
void *user_data,
const char *digits,
int len);
89 #if defined(__cplusplus)
148 tone_report_func_t callback,
211 digits_rx_callback_t callback,
224 #if defined(__cplusplus)
void make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples)
Create a descriptor for use with either a Goertzel transform.
Definition: tone_detect.c:59
float reverse_twist
Definition: private/dtmf.h:83
complexi_t dds_lookup_complexi(uint32_t phase)
Lookup the complex integer value of a specified phase.
Definition: dds_int.c:388
void dds_advance(uint32_t *phase_acc, int32_t phase_rate)
Advance the phase, without returning any new signal sample.
Definition: dds_int.c:362
complexi32_t dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
Generate a complex 32 bit integer tone sample, with modulation.
Definition: dds_int.c:458
dtmf_rx_state_t * dtmf_rx_init(dtmf_rx_state_t *s, digits_rx_callback_t callback, void *user_data)
Initialise a DTMF receiver context.
Definition: dtmf.c:407
int dtmf_rx_fillin(dtmf_rx_state_t *s, int samples)
Fake processing of a missing block of received DTMF audio samples.
Definition: dtmf.c:316
complexi32_t dds_lookup_complexi32(uint32_t phase)
Generate a complex 32 bit integer tone sample.
Definition: dds_int.c:442
#define QUEUE_WRITE_ATOMIC
Definition: queue.h:48
int16_t dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
Generate an integer tone sample, with modulation.
Definition: dds_int.c:378
void dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, tone_report_func_t callback, void *user_data)
Set a realtime callback for a DTMF receiver context.
Definition: dtmf.c:363
int span_log_test(logging_state_t *s, int level)
Test if logging of a specified severity level is enabled.
Definition: logging.c:76
int16_t dds_scaling_dbov(float level)
Find the scaling factor needed to achieve a specified level in dBmov.
Definition: dds_int.c:334
size_t dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max)
Get a string of digits from a DTMF receiver's output buffer.
Definition: dtmf.c:348
complexi_t dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
Generate a complex integer tone sample, with modulation.
Definition: dds_int.c:404
goertzel_state_t * goertzel_init(goertzel_state_t *s, goertzel_descriptor_t *t)
Initialise the state of a Goertzel transform.
Definition: tone_detect.c:70
void dds_advancef(uint32_t *phase_acc, int32_t phase_rate)
Advance the phase, without returning any new signal sample.
Definition: dds_float.c:2133
float power_meter_current_dbm0(power_meter_t *s)
Get the current power meter reading, in dBm0.
Definition: power_meter.c:120
int32_t dds_phase_rate(float frequency)
Find the phase rate value to achieve a particular frequency.
Definition: dds_int.c:316
void * digits_callback_data
Definition: private/dtmf.h:55
void dtmf_rx_parms(dtmf_rx_state_t *s, int filter_dialtone, int twist, int reverse_twist, int threshold)
Adjust a DTMF receiver context.
Definition: dtmf.c:373
float goertzel_result(goertzel_state_t *s)
Evaluate the final result of a Goertzel transform.
Definition: tone_detect.c:156
int dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples)
Generate a buffer of DTMF tones.
Definition: dtmf.c:501
tone_report_func_t realtime_callback
Definition: private/dtmf.h:57
complexi16_t dds_complexi16(uint32_t *phase_acc, int32_t phase_rate)
Generate a complex 16 bit integer tone sample.
Definition: dds_int.c:421
float dds_lookupf(uint32_t phase)
Lookup the floating point value of a specified phase.
Definition: dds_float.c:2149
int32_t dds_phase_ratef(float frequency)
Find the phase rate equivalent to a frequency, in Hz.
Definition: dds_float.c:2109
int16_t dds_scaling_dbm0(float level)
Find the scaling factor needed to achieve a specified level in dBm0.
Definition: dds_int.c:328
complexf_t dds_complexf(uint32_t *phase_acc, int32_t phase_rate)
Generate a complex floating point tone sample.
Definition: dds_float.c:2165
float z350[2]
Definition: private/dtmf.h:77
int dtmf_rx_release(dtmf_rx_state_t *s)
Release a DTMF receiver context.
Definition: dtmf.c:461
float threshold
Definition: private/dtmf.h:85
int32_t power_meter_update(power_meter_t *s, int16_t amp)
Update a power meter.
Definition: power_meter.c:84
void * realtime_callback_data
Definition: private/dtmf.h:59
int lost_digits
Definition: private/dtmf.h:104
int dtmf_tx_free(dtmf_tx_state_t *s)
Free a DTMF tone generator context.
Definition: dtmf.c:590
int16_t dds_offset(uint32_t phase_acc, int32_t phase_offset)
Find the amplitude for a particular phase offset from an accumulated phase.
Definition: dds_int.c:356
complexi32_t dds_complexi32(uint32_t *phase_acc, int32_t phase_rate)
Generate a complex 32 bit integer tone sample.
Definition: dds_int.c:448
int dtmf_rx_status(dtmf_rx_state_t *s)
Get the status of DTMF detection during processing of the last audio chunk.
Definition: dtmf.c:338
int queue_read_byte(queue_state_t *s)
Read a byte from a queue.
Definition: queue.c:188
Definition: power_meter.h:48
float im
Imaginary part.
Definition: complex.h:47
float dds_phase_to_radians(uint32_t phase)
Convert a 32 bit phase angle to an angle in radians, between 0 and 2*PI.
Definition: dds_float.c:2103
int dtmf_tx_release(dtmf_tx_state_t *s)
Release a DTMF tone generator context.
Definition: dtmf.c:584
int dtmf_rx_free(dtmf_rx_state_t *s)
Free a DTMF receiver context.
Definition: dtmf.c:467
float dds_frequency(int32_t phase_rate)
Find the frequency, in Hz, equivalent to a phase rate.
Definition: dds_int.c:322
digits_rx_callback_t digits_callback
Definition: private/dtmf.h:53
complexi16_t dds_lookup_complexi16(uint32_t phase)
Generate a complex 16 bit integer tone sample.
Definition: dds_int.c:415
void dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist)
Change the transmit level for a DTMF tone generator context.
Definition: dtmf.c:551
queue_state_t * queue_init(queue_state_t *s, int len, int flags)
Initialise a queue.
Definition: queue.c:394
complexf_t dds_lookup_complexf(uint32_t phase)
Lookup the complex value of a specified phase.
Definition: dds_float.c:2176
float z440[2]
Definition: private/dtmf.h:79
goertzel_state_t row_out[4]
Definition: private/dtmf.h:90
char digits[MAX_DTMF_DIGITS+1]
Definition: private/dtmf.h:108
int16_t dds(uint32_t *phase_acc, int32_t phase_rate)
Generate an integer tone sample.
Definition: dds_int.c:368
uint8_t last_hit
Definition: private/dtmf.h:94
int queue_free_space(queue_state_t *s)
Check available free space.
Definition: queue.c:52
float normal_twist
Definition: private/dtmf.h:81
Definition: private/tone_generate.h:42
float energy
Definition: private/dtmf.h:87
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
float dds_scaling_dbovf(float level)
Find the scaling factor equivalent to a dBmov value.
Definition: dds_float.c:2127
int filter_dialtone
Definition: private/dtmf.h:61
float dds_frequencyf(int32_t phase_rate)
Find the frequency, in Hz, equivalent to a phase rate.
Definition: dds_float.c:2115
dtmf_tx_state_t * dtmf_tx_init(dtmf_tx_state_t *s)
Initialise a DTMF tone generator context.
Definition: dtmf.c:565
float power_meter_current_dbov(power_meter_t *s)
Get the current power meter reading, in dBOv.
Definition: power_meter.c:129
int duration
Definition: private/dtmf.h:101
float dds_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
Generate a floating point tone sample, with modulation.
Definition: dds_float.c:2155
tone_gen_descriptor_t * tone_gen_descriptor_init(tone_gen_descriptor_t *s, int f1, int l1, int f2, int l2, int d1, int d2, int d3, int d4, int repeat)
Create a tone generator descriptor.
Definition: tone_generate.c:60
int current_sample
Definition: private/dtmf.h:98
int dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len)
Put a string of digits in a DTMF generator's input buffer.
Definition: dtmf.c:531
int queue_write(queue_state_t *s, const uint8_t *buf, int len)
Write bytes to a queue.
Definition: queue.c:214
float ddsf(uint32_t *phase_acc, int32_t phase_rate)
Generate a floating point tone sample.
Definition: dds_float.c:2139
Definition: tone_detect.h:32
#define QUEUE_READ_ATOMIC
Definition: queue.h:45
uint8_t in_digit
Definition: private/dtmf.h:96
int16_t dds_lookup(uint32_t phase)
Lookup the integer value of a specified phase.
Definition: dds_int.c:340
float re
Real part.
Definition: complex.h:45
logging_state_t logging
Error and flow logging control.
Definition: private/dtmf.h:111
Definition: private/dtmf.h:50
complexi16_t dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
Generate a complex 16bit integer tone sample, with modulation.
Definition: dds_int.c:431
void dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time)
Change the transmit on and off time for a DTMF tone generator context.
Definition: dtmf.c:558
void goertzel_reset(goertzel_state_t *s)
Reset the state of a Goertzel transform.
Definition: tone_detect.c:106
int current_digits
Definition: private/dtmf.h:106
power_meter_t * power_meter_init(power_meter_t *s, int shift)
Initialise a power meter context.
Definition: power_meter.c:50
complexf_t dds_complex_modf(uint32_t *phase_acc, int32_t phase_rate, float scale, int32_t phase)
Generate a complex floating point tone sample, with modulation.
Definition: dds_float.c:2183
Definition: private/dtmf.h:33
int dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
Process a block of received DTMF audio samples.
Definition: dtmf.c:102
logging_state_t * dtmf_rx_get_logging_state(dtmf_rx_state_t *s)
Get the logging context associated with a DTMF receiver context.
Definition: dtmf.c:401
Definition: private/logging.h:33
float dds_scaling_dbm0f(float level)
Find the scaling factor equivalent to a dBm0 value.
Definition: dds_float.c:2121
goertzel_state_t col_out[4]
Definition: private/dtmf.h:92
complexi_t dds_complexi(uint32_t *phase_acc, int32_t phase_rate)
Generate a complex integer tone sample.
Definition: dds_int.c:394