spandsp  0.0.6
super_tone_tx.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * super_tone_tx.h - Flexible telephony supervisory tone generation.
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_SUPER_TONE_TX_H_)
27 #define _SPANDSP_SUPER_TONE_TX_H_
28 
29 /*! \page super_tone_tx_page Supervisory tone generation
30 
31 \section super_tone_tx_page_sec_1 What does it do?
32 
33 The supervisory tone generator may be configured to generate most of the world's
34 telephone supervisory tones - things like ringback, busy, number unobtainable,
35 and so on. It uses tree structure tone descriptions, which can deal with quite
36 complex cadence patterns.
37 
38 \section super_tone_tx_page_sec_2 How does it work?
39 
40 */
41 
43 
45 
46 #if defined(__cplusplus)
47 extern "C"
48 {
49 #endif
50 
51 SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s,
52  float f1,
53  float l1,
54  float f2,
55  float l2,
56  int length,
57  int cycles);
58 
59 SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s);
60 
61 /*! Initialise a supervisory tone generator.
62  \brief Initialise a supervisory tone generator.
63  \param s The supervisory tone generator context.
64  \param tree The supervisory tone tree to be generated.
65  \return The supervisory tone generator context. */
67 
68 SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s);
69 
70 SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s);
71 
72 /*! Generate a block of audio samples for a supervisory tone pattern.
73  \brief Generate a block of audio samples for a supervisory tone pattern.
74  \param s The supervisory tone context.
75  \param amp The audio sample buffer.
76  \param max_samples The maximum number of samples to be generated.
77  \return The number of samples generated. */
78 SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples);
79 
80 #if defined(__cplusplus)
81 }
82 #endif
83 
84 #endif
85 /*- End of file ------------------------------------------------------------*/
super_tone_tx_state_t * super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree)
Initialise a supervisory tone generator.
Definition: super_tone_tx.c:130
Definition: private/super_tone_tx.h:29
int super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples)
Generate a block of audio samples for a supervisory tone pattern.
Definition: super_tone_tx.c:163
Definition: private/super_tone_tx.h:39