diff options
Diffstat (limited to 'src/ss5/dsp.h')
-rw-r--r-- | src/ss5/dsp.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ss5/dsp.h b/src/ss5/dsp.h new file mode 100644 index 0000000..aa58dea --- /dev/null +++ b/src/ss5/dsp.h @@ -0,0 +1,46 @@ + +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, uint16_t __attribute__((unused)) sequence_number, uint32_t __attribute__((unused)) timestamp, 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); + |