spandsp 0.0.6

private/modem_connect_tones.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/modem_connect_tones.c - Generation and detection of tones
00005  *                                 associated with modems calling and
00006  *                                 answering calls.
00007  *
00008  * Written by Steve Underwood <steveu@coppice.org>
00009  *
00010  * Copyright (C) 2006 Steve Underwood
00011  *
00012  * All rights reserved.
00013  *
00014  * This program is free software; you can redistribute it and/or modify
00015  * it under the terms of the GNU Lesser General Public License version 2.1,
00016  * as published by the Free Software Foundation.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU Lesser General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public
00024  * License along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00026  */
00027  
00028 /*! \file */
00029 
00030 #if !defined(_SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_)
00031 #define _SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_
00032 
00033 /*!
00034     Modem connect tones generator descriptor. This defines the state
00035     of a single working instance of the tone generator.
00036 */
00037 struct modem_connect_tones_tx_state_s
00038 {
00039     int tone_type;
00040 
00041     int32_t tone_phase_rate;
00042     uint32_t tone_phase;
00043     int16_t level;
00044     /*! \brief Countdown to the next phase hop */
00045     int hop_timer;
00046     /*! \brief Maximum duration timer */
00047     int duration_timer;
00048     uint32_t mod_phase;
00049     int32_t mod_phase_rate;
00050     int16_t mod_level;
00051 };
00052 
00053 /*!
00054     Modem connect tones receiver descriptor. This defines the state
00055     of a single working instance of the tone detector.
00056 */
00057 struct modem_connect_tones_rx_state_s
00058 {
00059     /*! \brief The tone type being detected. */
00060     int tone_type;
00061     /*! \brief Callback routine, using to report detection of the tone. */
00062     tone_report_func_t tone_callback;
00063     /*! \brief An opaque pointer passed to tone_callback. */
00064     void *callback_data;
00065 
00066     /*! \brief The notch filter state. */
00067     float znotch_1;
00068     float znotch_2;
00069     /*! \brief The 15Hz AM  filter state. */
00070     float z15hz_1;
00071     float z15hz_2;
00072     /*! \brief The in notch power estimate */
00073     int32_t notch_level;
00074     /*! \brief The total channel power estimate */
00075     int32_t channel_level;
00076     /*! \brief The 15Hz AM power estimate */
00077     int32_t am_level;
00078     /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
00079     int chunk_remainder;
00080     /*! \brief TRUE is the tone is currently confirmed present in the audio. */
00081     int tone_present;
00082     /*! \brief */
00083     int tone_on;
00084     /*! \brief A millisecond counter, to time the duration of tone sections. */
00085     int tone_cycle_duration;
00086     /*! \brief A count of the number of good cycles of tone reversal seen. */
00087     int good_cycles;
00088     /*! \brief TRUE if the tone has been seen since the last time the user tested for it */
00089     int hit;
00090     /*! \brief A V.21 FSK modem context used when searching for FAX preamble. */
00091     fsk_rx_state_t v21rx;
00092     /*! \brief The raw (stuffed) bit stream buffer. */
00093     unsigned int raw_bit_stream;
00094     /*! \brief The current number of bits in the octet in progress. */
00095     int num_bits;
00096     /*! \brief Number of consecutive flags seen so far. */
00097     int flags_seen;
00098     /*! \brief TRUE if framing OK has been announced. */
00099     int framing_ok_announced;
00100 };
00101 
00102 #endif
00103 /*- End of file ------------------------------------------------------------*/