spandsp
0.0.6
tone_generate.h
Go to the documentation of this file.
1
/*
2
* SpanDSP - a series of DSP components for telephony
3
*
4
* tone_generate.h - General telephony 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
/*! \file */
27
28
#if !defined(_SPANDSP_TONE_GENERATE_H_)
29
#define _SPANDSP_TONE_GENERATE_H_
30
31
/*! \page tone_generation_page Tone generation
32
\section tone_generation_page_sec_1 What does it do?
33
The tone generation module provides for the generation of cadenced tones,
34
suitable for a wide range of telephony applications.
35
36
\section tone_generation_page_sec_2 How does it work?
37
Oscillators are a problem. They oscillate due to instability, and yet we need
38
them to behave in a stable manner. A look around the web will reveal many papers
39
on this subject. Many describe rather complex solutions to the problem. However,
40
we are only concerned with telephony applications. It is possible to generate
41
the tones we need with a very simple efficient scheme. It is also practical to
42
use an exhaustive test to prove the oscillator is stable under all the
43
conditions in which we will use it.
44
*/
45
46
typedef
struct
tone_gen_tone_descriptor_s
tone_gen_tone_descriptor_t
;
47
48
/*!
49
Cadenced multi-tone generator descriptor.
50
*/
51
typedef
struct
tone_gen_descriptor_s
tone_gen_descriptor_t
;
52
53
/*!
54
Cadenced multi-tone generator state descriptor. This defines the state of
55
a single working instance of a generator.
56
*/
57
typedef
struct
tone_gen_state_s
tone_gen_state_t
;
58
59
#if defined(__cplusplus)
60
extern
"C"
61
{
62
#endif
63
64
/*! Create a tone generator descriptor
65
\brief Create a tone generator descriptor
66
\param s The descriptor
67
\param f1 The first frequency, in Hz
68
\param l1 The level of the first frequency, in dBm0
69
\param f2 0 for no second frequency, a positive number for the second frequency,
70
in Hz, or a negative number for an AM modulation frequency, in Hz
71
\param l2 The level of the second frequency, in dBm0, or the percentage modulation depth
72
for an AM modulated tone.
73
\param d1 x
74
\param d2 x
75
\param d3 x
76
\param d4 x
77
\param repeat x */
78
SPAN_DECLARE(
tone_gen_descriptor_t
*)
tone_gen_descriptor_init
(
tone_gen_descriptor_t
*s,
79
int
f1,
80
int
l1,
81
int
f2,
82
int
l2,
83
int
d1,
84
int
d2,
85
int
d3,
86
int
d4,
87
int
repeat);
88
89
/* For backwards compatibility */
90
#define make_tone_gen_descriptor tone_gen_descriptor_init
91
92
SPAN_DECLARE(
void
) tone_gen_descriptor_free(
tone_gen_descriptor_t
*s);
93
94
SPAN_DECLARE_NONSTD
(
int
) tone_gen(
tone_gen_state_t
*s, int16_t amp[],
int
max_samples);
95
96
SPAN_DECLARE(
tone_gen_state_t
*) tone_gen_init(
tone_gen_state_t
*s,
tone_gen_descriptor_t
*t);
97
98
SPAN_DECLARE(
int
) tone_gen_release(
tone_gen_state_t
*s);
99
100
SPAN_DECLARE(
int
) tone_gen_free(
tone_gen_state_t
*s);
101
102
#if defined(__cplusplus)
103
}
104
#endif
105
106
#endif
107
/*- End of file ------------------------------------------------------------*/
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s
Get the next bit of a transmitted serial bit stream.
tone_gen_tone_descriptor_s
Definition:
private/tone_generate.h:29
tone_gen_state_s
Definition:
private/tone_generate.h:53
tone_gen_descriptor_init
tone_gen_descriptor_t * tone_gen_descriptor_init(tone_gen_descriptor_t *s, int f1, int l1, int f2, int l2, int d1, int d2, int d3, int d4, int repeat)
Create a tone generator descriptor.
Definition:
tone_generate.c:60
tone_gen_descriptor_s
Definition:
private/tone_generate.h:42
src
spandsp
tone_generate.h
Generated by
1.8.14