FreeSWITCH API Documentation
1.7.0
|
#include <libteletone.h>
Go to the source code of this file.
Macros | |
#define | SMAX 32767 |
#define | SMIN -32768 |
#define | normalize_to_16bit(n) if (n > SMAX) n = SMAX; else if (n < SMIN) n = SMIN; |
Functions | |
int | teletone_set_tone (teletone_generation_session_t *ts, int index,...) |
Assign a set of tones to a tone_session indexed by a paticular index/character. More... | |
int | teletone_set_map (teletone_tone_map_t *map,...) |
Assign a set of tones to a single tone map. More... | |
int | teletone_init_session (teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data) |
Initilize a tone generation session. More... | |
int | teletone_destroy_session (teletone_generation_session_t *ts) |
Free the buffer allocated by a tone generation session. More... | |
static int | ensure_buffer (teletone_generation_session_t *ts, int need) |
int | teletone_mux_tones (teletone_generation_session_t *ts, teletone_tone_map_t *map) |
Execute a single tone generation instruction. More... | |
static char * | my_strdup (const char *s) |
int | teletone_run (teletone_generation_session_t *ts, const char *cmd) |
Execute a tone generation script and call callbacks after each instruction. More... | |
Variables | |
int16_t | TELETONE_SINES [SINE_TABLE_MAX] |
Definition at line 76 of file libteletone_generate.c.
#define SMAX 32767 |
Definition at line 74 of file libteletone_generate.c.
#define SMIN -32768 |
Definition at line 75 of file libteletone_generate.c.
|
static |
Definition at line 187 of file libteletone_generate.c.
References teletone_generation_session::buffer, teletone_generation_session::channels, teletone_generation_session::datalen, teletone_generation_session::dynamic, and teletone_generation_session::samples.
Referenced by teletone_mux_tones().
|
static |
Definition at line 309 of file libteletone_generate.c.
Referenced by teletone_run().
int teletone_destroy_session | ( | teletone_generation_session_t * | ts | ) |
Free the buffer allocated by a tone generation session.
ts | the tone generation session to destroy |
Definition at line 177 of file libteletone_generate.c.
Referenced by inband_dtmf_generate_callback(), main(), setup_ringback(), switch_ivr_gentones(), switch_ivr_originate(), and switch_ivr_wait_for_answer().
int teletone_init_session | ( | teletone_generation_session_t * | ts, |
int | buflen, | ||
tone_handler | handler, | ||
void * | user_data | ||
) |
Initilize a tone generation session.
ts | the tone generation session to initilize |
buflen | the size of the buffer(in samples) to dynamically allocate |
handler | a callback function to execute when a tone generation instruction is complete |
user_data | optional user data to send |
Definition at line 134 of file libteletone_generate.c.
References buflen, memset(), and teletone_set_tone().
Referenced by inband_dtmf_generate_callback(), main(), setup_ringback(), switch_ivr_gentones(), and switch_ivr_wait_for_answer().
int teletone_mux_tones | ( | teletone_generation_session_t * | ts, |
teletone_tone_map_t * | map | ||
) |
Execute a single tone generation instruction.
ts | the tone generation session to consult for parameters |
map | the tone mapping to use for the frequencies |
Definition at line 206 of file libteletone_generate.c.
References ensure_buffer(), memset(), teletone_dds_state_modulate_sample(), teletone_dds_state_set_tone(), teletone_dds_state_set_tx_level(), TELETONE_MAX_TONES, and TELETONE_VOL_DB_MIN.
Referenced by teletone_dtmf_generate_handler(), and teletone_handler().
int teletone_run | ( | teletone_generation_session_t * | ts, |
const char * | cmd | ||
) |
Execute a tone generation script and call callbacks after each instruction.
ts | the tone generation session to execute on |
cmd | the script to execute |
Definition at line 321 of file libteletone_generate.c.
References cur, teletone_tone_map_t::freqs, memset(), my_strdup(), TELETONE_MAX_TONES, TELETONE_TONE_RANGE, and TELETONE_VOL_DB_MIN.
Referenced by inband_dtmf_generate_callback(), main(), setup_ringback(), switch_ivr_gentones(), and switch_ivr_wait_for_answer().
int teletone_set_map | ( | teletone_tone_map_t * | map, |
... | |||
) |
Assign a set of tones to a single tone map.
map | the map to assign the tones to |
... | up to TELETONE_MAX_TONES frequencies terminated by 0.0 |
Definition at line 118 of file libteletone_generate.c.
References TELETONE_MAX_TONES.
int teletone_set_tone | ( | teletone_generation_session_t * | ts, |
int | index, | ||
... | |||
) |
Assign a set of tones to a tone_session indexed by a paticular index/character.
ts | the tone generation session |
index | the index to map the tone to |
... | up to TELETONE_MAX_TONES frequencies terminated by 0.0 |
Definition at line 102 of file libteletone_generate.c.
References TELETONE_MAX_TONES.
Referenced by teletone_init_session().
int16_t TELETONE_SINES[SINE_TABLE_MAX] |
Definition at line 82 of file libteletone_generate.c.
Referenced by teletone_dds_state_modulate_sample().