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