9
9
* under the terms of the GNU Library General Public License as published by
10
10
* the Free Software Foundation; either version 3 of the License, or (at your
11
11
* option) any later version.
13
13
* This program is distributed in the hope that it will be useful, but WITHOUT
14
14
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
15
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16
16
* License for more details.
18
18
* You should have received a copy of the GNU Library General Public License
19
19
* along with this library; see the file COPYING.LIB. If not, write to the
20
20
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
50
50
class DTMFException : public std::exception
59
* @param _reason An error message
61
DTMFException(const char* _reason) throw();
66
virtual ~DTMFException() throw();
69
DTMFException(const DTMFException& rh) throw();
71
// Assignment Operator
72
DTMFException& operator=( const DTMFException& rh) throw();
75
* @return const char* The error
77
virtual const char* what() const throw();
59
* @param _reason An error message
61
DTMFException (const char* _reason) throw();
66
virtual ~DTMFException() throw();
69
DTMFException(const DTMFException& rh) throw();
71
// Assignment Operator
72
DTMFException& operator=( const DTMFException& rh) throw();
75
* @return const char* The error
77
virtual const char* what() const throw();
81
81
* @file dtmfgenerator.h
82
82
* @brief DTMF Tone Generator
87
/** Struct to handle a DTMF */
89
unsigned char code; /** Code of the tone */
90
int lower; /** Lower frequency */
91
int higher; /** Higher frequency */
94
/** State of the DTMF generator */
96
unsigned int offset; /** Offset in the sample currently being played */
97
SFLDataFormat* sample; /** Currently generated code */
100
/** State of the DTMF generator */
103
/** The different kind of tones */
104
static const DTMFTone tones[NUM_TONES];
106
/** Generated samples */
107
SFLDataFormat* samples[NUM_TONES];
109
/** Sampling rate of generated dtmf */
117
* DTMF Generator contains frequency of each keys
118
* and can build one DTMF.
119
* @param sampleRate frequency of the sample (ex: 8000 hz)
121
DTMFGenerator(unsigned int sampleRate);
130
DTMFGenerator(const DTMFGenerator& rh);
132
// Assignment Operator
133
DTMFGenerator& operator=( const DTMFGenerator& rh);
136
* Get n samples of the signal of code code
137
* @param buffer a SFLDataFormat pointer to an allocated buffer
138
* @param n number of sampling to get, should be lower or equal to buffer size
139
* @param code dtmf code to get sound
141
void getSamples(SFLDataFormat* buffer, size_t n, unsigned char code) throw (DTMFException);
144
* Get next n samples (continues where previous call to
145
* genSample or genNextSamples stopped
146
* @param buffer a SFLDataFormat pointer to an allocated buffer
147
* @param n number of sampling to get, should be lower or equal to buffer size
149
void getNextSamples(SFLDataFormat* buffer, size_t n) throw (DTMFException);
154
* Generate samples for a specific dtmf code
155
* @param code The code
156
* @return SFLDataFormat* The generated data
158
SFLDataFormat* generateSample(unsigned char code) throw (DTMFException);
87
/** Struct to handle a DTMF */
89
unsigned char code; /** Code of the tone */
90
int lower; /** Lower frequency */
91
int higher; /** Higher frequency */
94
/** State of the DTMF generator */
96
unsigned int offset; /** Offset in the sample currently being played */
97
SFLDataFormat* sample; /** Currently generated code */
100
/** State of the DTMF generator */
103
/** The different kind of tones */
104
static const DTMFTone tones[NUM_TONES];
106
/** Generated samples */
107
SFLDataFormat* samples[NUM_TONES];
109
/** Sampling rate of generated dtmf */
117
* DTMF Generator contains frequency of each keys
118
* and can build one DTMF.
119
* @param sampleRate frequency of the sample (ex: 8000 hz)
121
DTMFGenerator (unsigned int sampleRate);
130
DTMFGenerator (const DTMFGenerator& rh);
132
// Assignment Operator
133
DTMFGenerator& operator= (const DTMFGenerator& rh);
136
* Get n samples of the signal of code code
137
* @param buffer a SFLDataFormat pointer to an allocated buffer
138
* @param n number of sampling to get, should be lower or equal to buffer size
139
* @param code dtmf code to get sound
141
void getSamples (SFLDataFormat* buffer, size_t n, unsigned char code) throw (DTMFException);
144
* Get next n samples (continues where previous call to
145
* genSample or genNextSamples stopped
146
* @param buffer a SFLDataFormat pointer to an allocated buffer
147
* @param n number of sampling to get, should be lower or equal to buffer size
149
void getNextSamples (SFLDataFormat* buffer, size_t n) throw (DTMFException);
154
* Generate samples for a specific dtmf code
155
* @param code The code
156
* @return SFLDataFormat* The generated data
158
SFLDataFormat* generateSample (unsigned char code) throw (DTMFException);
161
161
#endif // DTMFGENERATOR_H