22
22
* along with this program; if not, write to the Free Software
23
23
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25
* $Id: dtmf.h,v 1.13 2007/06/26 15:54:12 steveu Exp $
25
* $Id: dtmf.h,v 1.18 2007/12/20 11:11:16 steveu Exp $
28
28
#if !defined(_SPANDSP_DTMF_H_)
110
109
float reverse_twist;
112
111
/*! 350Hz filter state for the optional dialtone filter */
115
113
/*! 440Hz filter state for the optional dialtone filter */
119
/*! Tone detector working states */
116
/*! Tone detector working states for the row tones. */
120
117
goertzel_state_t row_out[4];
118
/*! Tone detector working states for the column tones. */
121
119
goertzel_state_t col_out[4];
122
120
/*! The accumlating total energy on the same period over which the Goertzels work. */
152
150
/*! \brief Put a string of digits in a DTMF generator's input buffer.
153
151
\param s The DTMF generator context.
154
152
\param digits The string of digits to be added.
153
\param len The length of the string of digits. If negative, the string is
154
assumed to be a NULL terminated string.
155
155
\return The number of digits actually added. This may be less than the
156
156
length of the digit string, if the buffer fills up. */
157
size_t dtmf_tx_put(dtmf_tx_state_t *s, const char *digits);
157
size_t dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, ssize_t len);
159
/*! \brief Change the transmit level for a DTMF tone generator context.
160
\param s The DTMF generator context.
161
\param level The level of the low tone, in dBm0.
162
\param twist The twist, in dB. */
163
void dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist);
159
165
/*! \brief Initialise a DTMF tone generator context.
160
166
\param s The DTMF generator context.
161
167
\return A pointer to the DTMF generator context. */
162
168
dtmf_tx_state_t *dtmf_tx_init(dtmf_tx_state_t *s);
170
/*! \brief Free a DTMF tone generator context.
171
\param s The DTMF tone generator context.
172
\return 0 for OK, else -1. */
173
int dtmf_tx_free(dtmf_tx_state_t *s);
164
175
/*! Set a optional realtime callback for a DTMF receiver context. This function
165
176
is called immediately a confirmed state change occurs in the received DTMF. It
166
177
is called with the ASCII value for a DTMF tone pair, or zero to indicate no tone
218
229
dtmf_rx_callback_t callback,
219
230
void *user_data);
232
/*! \brief Free a DTMF receiver context.
233
\param s The DTMF receiver context.
234
\return 0 for OK, else -1. */
235
int dtmf_rx_free(dtmf_rx_state_t *s);
221
237
#if defined(__cplusplus)