libspandsp 0.0.4

sig_tone.h File Reference

Go to the source code of this file.

Classes

struct  sig_tone_descriptor_t
struct  sig_tone_state_t

Defines

#define SIG_TONE_1_PRESENT   0x001
#define SIG_TONE_1_CHANGE   0x002
#define SIG_TONE_2_PRESENT   0x004
#define SIG_TONE_2_CHANGE   0x008
#define SIG_TONE_TX_PASSTHROUGH   0x010
#define SIG_TONE_RX_PASSTHROUGH   0x020
#define SIG_TONE_UPDATE_REQUEST   0x100

Typedefs

typedef int(* sig_tone_func_t )(void *user_data, int what)

Enumerations

enum  { SIG_TONE_2280HZ = 1, SIG_TONE_2600HZ, SIG_TONE_2400HZ_2600HZ }

Functions

sig_tone_state_tsig_tone_init (sig_tone_state_t *s, int tone_type, sig_tone_func_t sig_update, void *user_data)
 Initialise a signaling tone context.
int sig_tone_rx (sig_tone_state_t *s, int16_t amp[], int len)
 Process a block of received audio samples.
int sig_tone_tx (sig_tone_state_t *s, int16_t amp[], int len)
 Generate a block of signaling tone audio samples.

Detailed Description


Function Documentation

sig_tone_state_t* sig_tone_init ( sig_tone_state_t s,
int  tone_type,
sig_tone_func_t  sig_update,
void *  user_data 
)

Initialise a signaling tone context.

Initialise a signaling tone context.

Parameters:
sThe signaling tone context.
tone_typeThe type of signaling tone.
sig_updateCallback function to handle signaling updates.
user_dataAn opaque pointer.
Returns:
A pointer to the signalling tone context, or NULL if there was a problem.

References dds_phase_rate(), dds_scaling_dbm0(), sig_tone_state_t::desc, sig_tone_state_t::sig_update, sig_tone_descriptor_t::tone_amp, sig_tone_descriptor_t::tone_freq, and sig_tone_state_t::user_data.

int sig_tone_tx ( sig_tone_state_t s,
int16_t  amp[],
int  len 
)

Generate a block of signaling tone audio samples.

Generate a block of signaling tone audio samples.

Parameters:
sThe signaling tone context.
ampThe audio sample buffer.
lenThe number of samples to be generated.
Returns:
The number of samples actually generated.

References dds_mod(), sig_tone_state_t::desc, sig_tone_descriptor_t::high_low_timeout, sig_tone_state_t::sig_update, and sig_tone_state_t::user_data.