RTS API Documentation
1.10.11
|
#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 302 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.
References teletone_generation_session::buffer, and teletone_generation_session::samples.
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 teletone_generation_session::buffer, buflen, teletone_generation_session::channels, teletone_generation_session::datalen, teletone_generation_session::decay_factor, teletone_generation_session::decay_step, teletone_generation_session::duration, teletone_generation_session::dynamic, teletone_generation_session::handler, memset(), teletone_generation_session::rate, teletone_set_tone(), teletone_generation_session::tmp_duration, teletone_generation_session::tmp_wait, teletone_generation_session::user_data, teletone_generation_session::volume, and teletone_generation_session::wait.
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 teletone_generation_session::buffer, teletone_generation_session::channels, teletone_generation_session::datalen, teletone_generation_session::debug, teletone_generation_session::debug_stream, teletone_generation_session::decay_direction, teletone_generation_session::decay_factor, teletone_generation_session::decay_step, teletone_generation_session::duration, teletone_generation_session::dynamic, ensure_buffer(), teletone_tone_map_t::freqs, memset(), teletone_generation_session::rate, teletone_generation_session::samples, teletone_dds_state_modulate_sample(), teletone_dds_state_set_tone(), teletone_dds_state_set_tx_level(), TELETONE_MAX_TONES, TELETONE_VOL_DB_MIN, teletone_generation_session::tmp_duration, teletone_generation_session::tmp_wait, teletone_generation_session::volume, and teletone_generation_session::wait.
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 314 of file libteletone_generate.c.
References teletone_generation_session::channels, cur, teletone_generation_session::debug, teletone_generation_session::debug_stream, teletone_generation_session::decay_direction, teletone_generation_session::decay_factor, teletone_generation_session::decay_step, teletone_generation_session::duration, teletone_tone_map_t::freqs, teletone_generation_session::handler, teletone_generation_session::loops, teletone_generation_session::LOOPS, memset(), my_strdup(), teletone_generation_session::rate, TELETONE_MAX_TONES, TELETONE_TONE_RANGE, TELETONE_VOL_DB_MIN, teletone_generation_session::tmp_duration, teletone_generation_session::tmp_wait, teletone_generation_session::TONES, teletone_generation_session::volume, and teletone_generation_session::wait.
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_tone_map_t::freqs, and 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_tone_map_t::freqs, index, TELETONE_MAX_TONES, and teletone_generation_session::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().