osmo-cc-ss5-endpoint/src/ss5/dsp.h

47 lines
2.2 KiB
C

struct ss5_endpoint;
typedef struct dsp {
void *priv;
double samplerate;
/* tone generation */
mf_mod_t *mf_mod; /* MF modulator */
char tone; /* current digit playing or 0 */
uint32_t tone_mask; /* bit-mask of which MF tones to play */
int tone_duration; /* counter of samples for length of tone */
char dial_string[33]; /* stores digits when dialing number sequence */
int dial_length; /* length of dial string, or 0 */
int dial_index; /* current position at dial string */
int digit_pause; /* flag that states if pause is played after digit */
/* tone detection */
mf_demod_t *mf_demod; /* MF demodulator */
double ms_per_sample; /* how many milliseconds between two samples */
double detect_interval; /* counts milliseconds */
int interrupt_duration; /* number of milliseconds until interruption is detected */
int interrupt_count; /* counter for interrupt condition */
int split_duration; /* number of milliseconds until split (mute) condition meats */
int split_count; /* counter for split condition */
int sig_detect_duration_AB; /* signaling tone duration in milliseconds (TONE A/B) */
int sig_detect_duration_C; /* signaling tone duration in milliseconds (TONE C) */
int mf_detect_duration; /* MF tone duration in milliseconds */
int detect_count; /* counter for tone detection */
char detect_tone; /* current tone detected or ' ' for no tone */
} dsp_t;
int dsp_init_inst(dsp_t *dsp, void *priv, double samplerate, double sense_db);
void dsp_cleanup_inst(dsp_t *dsp);
void set_sig_detect_duration(dsp_t *dsp, double duration_AB, double duration_C);
void set_tone(dsp_t *dsp, char tone, double duration);
void set_dial_string(dsp_t *dsp, const char *dial);
void audio_clock(struct ss5_endpoint *ss5_ep_sunset, struct ss5_endpoint *ss5_ep_sunrise, int len);
void down_audio(struct osmo_cc_session_codec *codec, uint8_t marker, uint16_t sequence, uint32_t timestamp, uint32_t ssrc, uint8_t *data, int len);
void encode_l16(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len);
void decode_l16(uint8_t *src_data, int src_len, uint8_t **dst_data, int *dst_len);
void receive_digit(void *priv, char digit, double dbm);
void dialing_complete(void *priv);