00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * super_tone_tx.h - Flexible telephony supervisory tone generation. 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2001 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 * 00025 * $Id: super_tone_tx.h,v 1.17 2009/02/10 13:06:47 steveu Exp $ 00026 */ 00027 00028 #if !defined(_SPANDSP_SUPER_TONE_TX_H_) 00029 #define _SPANDSP_SUPER_TONE_TX_H_ 00030 00031 /*! \page super_tone_tx_page Supervisory tone generation 00032 00033 \section super_tone_tx_page_sec_1 What does it do? 00034 00035 The supervisory tone generator may be configured to generate most of the world's 00036 telephone supervisory tones - things like ringback, busy, number unobtainable, 00037 and so on. It uses tree structure tone descriptions, which can deal with quite 00038 complex cadence patterns. 00039 00040 \section super_tone_tx_page_sec_2 How does it work? 00041 00042 */ 00043 00044 typedef struct super_tone_tx_step_s super_tone_tx_step_t; 00045 00046 typedef struct super_tone_tx_state_s super_tone_tx_state_t; 00047 00048 #if defined(__cplusplus) 00049 extern "C" 00050 { 00051 #endif 00052 00053 SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s, 00054 float f1, 00055 float l1, 00056 float f2, 00057 float l2, 00058 int length, 00059 int cycles); 00060 00061 SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s); 00062 00063 /*! Initialise a supervisory tone generator. 00064 \brief Initialise a supervisory tone generator. 00065 \param s The supervisory tone generator context. 00066 \param tree The supervisory tone tree to be generated. 00067 \return The supervisory tone generator context. */ 00068 SPAN_DECLARE(super_tone_tx_state_t *) super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree); 00069 00070 SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s); 00071 00072 SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s); 00073 00074 /*! Generate a block of audio samples for a supervisory tone pattern. 00075 \brief Generate a block of audio samples for a supervisory tone pattern. 00076 \param s The supervisory tone context. 00077 \param amp The audio sample buffer. 00078 \param max_samples The maximum number of samples to be generated. 00079 \return The number of samples generated. */ 00080 SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples); 00081 00082 #if defined(__cplusplus) 00083 } 00084 #endif 00085 00086 #endif 00087 /*- End of file ------------------------------------------------------------*/