spandsp  3.0.0
private/modem_connect_tones.h
Go to the documentation of this file.
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/modem_connect_tones.c - Generation and detection of tones
5  * associated with modems calling and
6  * answering calls.
7  *
8  * Written by Steve Underwood <steveu@coppice.org>
9  *
10  * Copyright (C) 2006 Steve Underwood
11  *
12  * All rights reserved.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 2.1,
16  * as published by the Free Software Foundation.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public
24  * License along with this program; if not, write to the Free Software
25  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27 
28 /*! \file */
29 
30 #if !defined(_SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_)
31 #define _SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_
32 
33 /*!
34  Modem connect tones generator descriptor. This defines the state
35  of a single working instance of the tone generator.
36 */
38 {
39  int tone_type;
40 
41  int32_t tone_phase_rate;
42  uint32_t tone_phase;
43  int16_t level;
44  /*! \brief Countdown to the next phase hop */
45  span_sample_timer_t hop_timer;
46  /*! \brief Maximum duration timer */
47  span_sample_timer_t duration_timer;
48  uint32_t mod_phase;
49  int32_t mod_phase_rate;
50  int16_t mod_level;
51 };
52 
53 /*!
54  Modem connect tones receiver descriptor. This defines the state
55  of a single working instance of the tone detector.
56 */
58 {
59  /*! \brief The tone type being detected. */
60  int tone_type;
61  bool real_time_reports;
62  /*! \brief Callback routine, using to report detection of the tone. */
63  span_tone_report_func_t tone_callback;
64  /*! \brief An opaque pointer passed to tone_callback. */
66 
67  /*! \brief The notch filter state. */
68  float znotch_1;
69  float znotch_2;
70  /*! \brief The 15Hz AM filter state. */
71  float z15hz_1;
72  float z15hz_2;
73  /*! \brief The in notch power estimate */
74  int32_t notch_level;
75  /*! \brief The total channel power estimate */
76  int32_t channel_level;
77  /*! \brief The 15Hz AM power estimate */
78  int32_t am_level;
79  /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
81  /*! \brief The code for the tone currently confirmed present in the audio. */
83  /*! \brief */
84  int tone_on;
85  /*! \brief A millisecond counter, to time the duration of tone sections. */
87  /*! \brief A count of the number of good cycles of tone reversal seen. */
89  /*! \brief The confirmed tone code. */
90  int hit;
91  /*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
93  /*! \brief The raw (stuffed) bit stream buffer. */
94  unsigned int raw_bit_stream;
95  /*! \brief The current number of bits in the octet in progress. */
96  int num_bits;
97  /*! \brief Number of consecutive flags seen so far. */
99  /*! \brief True if framing OK has been announced. */
101 };
102 
103 #endif
104 /*- End of file ------------------------------------------------------------*/
bool framing_ok_announced
True if framing OK has been announced.
Definition: private/modem_connect_tones.h:100
int32_t notch_level
The in notch power estimate.
Definition: private/modem_connect_tones.h:74
span_tone_report_func_t tone_callback
Callback routine, using to report detection of the tone.
Definition: private/modem_connect_tones.h:63
span_sample_timer_t duration_timer
Maximum duration timer.
Definition: private/modem_connect_tones.h:47
Definition: private/fsk.h:58
span_sample_timer_t hop_timer
Countdown to the next phase hop.
Definition: private/modem_connect_tones.h:45
int good_cycles
A count of the number of good cycles of tone reversal seen.
Definition: private/modem_connect_tones.h:88
int32_t channel_level
The total channel power estimate.
Definition: private/modem_connect_tones.h:76
int flags_seen
Number of consecutive flags seen so far.
Definition: private/modem_connect_tones.h:98
int num_bits
The current number of bits in the octet in progress.
Definition: private/modem_connect_tones.h:96
fsk_rx_state_t v21rx
A V.21 FSK modem context used when searching for FAX preamble.
Definition: private/modem_connect_tones.h:92
Definition: private/modem_connect_tones.h:37
int tone_cycle_duration
A millisecond counter, to time the duration of tone sections.
Definition: private/modem_connect_tones.h:86
int chunk_remainder
Sample counter for the small chunks of samples, after which a test is conducted.
Definition: private/modem_connect_tones.h:80
int32_t am_level
The 15Hz AM power estimate.
Definition: private/modem_connect_tones.h:78
Definition: private/modem_connect_tones.h:57
float z15hz_1
The 15Hz AM filter state.
Definition: private/modem_connect_tones.h:71
unsigned int raw_bit_stream
The raw (stuffed) bit stream buffer.
Definition: private/modem_connect_tones.h:94
void * callback_data
An opaque pointer passed to tone_callback.
Definition: private/modem_connect_tones.h:65
int tone_present
The code for the tone currently confirmed present in the audio.
Definition: private/modem_connect_tones.h:82
float znotch_1
The notch filter state.
Definition: private/modem_connect_tones.h:68
int hit
The confirmed tone code.
Definition: private/modem_connect_tones.h:90
int tone_type
The tone type being detected.
Definition: private/modem_connect_tones.h:60