#include <math.h>#include <inttypes.h>#include <string.h>#include <stdio.h>#include <time.h>#include <fcntl.h>#include "spandsp/telephony.h"#include "spandsp/dc_restore.h"#include "spandsp/dds.h"#include "spandsp/tone_generate.h"Classes | |
| struct | mf_digit_tones_t |
Defines | |
| #define | M_PI 3.14159265358979323846264338327 |
| #define | ms_to_samples(t) (((t)*SAMPLE_RATE)/1000) |
| #define | DTMF_DURATION ms_to_samples(70) |
| #define | DTMF_PAUSE ms_to_samples(80) |
| #define | DTMF_CYCLE (DTMF_DURATION + DTMF_PAUSE) |
Functions | |
| void | make_tone_gen_descriptor (tone_gen_descriptor_t *s, int f1, int l1, int f2, int l2, int d1, int d2, int d3, int d4, int repeat) |
| void | make_tone_descriptor (tone_gen_descriptor_t *desc, cadenced_tone_t *tone) |
| void | tone_gen_init (tone_gen_state_t *s, tone_gen_descriptor_t *t) |
| int | tone_gen (tone_gen_state_t *s, int16_t amp[], int max_samples) |
| void | dtmf_gen_init (void) |
| Initialise DTMF tone generation. This should be called before any other use of the DTMF tone features. | |
| dtmf_tx_state_t * | dtmf_tx_init (dtmf_tx_state_t *s) |
| Initialise a DTMF tone generator context. | |
| void | bell_mf_gen_init (void) |
| Initialise Bell MF tone generation. This should be called before any other use of the Bell MF tone features. | |
| dtmf_tx_state_t * | bell_mf_tx_init (dtmf_tx_state_t *s) |
| Initialise a Bell MF generator context. | |
| int | dtmf_tx (dtmf_tx_state_t *s, int16_t amp[], int max_samples) |
| Generate a buffer of DTMF tones. | |
| int | dtmf_put (dtmf_tx_state_t *s, const char *digits) |
| Put a string of digits in a DTMF generator's input buffer. | |
| void | r2_mf_tx_init (void) |
| Initialise MFC/R2 tone generation. This should be called before any other use of the MFC/R2 tone features. | |
| int | r2_mf_tx (tone_gen_state_t *s, int16_t amp[], int samples, int fwd, char digit) |
| Generate a block of R2 MF tones. | |
Variables | |
| int | dtmf_gen_inited = FALSE |
| tone_gen_descriptor_t | dtmf_digit_tones [16] |
| int | bell_mf_gen_inited = FALSE |
| tone_gen_descriptor_t | bell_mf_digit_tones [15] |
| int | r2_mf_gen_inited = FALSE |
| tone_gen_descriptor_t | r2_mf_fwd_digit_tones [15] |
| tone_gen_descriptor_t | r2_mf_back_digit_tones [15] |
| dtmf_tx_state_t* bell_mf_tx_init | ( | dtmf_tx_state_t * | s | ) |
Initialise a Bell MF generator context.
| s | The Bell MF generator context (same type as a DTMF context). |
| int dtmf_put | ( | dtmf_tx_state_t * | s, | |
| const char * | digits | |||
| ) |
Put a string of digits in a DTMF generator's input buffer.
| s | The DTMF generator context. | |
| digits | The string of digits to be added. |
| int dtmf_tx | ( | dtmf_tx_state_t * | s, | |
| int16_t | amp[], | |||
| int | max_samples | |||
| ) |
Generate a buffer of DTMF tones.
| s | The DTMF generator context. | |
| amp | The buffer for the generated signal. | |
| max_samples | The required number of generated samples. |
| dtmf_tx_state_t* dtmf_tx_init | ( | dtmf_tx_state_t * | s | ) |
Initialise a DTMF tone generator context.
| s | The DTMF generator context. |
| int r2_mf_tx | ( | tone_gen_state_t * | s, | |
| int16_t | amp[], | |||
| int | samples, | |||
| int | fwd, | |||
| char | digit | |||
| ) |
Generate a block of R2 MF tones.
| s | The R2 MF generate context. | |
| amp | The buffer for the generated signal. | |
| samples | The required number of generated samples. | |
| fwd | TRUE to use the forward tone set. FALSE to use the reverse tone set. | |
| digit | The digit to be generated. When continuing to generate the same digit as during the last call to this function, digit should be set to 0x7F. |
1.4.7