Mercurial > hg > audiostuff
comparison spandsp-0.0.3/spandsp-0.0.3/src/spandsp/super_tone_tx.h @ 5:f762bf195c4b
import spandsp-0.0.3
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 16:00:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:26cd8f1ef0b1 | 5:f762bf195c4b |
---|---|
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 General Public License version 2, as | |
14 * 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 General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 * | |
25 * $Id: super_tone_tx.h,v 1.8 2006/10/24 13:45:28 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_SUPER_TONE_TX_H_) | |
29 #define _SUPER_TONE_TX_H_ | |
30 | |
31 /*! \page super_tone_tx_page Supervisory tone generation | |
32 | |
33 \section super_tone_tx_page_sec_1 What does it do? | |
34 | |
35 The supervisory tone generator may be configured to generate most of the world's | |
36 telephone supervisory tones - things like ringback, busy, number unobtainable, | |
37 and so on. It uses tree structure tone descriptions, which can deal with quite | |
38 complex cadence patterns. | |
39 | |
40 \section super_tone_tx_page_sec_2 How does it work? | |
41 | |
42 */ | |
43 | |
44 typedef struct super_tone_tx_step_s super_tone_tx_step_t; | |
45 | |
46 typedef struct | |
47 { | |
48 int32_t phase_rate[2]; | |
49 float gain[2]; | |
50 uint32_t phase[2]; | |
51 int current_position; | |
52 int level; | |
53 super_tone_tx_step_t *levels[4]; | |
54 int cycles[4]; | |
55 } super_tone_tx_state_t; | |
56 | |
57 struct super_tone_tx_step_s | |
58 { | |
59 int32_t phase_rate[2]; | |
60 float gain[2]; | |
61 int tone; | |
62 int length; | |
63 int cycles; | |
64 super_tone_tx_step_t *next; | |
65 super_tone_tx_step_t *nest; | |
66 }; | |
67 | |
68 super_tone_tx_step_t *super_tone_tx_make_step(super_tone_tx_step_t *s, | |
69 float f1, | |
70 float l1, | |
71 float f2, | |
72 float l2, | |
73 int length, | |
74 int cycles); | |
75 | |
76 void super_tone_tx_free(super_tone_tx_step_t *s); | |
77 | |
78 /*! Initialise a supervisory tone generator. | |
79 \brief Initialise a supervisory tone generator. | |
80 \param s The supervisory tone generator context. | |
81 \param tree The supervisory tone tree to be generated. | |
82 \return The supervisory tone generator context. */ | |
83 super_tone_tx_state_t *super_tone_tx_init(super_tone_tx_state_t *s, super_tone_tx_step_t *tree); | |
84 | |
85 /*! Generate a block of audio samples for a supervisory tone pattern. | |
86 \brief Generate a block of audio samples for a supervisory tone pattern. | |
87 \param tone The supervisory tone context. | |
88 \param amp The audio sample buffer. | |
89 \param max_samples The maximum number of samples to be generated. | |
90 \return The number of samples generated. */ | |
91 int super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples); | |
92 | |
93 #endif | |
94 /*- End of file ------------------------------------------------------------*/ |