spandsp 3.0.0
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
33The supervisory tone generator may be configured to generate most of the world's
34telephone supervisory tones - things like ringback, busy, number unobtainable,
35and so on. It uses tree structure tone descriptions, which can deal with quite
36complex cadence patterns.
37
38\section super_tone_tx_page_sec_2 How does it work?
39
40*/
41
42#define SUPER_TONE_TX_MAX_LEVELS 4
43#define SUPER_TONE_TX_MAX_TONES 4
44
46
48
49#if defined(__cplusplus)
50extern "C"
51{
52#endif
53
54SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s,
55 float f1,
56 float l1,
57 float f2,
58 float l2,
59 int length,
60 int cycles);
61
62SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s);
63
64/*! Initialise a supervisory tone generator.
65 \brief Initialise a supervisory tone generator.
66 \param s The supervisory tone generator context.
67 \param tree The supervisory tone tree to be generated.
68 \return The supervisory tone generator context. */
70
71SPAN_DECLARE(int) super_tone_tx_release(super_tone_tx_state_t *s);
72
73SPAN_DECLARE(int) super_tone_tx_free(super_tone_tx_state_t *s);
74
75/*! Generate a block of audio samples for a supervisory tone pattern.
76 \brief Generate a block of audio samples for a supervisory tone pattern.
77 \param s The supervisory tone context.
78 \param amp The audio sample buffer.
79 \param max_samples The maximum number of samples to be generated.
80 \return The number of samples generated. */
81SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max_samples);
82
83#if defined(__cplusplus)
84}
85#endif
86
87#endif
88/*- End of file ------------------------------------------------------------*/
Definition: private/super_tone_tx.h:40
Definition: private/super_tone_tx.h:30
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:164
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:131