Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/dtmf.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/dtmf.h - DTMF tone generation and detection | |
| 5 * | |
| 6 * Written by Steve Underwood <steveu@coppice.org> | |
| 7 * | |
| 8 * Copyright (C) 2001, 2005 Steve Underwood | |
| 9 * | |
| 10 * All rights reserved. | |
| 11 * | |
| 12 * This program is free software; you can redistribute it and/or modify | |
| 13 * it under the terms of the GNU Lesser General Public License version 2.1, | |
| 14 * as published by the Free Software Foundation. | |
| 15 * | |
| 16 * This program is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 * GNU Lesser General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU Lesser General Public | |
| 22 * License along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 24 * | |
| 25 * $Id: dtmf.h,v 1.1 2008/10/13 13:14:01 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 #if !defined(_SPANDSP_PRIVATE_DTMF_H_) | |
| 29 #define _SPANDSP_PRIVATE_DTMF_H_ | |
| 30 | |
| 31 /*! | |
| 32 DTMF generator state descriptor. This defines the state of a single | |
| 33 working instance of a DTMF generator. | |
| 34 */ | |
| 35 struct dtmf_tx_state_s | |
| 36 { | |
| 37 tone_gen_state_t tones; | |
| 38 float low_level; | |
| 39 float high_level; | |
| 40 int on_time; | |
| 41 int off_time; | |
| 42 union | |
| 43 { | |
| 44 queue_state_t queue; | |
| 45 uint8_t buf[QUEUE_STATE_T_SIZE(MAX_DTMF_DIGITS)]; | |
| 46 } queue; | |
| 47 }; | |
| 48 | |
| 49 /*! | |
| 50 DTMF digit detector descriptor. | |
| 51 */ | |
| 52 struct dtmf_rx_state_s | |
| 53 { | |
| 54 /*! Optional callback funcion to deliver received digits. */ | |
| 55 digits_rx_callback_t digits_callback; | |
| 56 /*! An opaque pointer passed to the callback function. */ | |
| 57 void *digits_callback_data; | |
| 58 /*! Optional callback funcion to deliver real time digit state changes. */ | |
| 59 tone_report_func_t realtime_callback; | |
| 60 /*! An opaque pointer passed to the real time callback function. */ | |
| 61 void *realtime_callback_data; | |
| 62 /*! TRUE if dialtone should be filtered before processing */ | |
| 63 int filter_dialtone; | |
| 64 #if defined(SPANDSP_USE_FIXED_POINT) | |
| 65 /*! 350Hz filter state for the optional dialtone filter. */ | |
| 66 float z350[2]; | |
| 67 /*! 440Hz filter state for the optional dialtone filter. */ | |
| 68 float z440[2]; | |
| 69 /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */ | |
| 70 float normal_twist; | |
| 71 /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */ | |
| 72 float reverse_twist; | |
| 73 /*! Minimum acceptable tone level for detection. */ | |
| 74 int32_t threshold; | |
| 75 /*! The accumlating total energy on the same period over which the Goertzels work. */ | |
| 76 int32_t energy; | |
| 77 #else | |
| 78 /*! 350Hz filter state for the optional dialtone filter. */ | |
| 79 float z350[2]; | |
| 80 /*! 440Hz filter state for the optional dialtone filter. */ | |
| 81 float z440[2]; | |
| 82 /*! Maximum acceptable "normal" (lower bigger than higher) twist ratio. */ | |
| 83 float normal_twist; | |
| 84 /*! Maximum acceptable "reverse" (higher bigger than lower) twist ratio. */ | |
| 85 float reverse_twist; | |
| 86 /*! Minimum acceptable tone level for detection. */ | |
| 87 float threshold; | |
| 88 /*! The accumlating total energy on the same period over which the Goertzels work. */ | |
| 89 float energy; | |
| 90 #endif | |
| 91 /*! Tone detector working states for the row tones. */ | |
| 92 goertzel_state_t row_out[4]; | |
| 93 /*! Tone detector working states for the column tones. */ | |
| 94 goertzel_state_t col_out[4]; | |
| 95 /*! The result of the last tone analysis. */ | |
| 96 uint8_t last_hit; | |
| 97 /*! The confirmed digit we are currently receiving */ | |
| 98 uint8_t in_digit; | |
| 99 /*! The current sample number within a processing block. */ | |
| 100 int current_sample; | |
| 101 | |
| 102 /*! The number of digits which have been lost due to buffer overflows. */ | |
| 103 int lost_digits; | |
| 104 /*! The number of digits currently in the digit buffer. */ | |
| 105 int current_digits; | |
| 106 /*! The received digits buffer. This is a NULL terminated string. */ | |
| 107 char digits[MAX_DTMF_DIGITS + 1]; | |
| 108 }; | |
| 109 | |
| 110 #endif | |
| 111 /*- End of file ------------------------------------------------------------*/ |
