private/bell_r2_mf.h
/*
* SpanDSP - a series of DSP components for telephony
*
* bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(_SPANDSP_PRIVATE_BELL_R2_MF_H_)
#define _SPANDSP_PRIVATE_BELL_R2_MF_H_
/*!
Bell MF generator state descriptor. This defines the state of a single
working instance of a Bell MF generator.
*/
struct bell_mf_tx_state_s
{
/*! The tone generator. */
tone_gen_state_t tones;
int current_sample;
union
{
queue_state_t queue;
uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)];
} queue;
};
/*!
Bell MF digit detector descriptor.
*/
struct bell_mf_rx_state_s
{
/*! Optional callback funcion to deliver received digits. */
digits_rx_callback_t digits_callback;
/*! An opaque pointer passed to the callback function. */
void *digits_callback_data;
/*! Tone detector working states */
goertzel_state_t out[6];
/*! Short term history of results from the tone detection, using in persistence checking */
uint8_t hits[5];
/*! The current sample number within a processing block. */
int current_sample;
/*! The number of digits which have been lost due to buffer overflows. */
int lost_digits;
/*! The number of digits currently in the digit buffer. */
int current_digits;
/*! The received digits buffer. This is a NULL terminated string. */
char digits[MAX_BELL_MF_DIGITS + 1];
};
/*!
MFC/R2 tone detector descriptor.
*/
struct r2_mf_tx_state_s
{
/*! The tone generator. */
tone_gen_state_t tone;
/*! TRUE if generating forward tones, otherwise generating reverse tones. */
int fwd;
/*! The current digit being generated. */
int digit;
};
/*!
MFC/R2 tone detector descriptor.
*/
struct r2_mf_rx_state_s
{
/*! Optional callback funcion to deliver received digits. */
tone_report_func_t callback;
/*! An opaque pointer passed to the callback function. */
void *callback_data;
/*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
int fwd;
/*! Tone detector working states */
goertzel_state_t out[6];
/*! The current sample number within a processing block. */
int current_sample;
/*! The currently detected digit. */
int current_digit;
};
#endif
/*- End of file ------------------------------------------------------------*/
MAX_BELL_MF_DIGITS
#define MAX_BELL_MF_DIGITS
Definition bell_r2_mf.h:103
queue_state_t
struct queue_state_s queue_state_t
Definition queue.h:54
bell_mf_rx_state_s
Definition private/bell_r2_mf.h:49
bell_mf_rx_state_s::current_sample
int current_sample
Definition private/bell_r2_mf.h:59
bell_mf_rx_state_s::digits_callback
digits_rx_callback_t digits_callback
Definition private/bell_r2_mf.h:51
bell_mf_rx_state_s::out
goertzel_state_t out[6]
Definition private/bell_r2_mf.h:55
bell_mf_rx_state_s::digits_callback_data
void * digits_callback_data
Definition private/bell_r2_mf.h:53
bell_mf_rx_state_s::hits
uint8_t hits[5]
Definition private/bell_r2_mf.h:57
bell_mf_rx_state_s::current_digits
int current_digits
Definition private/bell_r2_mf.h:64
bell_mf_rx_state_s::digits
char digits[MAX_BELL_MF_DIGITS+1]
Definition private/bell_r2_mf.h:66
bell_mf_rx_state_s::lost_digits
int lost_digits
Definition private/bell_r2_mf.h:62
bell_mf_tx_state_s
Definition private/bell_r2_mf.h:34
bell_mf_tx_state_s::tones
tone_gen_state_t tones
Definition private/bell_r2_mf.h:36
r2_mf_rx_state_s
Definition private/bell_r2_mf.h:86
r2_mf_rx_state_s::callback_data
void * callback_data
Definition private/bell_r2_mf.h:90
r2_mf_rx_state_s::current_digit
int current_digit
Definition private/bell_r2_mf.h:98
r2_mf_rx_state_s::callback
tone_report_func_t callback
Definition private/bell_r2_mf.h:88
r2_mf_rx_state_s::current_sample
int current_sample
Definition private/bell_r2_mf.h:96
r2_mf_rx_state_s::out
goertzel_state_t out[6]
Definition private/bell_r2_mf.h:94
r2_mf_rx_state_s::fwd
int fwd
Definition private/bell_r2_mf.h:92
r2_mf_tx_state_s
Definition private/bell_r2_mf.h:73
r2_mf_tx_state_s::tone
tone_gen_state_t tone
Definition private/bell_r2_mf.h:75
r2_mf_tx_state_s::digit
int digit
Definition private/bell_r2_mf.h:79
r2_mf_tx_state_s::fwd
int fwd
Definition private/bell_r2_mf.h:77
tone_gen_state_t
struct tone_gen_state_s tone_gen_state_t
Definition tone_generate.h:57