super_tone_rx.c File Reference

#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <time.h>
#include <inttypes.h>
#include <tgmath.h>
#include "spandsp/telephony.h"
#include "spandsp/tone_detect.h"
#include "spandsp/tone_generate.h"
#include "spandsp/super_tone_rx.h"

Defines

#define THRESHOLD   8.0e7

Functions

int super_tone_rx_add_tone (super_tone_rx_descriptor_t *desc)
int super_tone_rx_add_element (super_tone_rx_descriptor_t *desc, int tone, int f1, int f2, int min, int max)
super_tone_rx_descriptor_t * super_tone_rx_make_descriptor (super_tone_rx_descriptor_t *desc)
void super_tone_rx_segment_callback (super_tone_rx_state_t *s, void(*callback)(void *data, int f1, int f2, int duration))
super_tone_rx_state_t * super_tone_rx_init (super_tone_rx_state_t *s, super_tone_rx_descriptor_t *desc, void(*callback)(void *data, int code), void *data)
int super_tone_rx_free (super_tone_rx_state_t *s)
int super_tone_rx (super_tone_rx_state_t *s, const int16_t *amp, int samples)
 Apply supervisory tone detection processing to a block of audio samples.

Detailed Description


Function Documentation

int super_tone_rx ( super_tone_rx_state_t *  super,
const int16_t *  amp,
int  samples 
)

Apply supervisory tone detection processing to a block of audio samples.

Apply supervisory tone detection processing to a block of audio samples.

Parameters:
super The supervisory tone context.
amp The audio sample buffer.
samples The number of samples in the buffer.
Returns:
The number of samples processed.

int super_tone_rx_add_element ( super_tone_rx_descriptor_t *  desc,
int  tone,
int  f1,
int  f2,
int  min,
int  max 
)

Add a new tone pattern element to a tone pattern in a supervisory tone detector.

Parameters:
desc The supervisory tone set desciptor.
tone The tone ID within the descriptor.
f1 Frequency 1 (-1 for a silent period).
f2 Frequency 2 (-1 for a silent period, or only one frequency).
min The minimum duration, in ms.
max The maximum duration, in ms.
Returns:
The new number of elements in the tone description.

int super_tone_rx_add_tone ( super_tone_rx_descriptor_t *  desc  ) 

Add a new tone pattern to a supervisory tone detector set.

Parameters:
desc The supervisory tone set descriptor.
Returns:
The new tone ID.

int super_tone_rx_free ( super_tone_rx_state_t *  s  ) 

Release a supervisory tone detector.

Parameters:
s The supervisory tone context.
Returns:
0 for OK, -1 for fail.

super_tone_rx_state_t* super_tone_rx_init ( super_tone_rx_state_t *  s,
super_tone_rx_descriptor_t *  desc,
void(*)(void *data, int code)  callback,
void *  data 
)

Initialise a supervisory tone detector.

Parameters:
s The supervisory tone detector context.
desc The tone descriptor.
callback The callback routine called to report the valid detection or termination of one of the monitored tones.
data An opaque pointer passed when calling the callback routine.
Returns:
The supervisory tone detector context.

super_tone_rx_descriptor_t* super_tone_rx_make_descriptor ( super_tone_rx_descriptor_t *  desc  ) 

Create Add a new tone pattern to a supervisory tone detector.

Parameters:
desc The supervisory tone set desciptor. If NULL, the routine will allocate space for a descriptor.
Returns:
The supervisory tone set descriptor.

void super_tone_rx_segment_callback ( super_tone_rx_state_t *  s,
void(*)(void *data, int f1, int f2, int duration)  callback 
)

Define a callback routine to be called each time a tone pattern element is complete. This is mostly used when analysing a tone.

Parameters:
s The supervisory tone context.
callback The callback routine.


Generated on Fri Nov 10 09:40:24 2006 for libspandsp by  doxygen 1.5.1