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 * $Id: modem_connect_tones.h,v 1.3 2009/11/02 13:25:20 steveu Exp $ 00028 */ 00029 00030 /*! \file */ 00031 00032 #if !defined(_SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_) 00033 #define _SPANDSP_PRIVATE_MODEM_CONNECT_TONES_H_ 00034 00035 /*! 00036 Modem connect tones generator descriptor. This defines the state 00037 of a single working instance of the tone generator. 00038 */ 00039 struct modem_connect_tones_tx_state_s 00040 { 00041 int tone_type; 00042 00043 int32_t tone_phase_rate; 00044 uint32_t tone_phase; 00045 int16_t level; 00046 /*! \brief Countdown to the next phase hop */ 00047 int hop_timer; 00048 /*! \brief Maximum duration timer */ 00049 int duration_timer; 00050 uint32_t mod_phase; 00051 int32_t mod_phase_rate; 00052 int16_t mod_level; 00053 }; 00054 00055 /*! 00056 Modem connect tones receiver descriptor. This defines the state 00057 of a single working instance of the tone detector. 00058 */ 00059 struct modem_connect_tones_rx_state_s 00060 { 00061 /*! \brief The tone type being detected. */ 00062 int tone_type; 00063 /*! \brief Callback routine, using to report detection of the tone. */ 00064 tone_report_func_t tone_callback; 00065 /*! \brief An opaque pointer passed to tone_callback. */ 00066 void *callback_data; 00067 00068 /*! \brief The notch filter state. */ 00069 float znotch_1; 00070 float znotch_2; 00071 /*! \brief The 15Hz AM filter state. */ 00072 float z15hz_1; 00073 float z15hz_2; 00074 /*! \brief The in notch power estimate */ 00075 int32_t notch_level; 00076 /*! \brief The total channel power estimate */ 00077 int32_t channel_level; 00078 /*! \brief The 15Hz AM power estimate */ 00079 int32_t am_level; 00080 /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */ 00081 int chunk_remainder; 00082 /*! \brief TRUE is the tone is currently confirmed present in the audio. */ 00083 int tone_present; 00084 /*! \brief */ 00085 int tone_on; 00086 /*! \brief A millisecond counter, to time the duration of tone sections. */ 00087 int tone_cycle_duration; 00088 /*! \brief A count of the number of good cycles of tone reversal seen. */ 00089 int good_cycles; 00090 /*! \brief TRUE if the tone has been seen since the last time the user tested for it */ 00091 int hit; 00092 /*! \brief A V.21 FSK modem context used when searching for FAX preamble. */ 00093 fsk_rx_state_t v21rx; 00094 /*! \brief The raw (stuffed) bit stream buffer. */ 00095 unsigned int raw_bit_stream; 00096 /*! \brief The current number of bits in the octet in progress. */ 00097 int num_bits; 00098 /*! \brief Number of consecutive flags seen so far. */ 00099 int flags_seen; 00100 /*! \brief TRUE if framing OK has been announced. */ 00101 int framing_ok_announced; 00102 }; 00103 00104 #endif 00105 /*- End of file ------------------------------------------------------------*/