spandsp  0.0.6
sig_tone.h File Reference

Go to the source code of this file.

Typedefs

typedef struct sig_tone_tx_state_s sig_tone_tx_state_t
 
typedef struct sig_tone_rx_state_s sig_tone_rx_state_t
 

Enumerations

enum  { SIG_TONE_2280HZ = 1, SIG_TONE_2600HZ, SIG_TONE_2400HZ_2600HZ }
 
enum  {
  SIG_TONE_1_PRESENT = 0x001, SIG_TONE_1_CHANGE = 0x002, SIG_TONE_2_PRESENT = 0x004, SIG_TONE_2_CHANGE = 0x008,
  SIG_TONE_TX_PASSTHROUGH = 0x010, SIG_TONE_RX_PASSTHROUGH = 0x040, SIG_TONE_RX_FILTER_TONE = 0x080, SIG_TONE_TX_UPDATE_REQUEST = 0x100,
  SIG_TONE_RX_UPDATE_REQUEST = 0x200
}
 

Functions

int sig_tone_rx (sig_tone_rx_state_t *s, int16_t amp[], int len)
 Process a block of received audio samples. More...
 
void sig_tone_rx_set_mode (sig_tone_rx_state_t *s, int mode, int duration)
 Set the receive mode. More...
 
sig_tone_rx_state_tsig_tone_rx_init (sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data)
 Initialise a signalling tone context. More...
 
int sig_tone_rx_release (sig_tone_rx_state_t *s)
 Release a signalling tone receiver context. More...
 
int sig_tone_rx_free (sig_tone_rx_state_t *s)
 Free a signalling tone receiver context. More...
 
int sig_tone_tx (sig_tone_tx_state_t *s, int16_t amp[], int len)
 Generate a block of signalling tone audio samples. More...
 
void sig_tone_tx_set_mode (sig_tone_tx_state_t *s, int mode, int duration)
 Set the tone mode. More...
 
sig_tone_tx_state_tsig_tone_tx_init (sig_tone_tx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data)
 Initialise a signalling tone context. More...
 
int sig_tone_tx_release (sig_tone_tx_state_t *s)
 Release a signalling tone transmitter context. More...
 
int sig_tone_tx_free (sig_tone_tx_state_t *s)
 Free a signalling tone transmitter context. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SIG_TONE_2280HZ 

European 2280Hz signalling tone. Tone 1 is 2280Hz. Tone 2 is not used.

SIG_TONE_2600HZ 

US 2600Hz signalling tone. Tone 1 is 2600Hz. Tone 2 is not used.

SIG_TONE_2400HZ_2600HZ 

US 2400Hz + 2600Hz signalling tones. Tone 1 is 2600Hz. Tone 2 is 2400Hz.

◆ anonymous enum

anonymous enum
Enumerator
SIG_TONE_1_PRESENT 

Signalling tone 1 is present

SIG_TONE_1_CHANGE 

Signalling tone 1 has changed state (ignored when setting tx mode)

SIG_TONE_2_PRESENT 

Signalling tone 2 is present

SIG_TONE_2_CHANGE 

Signalling tone 2 has changed state (ignored when setting tx mode)

SIG_TONE_TX_PASSTHROUGH 

The media signal is passing through. Tones might be added to it.

SIG_TONE_RX_PASSTHROUGH 

The media signal is passing through. Tones might be extracted from it, if detected.

SIG_TONE_RX_FILTER_TONE 

Force filtering of the signalling tone, whether signalling is being detected or not. This is mostly useful for test purposes.

SIG_TONE_TX_UPDATE_REQUEST 

Request an update of the transmit status, upon timeout of the previous status.

SIG_TONE_RX_UPDATE_REQUEST 

Request an update of the receiver status, upon timeout of the previous status.

Function Documentation

◆ sig_tone_rx()

int sig_tone_rx ( sig_tone_rx_state_t s,
int16_t  amp[],
int  len 
)

Process a block of received audio samples.

Process a block of received audio samples.

Parameters
sThe signalling tone context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.
Returns
The number of samples unprocessed.

◆ sig_tone_rx_free()

int sig_tone_rx_free ( sig_tone_rx_state_t s)

Free a signalling tone receiver context.

Free a signalling tone receiver context.

Parameters
sThe signalling tone context.
Returns
0 for OK

◆ sig_tone_rx_init()

sig_tone_rx_state_t* sig_tone_rx_init ( sig_tone_rx_state_t s,
int  tone_type,
tone_report_func_t  sig_update,
void *  user_data 
)

Initialise a signalling tone context.

Initialise a signalling tone receiver context.

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

◆ sig_tone_rx_release()

int sig_tone_rx_release ( sig_tone_rx_state_t s)

Release a signalling tone receiver context.

Release a signalling tone receiver context.

Parameters
sThe signalling tone context.
Returns
0 for OK

◆ sig_tone_rx_set_mode()

void sig_tone_rx_set_mode ( sig_tone_rx_state_t s,
int  mode,
int  duration 
)

Set the receive mode.

Set the receive mode.

Parameters
sThe signalling tone context.
modeThe new mode for the receiver.
durationThe duration for this mode, before an update is requested. A duration of zero means forever.

References sig_tone_rx_state_s::current_rx_tone.

◆ sig_tone_tx()

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

Generate a block of signalling tone audio samples.

Generate a block of signalling tone audio samples.

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

◆ sig_tone_tx_free()

int sig_tone_tx_free ( sig_tone_tx_state_t s)

Free a signalling tone transmitter context.

Free a signalling tone transmitter context.

Parameters
sThe signalling tone context.
Returns
0 for OK

◆ sig_tone_tx_init()

sig_tone_tx_state_t* sig_tone_tx_init ( sig_tone_tx_state_t s,
int  tone_type,
tone_report_func_t  sig_update,
void *  user_data 
)

Initialise a signalling tone context.

Initialise a signalling tone transmitter context.

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

◆ sig_tone_tx_release()

int sig_tone_tx_release ( sig_tone_tx_state_t s)

Release a signalling tone transmitter context.

Release a signalling tone transmitter context.

Parameters
sThe signalling tone context.
Returns
0 for OK

◆ sig_tone_tx_set_mode()

void sig_tone_tx_set_mode ( sig_tone_tx_state_t s,
int  mode,
int  duration 
)

Set the tone mode.

Set the tone mode.

Parameters
sThe signalling tone context.
modeThe new mode for the transmitted tones.
durationThe duration for this mode, before an update is requested. A duration of zero means forever.

References sig_tone_tx_state_s::current_tx_timeout, sig_tone_tx_state_s::current_tx_tone, sig_tone_tx_state_s::desc, sig_tone_descriptor_t::high_low_timeout, sig_tone_tx_state_s::high_low_timer, sig_tone_tx_state_s::phase_acc, SIG_TONE_1_PRESENT, and SIG_TONE_2_PRESENT.