Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/bell_r2_mf.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 * bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection. | |
5 * | |
6 * Written by Steve Underwood <steveu@coppice.org> | |
7 * | |
8 * Copyright (C) 2001 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: bell_r2_mf.h,v 1.2 2008/10/13 14:19:18 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_SPANDSP_PRIVATE_BELL_R2_MF_H_) | |
29 #define _SPANDSP_PRIVATE_BELL_R2_MF_H_ | |
30 | |
31 /*! | |
32 Bell MF generator state descriptor. This defines the state of a single | |
33 working instance of a Bell MF generator. | |
34 */ | |
35 struct bell_mf_tx_state_s | |
36 { | |
37 /*! The tone generator. */ | |
38 tone_gen_state_t tones; | |
39 int current_sample; | |
40 union | |
41 { | |
42 queue_state_t queue; | |
43 uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)]; | |
44 } queue; | |
45 }; | |
46 | |
47 /*! | |
48 Bell MF digit detector descriptor. | |
49 */ | |
50 struct bell_mf_rx_state_s | |
51 { | |
52 /*! Optional callback funcion to deliver received digits. */ | |
53 digits_rx_callback_t digits_callback; | |
54 /*! An opaque pointer passed to the callback function. */ | |
55 void *digits_callback_data; | |
56 /*! Tone detector working states */ | |
57 goertzel_state_t out[6]; | |
58 /*! Short term history of results from the tone detection, using in persistence checking */ | |
59 uint8_t hits[5]; | |
60 /*! The current sample number within a processing block. */ | |
61 int current_sample; | |
62 | |
63 /*! The number of digits which have been lost due to buffer overflows. */ | |
64 int lost_digits; | |
65 /*! The number of digits currently in the digit buffer. */ | |
66 int current_digits; | |
67 /*! The received digits buffer. This is a NULL terminated string. */ | |
68 char digits[MAX_BELL_MF_DIGITS + 1]; | |
69 }; | |
70 | |
71 /*! | |
72 MFC/R2 tone detector descriptor. | |
73 */ | |
74 struct r2_mf_tx_state_s | |
75 { | |
76 /*! The tone generator. */ | |
77 tone_gen_state_t tone; | |
78 /*! TRUE if generating forward tones, otherwise generating reverse tones. */ | |
79 int fwd; | |
80 /*! The current digit being generated. */ | |
81 int digit; | |
82 }; | |
83 | |
84 /*! | |
85 MFC/R2 tone detector descriptor. | |
86 */ | |
87 struct r2_mf_rx_state_s | |
88 { | |
89 /*! Optional callback funcion to deliver received digits. */ | |
90 tone_report_func_t callback; | |
91 /*! An opaque pointer passed to the callback function. */ | |
92 void *callback_data; | |
93 /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */ | |
94 int fwd; | |
95 /*! Tone detector working states */ | |
96 goertzel_state_t out[6]; | |
97 /*! The current sample number within a processing block. */ | |
98 int current_sample; | |
99 /*! The currently detected digit. */ | |
100 int current_digit; | |
101 }; | |
102 | |
103 #endif | |
104 /*- End of file ------------------------------------------------------------*/ |