Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/sig_tone.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 15:50:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
---|---|
1 /* | |
2 * SpanDSP - a series of DSP components for telephony | |
3 * | |
4 * private/sig_tone.h - Signalling tone processing for the 2280Hz, 2400Hz, 2600Hz | |
5 * and similar signalling tone used in older protocols. | |
6 * | |
7 * Written by Steve Underwood <steveu@coppice.org> | |
8 * | |
9 * Copyright (C) 2004 Steve Underwood | |
10 * | |
11 * All rights reserved. | |
12 * | |
13 * This program is free software; you can redistribute it and/or modify | |
14 * it under the terms of the GNU Lesser General Public License version 2.1, | |
15 * as published by the Free Software Foundation. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU Lesser General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU Lesser General Public | |
23 * License along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 * | |
26 * $Id: sig_tone.h,v 1.4 2009/09/04 14:38:47 steveu Exp $ | |
27 */ | |
28 | |
29 #if !defined(_SPANDSP_PRIVATE_SIG_TONE_H_) | |
30 #define _SPANDSP_PRIVATE_SIG_TONE_H_ | |
31 | |
32 /*! | |
33 Signaling tone descriptor. This defines the working state for a | |
34 single instance of the transmit and receive sides of a signaling | |
35 tone processor. | |
36 */ | |
37 struct sig_tone_descriptor_s | |
38 { | |
39 /*! \brief The tones used. */ | |
40 int tone_freq[2]; | |
41 /*! \brief The high and low tone amplitudes for each of the tones. */ | |
42 int tone_amp[2][2]; | |
43 | |
44 /*! \brief The delay, in audio samples, before the high level tone drops | |
45 to a low level tone. */ | |
46 int high_low_timeout; | |
47 | |
48 /*! \brief Some signaling tone detectors use a sharp initial filter, | |
49 changing to a broader band filter after some delay. This | |
50 parameter defines the delay. 0 means it never changes. */ | |
51 int sharp_flat_timeout; | |
52 | |
53 /*! \brief Parameters to control the behaviour of the notch filter, used | |
54 to remove the tone from the voice path in some protocols. */ | |
55 int notch_lag_time; | |
56 /*! \brief TRUE if the notch may be used in the media flow. */ | |
57 int notch_allowed; | |
58 | |
59 /*! \brief The tone on persistence check, in audio samples. */ | |
60 int tone_on_check_time; | |
61 /*! \brief The tone off persistence check, in audio samples. */ | |
62 int tone_off_check_time; | |
63 | |
64 /*! \brief ??? */ | |
65 int tones; | |
66 /*! \brief The coefficients for the cascaded bi-quads notch filter. */ | |
67 struct | |
68 { | |
69 #if defined(SPANDSP_USE_FIXED_POINT) | |
70 int32_t notch_a1[3]; | |
71 int32_t notch_b1[3]; | |
72 int32_t notch_a2[3]; | |
73 int32_t notch_b2[3]; | |
74 int notch_postscale; | |
75 #else | |
76 float notch_a1[3]; | |
77 float notch_b1[3]; | |
78 float notch_a2[3]; | |
79 float notch_b2[3]; | |
80 #endif | |
81 } tone[2]; | |
82 | |
83 #if defined(SPANDSP_USE_FIXED_POINT) | |
84 /*! \brief Flat mode bandpass bi-quad parameters */ | |
85 int32_t broad_a[3]; | |
86 /*! \brief Flat mode bandpass bi-quad parameters */ | |
87 int32_t broad_b[3]; | |
88 /*! \brief Post filter scaling */ | |
89 int broad_postscale; | |
90 #else | |
91 /*! \brief Flat mode bandpass bi-quad parameters */ | |
92 float broad_a[3]; | |
93 /*! \brief Flat mode bandpass bi-quad parameters */ | |
94 float broad_b[3]; | |
95 #endif | |
96 /*! \brief The coefficients for the post notch leaky integrator. */ | |
97 int32_t notch_slugi; | |
98 /*! \brief ??? */ | |
99 int32_t notch_slugp; | |
100 | |
101 /*! \brief The coefficients for the post modulus leaky integrator in the | |
102 unfiltered data path. The prescale value incorporates the | |
103 detection ratio. This is called the guard ratio in some | |
104 protocols. */ | |
105 int32_t unfiltered_slugi; | |
106 /*! \brief ??? */ | |
107 int32_t unfiltered_slugp; | |
108 | |
109 /*! \brief The coefficients for the post modulus leaky integrator in the | |
110 bandpass filter data path. */ | |
111 int32_t broad_slugi; | |
112 /*! \brief ??? */ | |
113 int32_t broad_slugp; | |
114 | |
115 /*! \brief Masks which effectively threshold the notched, weighted and | |
116 bandpassed data. */ | |
117 int32_t notch_threshold; | |
118 /*! \brief ??? */ | |
119 int32_t unfiltered_threshold; | |
120 /*! \brief ??? */ | |
121 int32_t broad_threshold; | |
122 }; | |
123 | |
124 /*! | |
125 Signaling tone transmit state | |
126 */ | |
127 struct sig_tone_tx_state_s | |
128 { | |
129 /*! \brief The callback function used to handle signaling changes. */ | |
130 tone_report_func_t sig_update; | |
131 /*! \brief A user specified opaque pointer passed to the callback function. */ | |
132 void *user_data; | |
133 | |
134 /*! \brief Tone descriptor */ | |
135 sig_tone_descriptor_t *desc; | |
136 | |
137 /*! The phase rates for the one or two tones */ | |
138 int32_t phase_rate[2]; | |
139 /*! The phase accumulators for the one or two tones */ | |
140 uint32_t phase_acc[2]; | |
141 | |
142 /*! The scaling values for the one or two tones, and the high and low level of each tone */ | |
143 int16_t tone_scaling[2][2]; | |
144 /*! The sample timer, used to switch between the high and low level tones. */ | |
145 int high_low_timer; | |
146 | |
147 /*! \brief Current transmit tone */ | |
148 int current_tx_tone; | |
149 /*! \brief Current transmit timeout */ | |
150 int current_tx_timeout; | |
151 /*! \brief Time in current signaling state, in samples. */ | |
152 int signaling_state_duration; | |
153 }; | |
154 | |
155 /*! | |
156 Signaling tone receive state | |
157 */ | |
158 struct sig_tone_rx_state_s | |
159 { | |
160 /*! \brief The callback function used to handle signaling changes. */ | |
161 tone_report_func_t sig_update; | |
162 /*! \brief A user specified opaque pointer passed to the callback function. */ | |
163 void *user_data; | |
164 | |
165 /*! \brief Tone descriptor */ | |
166 sig_tone_descriptor_t *desc; | |
167 | |
168 /*! \brief The current receive tone */ | |
169 int current_rx_tone; | |
170 /*! \brief The timeout for switching from the high level to low level tone detector. */ | |
171 int high_low_timer; | |
172 | |
173 struct | |
174 { | |
175 #if defined(SPANDSP_USE_FIXED_POINT) | |
176 /*! \brief The z's for the notch filter */ | |
177 int32_t notch_z1[3]; | |
178 /*! \brief The z's for the notch filter */ | |
179 int32_t notch_z2[3]; | |
180 #else | |
181 /*! \brief The z's for the notch filter */ | |
182 float notch_z1[3]; | |
183 /*! \brief The z's for the notch filter */ | |
184 float notch_z2[3]; | |
185 #endif | |
186 | |
187 /*! \brief The z's for the notch integrators. */ | |
188 int32_t notch_zl; | |
189 } tone[2]; | |
190 | |
191 #if defined(SPANDSP_USE_FIXED_POINT) | |
192 /*! \brief The z's for the weighting/bandpass filter. */ | |
193 int32_t broad_z[3]; | |
194 #else | |
195 /*! \brief The z's for the weighting/bandpass filter. */ | |
196 float broad_z[3]; | |
197 #endif | |
198 /*! \brief The z for the broadband integrator. */ | |
199 int32_t broad_zl; | |
200 | |
201 /*! \brief ??? */ | |
202 int flat_mode; | |
203 /*! \brief ??? */ | |
204 int tone_present; | |
205 /*! \brief ??? */ | |
206 int notch_enabled; | |
207 /*! \brief ??? */ | |
208 int flat_mode_timeout; | |
209 /*! \brief ??? */ | |
210 int notch_insertion_timeout; | |
211 /*! \brief ??? */ | |
212 int tone_persistence_timeout; | |
213 | |
214 /*! \brief ??? */ | |
215 int signaling_state_duration; | |
216 }; | |
217 | |
218 #endif | |
219 /*- End of file ------------------------------------------------------------*/ |