31#elif !defined(__hpux) && !defined(_AIX)
37#if defined(_WIN32) && defined(_MSC_VER)
38#pragma warning(disable: 4996)
41#if defined(__BORLANDC__) && defined(__Windows)
46#if !defined(__EXPORT) && defined(W32)
47#define __EXPORT __declspec(dllimport)
63#include <netinet/in.h>
70#define AUDIO_SIGNED_LINEAR_RAW 1
71#define AUDIO_LINEAR_CONVERSION 1
72#define AUDIO_CODEC_MODULES 1
73#define AUDIO_LINEAR_FRAMING 1
74#define AUDIO_NATIVE_METHODS 1
75#define AUDIO_RATE_RESAMPLER 1
221 speexNarrow = speexVoice,
222 speexWide = speexAudio,
223 g723_4bit = g721ADPCM
282#if __BYTE_ORDER == __LITTLE_ENDIAN
301 unsigned char mp_sync1 : 8;
303 unsigned char mp_sync2 : 3;
304 unsigned char mp_ver : 2;
305 unsigned char mp_layer : 2;
306 unsigned char mp_crc : 1;
308 unsigned char mp_brate : 4;
309 unsigned char mp_srate : 2;
310 unsigned char mp_pad : 1;
311 unsigned char mp_priv : 1;
313 unsigned char mp_channels : 2;
314 unsigned char mp_extend : 2;
315 unsigned char mp_copyright : 1;
316 unsigned char mp_original : 1;
317 unsigned char mp_emp : 2;
723 static void fill(
unsigned char *address,
int number,
Encoding encoding);
982 {
return getBuffer(data, 0);};
1027 size_t size, start, len;
1063 virtual bool afCreate(
const char *path,
bool exclusive =
false);
1065 virtual bool afPeek(
unsigned char *data,
unsigned size);
1081 virtual int afRead(
unsigned char *data,
unsigned size);
1094 virtual int afWrite(
unsigned char *data,
unsigned size);
1161 void setShort(
unsigned char *data,
unsigned short value);
1181 void setLong(
unsigned char *data,
unsigned long value);
1247 {
return maxFramesize(info);};
1452 {
return info.encoding;};
1460 {
return info.format;};
1469 {
return info.rate;};
1477 {
return info.annotation;};
1488 {
return (
bool)!isOpen();};
1809 static bool load(
const char *name);
1859 virtual unsigned encode(
Linear buffer,
void *dest,
unsigned number = 0) = 0;
1879 virtual unsigned decode(
Linear buffer,
void *source,
unsigned number = 0) = 0;
2108 static bool load(
const char *pathname,
const char *locale = NULL);
#define __EXPORT
Definition: audio2.h:51
Audio source description.
Definition: audio2.h:339
Encoding encoding
Definition: audio2.h:342
unsigned order
Definition: audio2.h:345
timeout_t framing
Definition: audio2.h:347
unsigned long bitrate
Definition: audio2.h:344
char * annotation
Definition: audio2.h:348
unsigned long rate
Definition: audio2.h:343
Format format
Definition: audio2.h:341
unsigned framecount
Definition: audio2.h:346
void setFraming(timeout_t frame)
AudioBase base class for many other audio classes which stream data.
Definition: audio2.h:909
ssize_t getPacket(Encoded data)
Get's a packet of audio data.
Definition: audio2.h:981
unsigned getSampleRate(void)
Generic sample rate.
Definition: audio2.h:944
AudioBase(Info *info)
Create audio base object with audio source description.
ssize_t putNative(Encoded data, size_t size)
Puts raw data and does native to refined endian swapping if needed based on encoding type and local m...
virtual ssize_t putBuffer(Encoded data, size_t size)=0
Abstract interface to put raw data.
AudioBase()
Create audio base object with no info.
ssize_t getNative(Encoded data, size_t size)
Get raw data and assure is in native machine endian.
virtual ~AudioBase()
Destroy an audio base object.
Info info
Definition: audio2.h:911
virtual ssize_t getBuffer(Encoded data, size_t size)=0
Abstract interface to get raw data.
Encoding getEncoding(void)
Generic get encoding.
Definition: audio2.h:936
The AudioBuffer class is for mixing one-to-one soft joins.
Definition: audio2.h:1002
ssize_t putBuffer(Encoded data, size_t number)
Put data into the audio buffer.
AudioBuffer(Info *info, size_t size=4096)
ssize_t getBuffer(Encoded data, size_t number)
save audio data from buffer data.
The codec class is a virtual used for transcoding audio samples between linear frames (or other known...
Definition: audio2.h:1734
virtual Level getImpulse(void *buffer, unsigned number=0)
Get the impulse energy level of a frame of X samples in the specified codec format.
virtual unsigned getEstimated(void)
Get estimated data required for buffered operations.
static bool load(Encoding encoding)
Find and load a codec file by it's encoding type.
static AudioCodec * getCodec(Info &info, bool loaded=false)
Get the codec base class for accessing a specific derived codec identified by audio source descriptor...
virtual AudioCodec * getByInfo(Info &info)
get a codec by audio source info descriptor.
Definition: audio2.h:1760
static AudioCodec * getCodec(Encoding encoding, const char *format=NULL, bool loaded=false)
Get the codec base class for accessing a specific derived codec identified by encoding type and optio...
virtual ~AudioCodec()
Definition: audio2.h:1772
static AudioCodec * first
Definition: audio2.h:1736
Info info
Definition: audio2.h:1740
Info getInfo(void)
Get an info description for this codec.
Definition: audio2.h:1922
virtual unsigned getPacket(Encoded destination, Encoded data, unsigned size)
Get a packet of data rather than decode.
Encoding encoding
Definition: audio2.h:1738
const char * name
Definition: audio2.h:1739
static bool load(const char *name)
Load a named codec set into process memory.
virtual unsigned decode(Linear buffer, void *source, unsigned number=0)=0
Decode the sample frame into linear samples.
virtual Level getPeak(void *buffer, unsigned number=0)
Get the peak energy level within the frame of X samples.
virtual AudioCodec * getByFormat(const char *format)
often used to create a "new" codec of a subtype based on encoding format, default returns the current...
Definition: audio2.h:1751
virtual bool isSilent(Level threashold, void *buffer, unsigned number=0)
Signal if the current audio frame is silent.
virtual unsigned decodeBuffered(Linear buffer, Encoded source, unsigned len)
Buffer and decode data into linear samples.
virtual unsigned getRequired(void)
get required samples for encoding.
virtual unsigned encodeBuffered(Linear Buffer, Encoded dest, unsigned number)
Encode linear samples buffered into the coded.
AudioCodec * next
Definition: audio2.h:1737
AudioCodec(const char *name, Encoding encoding)
Base for codecs, create a named coded of a specific encoding.
virtual unsigned encode(Linear buffer, void *dest, unsigned number=0)=0
Encode a linear sample frame into the codec sample buffer.
static void endCodec(AudioCodec *codec)
End use of a requested codec.
Definition: audio2.h:1927
bool isEnabled(void)
Whether device is currently enabled.
Definition: audio2.h:2044
unsigned bufMono(Linear buffer, unsigned count)
Process linear mono audio and automatically convert to the encoding format the audio device is curren...
virtual void sync(void)
Synchronize timing for audio device to next audio frame.
Definition: audio2.h:1998
virtual unsigned putSamples(Linear buffer, unsigned count)=0
Copy linear samples to an audio device through its virtual.
virtual bool setAudio(Rate rate=rate8khz, bool stereo=false, timeout_t framing=20)=0
Set properties for audio device.
Info * getInfo(void)
Get audio device source descriptor in effect for the device.
Definition: audio2.h:2033
virtual ssize_t getBuffer(Encoded data, size_t count)
Record audio encoded in the currently selected encoding for the audio device.
virtual unsigned getSamples(Linear buffer, unsigned count)=0
Copy linear samples from an audio device through its virtual.
bool enabled
Definition: audio2.h:1929
virtual bool setEncoded(Info &info)
Use encoding source descriptor to select the audio encoding format the audio device should be using.
Definition: audio2.h:1979
unsigned bufStereo(Linear buffer, unsigned count)
Process linear stereo audio and automatically convert to the encoding format the audio device is curr...
virtual ~AudioDevice()
Definition: audio2.h:1932
virtual ssize_t putBuffer(Encoded data, size_t count)
Copy audio encoded in the currently selected encoding for the audio device.
virtual void flush(void)=0
Flush any pending buffered samples in audio device.
A class used to manipulate audio data.
Definition: audio2.h:1043
unsigned long getHeader(void)
Get number of bytes in the file header.
Definition: audio2.h:1140
AudioCodec * getCodec(void)
AudioFile(const char *name, Info *info, unsigned long minimum=0)
Create and open a new audio file for writing.
virtual bool isOpen(void)
Test if the file is opened.
virtual void afClose(void)
Close the derived file handling system's file handle.
Error setPosition(unsigned long samples=~0l)
Seek a file position by sample count.
const char * getErrorStr(Error err)
Return a human-readable error message given a numeric error code of type Audio::Error.
Error getInfo(Info *info)
Copy the source description of the audio file into the specified object.
void setLong(unsigned char *data, unsigned long value)
Save a long as four byte binary data stored in the endian order specified in the source description.
unsigned getSampleRate(void)
Get audio encoding sample rate, in samples per second, for this audio file.
Definition: audio2.h:1468
unsigned long header
Definition: audio2.h:1047
ssize_t getBuffer(Encoded buffer, size_t len=0)
Retrieve bytes from the file into a memory buffer.
Error position(const char *timestamp)
Seek a file position by timestamp.
virtual bool afCreate(const char *path, bool exclusive=false)
unsigned long getAbsolutePosition(void)
Get the current file pointer in bytes relative to the start of the file.
time_t getAge(void)
Returns age since last prior access.
void getPosition(char *timestamp, size_t size)
Return the timestamp of the current absolute file position.
Error putSamples(void *buffer, unsigned samples=0)
Insert samples into the file from a memory buffer.
void * handle
Definition: audio2.h:1057
unsigned long length
Definition: audio2.h:1049
char * pathname
Definition: audio2.h:1045
void mp3info(mpeg_audio *mp3)
void getWaveFormat(int size)
virtual char * getContinuation(void)
This function is used to splice multiple audio files together into a single stream of continues audio...
Definition: audio2.h:1119
void open(const char *name, Mode mode=modeWrite, timeout_t framing=0)
Open an audio file and associate it with this object.
ssize_t putBuffer(Encoded buffer, size_t len=0)
Insert bytes into the file from a memory buffer.
Error error
Definition: audio2.h:1046
unsigned getLinear(Linear buffer, unsigned request=0)
Retrieve and convert content to linear encoded audio data from it's original form.
virtual int afWrite(unsigned char *data, unsigned size)
Write a number of bytes into the file at the current file pointer.
Encoding getEncoding(void)
Return audio encoding format for this audio file.
Definition: audio2.h:1451
AudioFile()
Construct an audio file without attaching to the filesystem.
Definition: audio2.h:1204
Mode mode
Definition: audio2.h:1060
Format getFormat(void)
Return base file format of containing audio file.
Definition: audio2.h:1459
virtual bool afPeek(unsigned char *data, unsigned size)
bool isSigned(void)
Return if the current content is signed or unsigned samples.
unsigned short getShort(unsigned char *data)
Convert binary 2 byte data stored in the order specified in the source description into a short varia...
unsigned long minimum
Definition: audio2.h:1048
void clear(void)
Clear the AudioFile structure.
Error getSamples(void *buffer, unsigned samples=0)
Retrieve samples from the file into a memory buffer.
Error getError(void)
Get last error code.
Definition: audio2.h:1484
virtual bool afOpen(const char *path, Mode m=modeWrite)
Error setMinimum(unsigned long minimum)
Set minimum file size for a created file.
AudioFile(const char *name, unsigned long offset=0)
Construct and open an existing audio file for read/write.
bool operator!(void)
Definition: audio2.h:1487
size_t getSize(void)
Get maximum size of frame buffer for data use.
Definition: audio2.h:1246
unsigned putLinear(Linear buffer, unsigned request=0)
Convert and store content from linear encoded audio data to the format of the audio file.
void close(void)
Close an object associated with an open file.
virtual bool afSeek(unsigned long pos)
Seek to the given position relative to the start of the file and set the file pointer.
Error skip(long number)
Change the file position by skipping a specified number of audio samples of audio data.
unsigned long getLong(unsigned char *data)
Convert binary 4 byte data stored in the order specified in the source description into a long variab...
void setShort(unsigned char *data, unsigned short value)
Save a short as two byte binary data stored in the endian order specified in the source description.
virtual int afRead(unsigned char *data, unsigned size)
Read a given number of bytes from the file, starting from the current file pointer.
virtual bool hasPositioning(void)
Return true if underlying derived class supports direct access to file positioning.
Definition: audio2.h:1443
char * getAnnotation(void)
Get annotation extracted from header of containing file.
Definition: audio2.h:1476
int fd
Definition: audio2.h:1056
unsigned long iolimit
Definition: audio2.h:1061
Error setLimit(unsigned long maximum=0l)
Set the maximum file position for reading and writing of audio data by samples.
void create(const char *name, Info *info, bool exclusive=false, timeout_t framing=0)
Create a new audio file and associate it with this object.
Error setError(Error err)
unsigned long getPosition(void)
Get the current file pointer in samples relative to the start of the sample buffer.
Generic audio class to hold master data types and various useful class encapsulated friend functions ...
Definition: audio2.h:89
static Level getPeak(Info &info, void *buffer, unsigned number=0)
Get the peak (highest energy) level found in a frame of audio data.
static const char * getExtension(Encoding encoding)
Get the preferred file extension name to use for a given audio encoding type.
static Rate getRate(Encoding encoding)
Return default sample rate associated with the specified audio encoding format.
enum Format Format
Definition: audio2.h:237
int32_t snd32_t
Definition: audio2.h:100
static const char * getMIME(Info &info)
Get the mime descriptive type for a given Audio encoding description, usually retrieved from a newly ...
static Level getPeak(Encoding encoding, void *buffer, unsigned number)
Get the peak (highest energy) level found in a frame of audio data.
static timeout_t toTimeout(const char *timestamp)
Convert ascii timestamp representation to a timeout number.
Format
Audio container file format.
Definition: audio2.h:230
@ snd
Definition: audio2.h:232
@ mpeg
Definition: audio2.h:234
@ riff
Definition: audio2.h:233
@ raw
Definition: audio2.h:231
int16_t snd16_t
Definition: audio2.h:99
static Level getImpulse(Encoding encoding, void *buffer, unsigned number)
Get the energey impulse level of a frame of audio data.
static void fill(unsigned char *address, int number, Encoding encoding)
Fill an audio buffer with "empty" (silent) audio data, based on the audio encoding format.
static const unsigned ndata
Definition: audio2.h:107
static float todbm(Level power)
Convert integer power levels to dbm.
Rate
Audio encoding rate, samples per second.
Definition: audio2.h:148
@ rateUnknown
Definition: audio2.h:149
static bool swapEndian(Info &info, void *buffer, unsigned number)
Optionally swap endian of audio data if the audio source description byte order is different from the...
static int getFrame(Encoding encoding, int samples=0)
Returns the number of bytes in a sample frame for the given encoding type, rounded up to the nearest ...
int16_t Level
Definition: audio2.h:101
static int getCount(Encoding encoding)
Returns the number of samples in all channels for a frame in the given encoding.
static Encoding getMono(Encoding encoding)
Get the mono encoding format associated with the given format.
static size_t toBytes(Encoding encoding, unsigned long number)
Compute the number of bytes a given number of samples in a given audio encoding will occupy.
static void toTimestamp(timeout_t duration, char *address, size_t size)
Provide ascii timestamp representation of a timeout value.
static timeout_t getFraming(Info &info, timeout_t timeout=0)
Return frame time for an audio source description.
static Encoding getStereo(Encoding encoding)
Get the stereo encoding format associated with the given format.
unsigned char * Encoded
Definition: audio2.h:143
enum DeviceMode DeviceMode
Definition: audio2.h:247
static Level getImpulse(Info &info, void *buffer, unsigned number=0)
Get the energey impulse level of a frame of audio data.
static Rate getRate(Encoding e, Rate request)
Return optional rate setting effect.
static bool loadPlugin(const char *path)
Load a dso plugin (codec plugin), used internally...
DeviceMode
Audio device access mode.
Definition: audio2.h:242
@ PLAY
Definition: audio2.h:243
@ RECORD
Definition: audio2.h:244
static timeout_t getFraming(Encoding encoding, timeout_t timeout=0)
Return frame timing for an audio encoding format.
static bool hasDevice(unsigned device=0)
Test for the presense of a specified (indexed) audio device.
static size_t maxFramesize(Info &info)
Maximum framesize for a given coding that may be needed to store a result.
static bool isLinear(Encoding encoding)
Test if the audio encoding format is a linear one.
int16_t * Linear
Definition: audio2.h:103
static bool isEndian(Encoding encoding)
Test if the endian byte order of the encoding format is different from the machine's native byte orde...
static bool isStereo(Encoding encoding)
Test if the audio encoding format is a stereo format.
static bool isMono(Encoding encoding)
Test if the audio encoding format is a mono format.
static const char * getName(Encoding encoding)
Get the short ascii description used for the given audio encoding type.
Error
Audio error conditions.
Definition: audio2.h:252
@ errEncodingInvalid
Definition: audio2.h:259
@ errRateInvalid
Definition: audio2.h:258
@ errReadFailure
Definition: audio2.h:262
@ errWriteInterrupt
Definition: audio2.h:261
@ errNotOpened
Definition: audio2.h:255
@ errRequestInvalid
Definition: audio2.h:266
@ errStartOfFile
Definition: audio2.h:257
@ errNotPlaying
Definition: audio2.h:271
@ errEndOfFile
Definition: audio2.h:256
@ errWriteFailure
Definition: audio2.h:263
@ errWriteIncomplete
Definition: audio2.h:265
@ errInvalidTrack
Definition: audio2.h:269
@ errReadInterrupt
Definition: audio2.h:260
@ errPlaybackFailed
Definition: audio2.h:270
@ errReadIncomplete
Definition: audio2.h:264
@ errTOCFailed
Definition: audio2.h:267
@ errStatFailed
Definition: audio2.h:268
@ errReadLast
Definition: audio2.h:254
Mode
File processing mode, whether to skip missing files, etc.
Definition: audio2.h:162
@ modeReadAny
Definition: audio2.h:164
@ modeReadOne
Definition: audio2.h:165
@ modeWrite
Definition: audio2.h:166
@ modeAppend
Definition: audio2.h:171
@ modeFeed
Definition: audio2.h:169
@ modeRead
Definition: audio2.h:163
@ modeInfo
Definition: audio2.h:168
@ modeCache
Definition: audio2.h:167
enum Mode Mode
Definition: audio2.h:175
static const char * getCodecPath(void)
Get pathname to where loadable codec modules are stored.
static bool isBuffered(Encoding encoding)
Test if the audio encoding format must be packetized (that is, has irregular sized frames) and must b...
static Encoding getEncoding(const char *name)
Get the audio encoding format that is specified by a short ascii name.
int16_t Sample
Definition: audio2.h:102
static unsigned long toSamples(Encoding encoding, size_t bytes)
Compute byte counts of audio data into number of samples based on the audio encoding format used.
Encoding
Audio encoding formats.
Definition: audio2.h:180
@ g722Audio
Definition: audio2.h:183
@ mp1Audio
Definition: audio2.h:193
@ speexUltra
Definition: audio2.h:219
@ g729Audio
Definition: audio2.h:217
@ cdaMono
Definition: audio2.h:205
@ g723_3bit
Definition: audio2.h:187
@ sx73Voice
Definition: audio2.h:198
@ g722_6bit
Definition: audio2.h:185
@ mp3Audio
Definition: audio2.h:195
@ speexVoice
Definition: audio2.h:214
@ cdaStereo
Definition: audio2.h:204
@ pcm32Mono
Definition: audio2.h:211
@ mulawAudio
Definition: audio2.h:191
@ pcm8Stereo
Definition: audio2.h:206
@ pcm32Stereo
Definition: audio2.h:210
@ alawAudio
Definition: audio2.h:192
@ speexAudio
Definition: audio2.h:215
@ mp2Audio
Definition: audio2.h:194
@ gsmVoice
Definition: audio2.h:189
@ g721ADPCM
Definition: audio2.h:182
@ g722_7bit
Definition: audio2.h:184
@ msgsmVoice
Definition: audio2.h:190
@ okiADPCM
Definition: audio2.h:196
@ g723_2bit
Definition: audio2.h:186
@ voxADPCM
Definition: audio2.h:197
@ pcm16Stereo
Definition: audio2.h:208
@ sx96Voice
Definition: audio2.h:199
@ g723_5bit
Definition: audio2.h:188
@ pcm16Mono
Definition: audio2.h:209
@ pcm8Mono
Definition: audio2.h:207
@ ilbcAudio
Definition: audio2.h:218
enum Encoding Encoding
Definition: audio2.h:225
static size_t toBytes(Info &info, unsigned long number)
Compute the number of bytes a given number of samples in a given audio encoding will occupy.
static void swapEncoded(Info &info, Encoded data, size_t bytes)
Optionally swap endian of encoded audio data based on the audio encoding type, and relationship to na...
static Level tolevel(float dbm)
Convert dbm power level to integer value (0-32768).
unsigned long timeout_t
Definition: audio2.h:104
static bool swapEndian(Encoding encoding, void *buffer, unsigned number)
Optionally swap endian of audio data if the encoding format endian byte order is different from the m...
static bool isEndian(Info &info)
Test if the endian byte order of the audio source description is different from the machine's native ...
enum Rate Rate
Definition: audio2.h:157
static unsigned long toSamples(Info &info, size_t bytes)
Compute byte counts of audio data into number of samples based on the audio source description used.
enum Error Error
Definition: audio2.h:274
static AudioDevice * getDevice(unsigned device=0, DeviceMode mode=PLAY)
Get a audio device object that can be used to play or record audio.
The AudioResample class is used to manage linear intropolation buffering for rate conversions.
Definition: audio2.h:751
unsigned gpos
Definition: audio2.h:754
Sample last
Definition: audio2.h:755
size_t estimate(size_t count)
AudioResample(Rate mul, Rate div)
unsigned dfact
Definition: audio2.h:753
Linear buffer
Definition: audio2.h:756
size_t process(Linear from, Linear to, size_t count)
AudioStream accesses AudioFile base class content as fixed frames of streaming linear samples.
Definition: audio2.h:1510
Linear bufferFrame
Definition: audio2.h:1515
void flush(void)
flush any unsaved buffered data to disk.
unsigned putMono(Linear buffer, unsigned frames=1)
Automatically convert and put mono linear audio data into the audio file.
bool streamable
Definition: audio2.h:1514
unsigned getStereo(Linear buffer, unsigned frames=1)
Get and automatically convert audio file data into stereo (two channel) linear audio samples.
unsigned getEncoded(Encoded address, unsigned frames=1)
Get data from the streamed file in it's native encoding.
void open(const char *name, Mode mode=modeRead, timeout_t framing=0)
Open existing audio file for streaming.
ssize_t getBuffer(Encoded data, size_t count)
Virtual for packet i/o intercept.
AudioCodec * codec
Definition: audio2.h:1512
unsigned getCount(void)
Get the number of samples expected in a frame.
AudioStream(const char *name, Info *info, bool exclusive=false, timeout_t framing=0)
Create an audio stream object and a new audio file.
unsigned putEncoded(Encoded address, unsigned frames=1)
Put data encoded in the native format of the stream file.
unsigned bufferChannels
Definition: audio2.h:1517
unsigned decSize
Definition: audio2.h:1519
void create(const char *name, Info *info, bool exclusive=false, timeout_t framing=0)
Create a new audio file for streaming.
unsigned putStereo(Linear buffer, unsigned frames=1)
Automatically convert and put stereo linear audio data into the audio file.
unsigned getMono(Linear buffer, unsigned frames=1)
Get and automatically convert audio file data into mono linear audio samples.
unsigned putEncoded(AudioCodec *codec, Encoded address, unsigned frames=1)
Stream audio data in an alternate codec into the currently opened file.
void close(void)
Close the currently open audio file for streaming.
unsigned getEncoded(AudioCodec *codec, Encoded address, unsigned frames=1)
Stream audio data from the file and convert into an alternate encoding based on the codec supplied.
unsigned bufMono(Linear buffer, unsigned count)
Automatically convert and put arbitrary linear mono data into the audio file.
ssize_t getPacket(Encoded data)
Get a packet of data from the file.
Linear decBuffer
Definition: audio2.h:1518
bool isStreamable(void)
Check if the audio file may be streamed.
AudioStream(const char *name, Mode mode=modeRead, timeout_t framing=0)
Create an audio stream object and open an existing audio file.
unsigned bufferPosition
Definition: audio2.h:1516
unsigned bufAudio(Linear samples, unsigned count, unsigned size)
AudioStream()
Create a new audiostream object.
AudioCodec * getCodec(void)
Return the codec being used if there is one.
Definition: audio2.h:1717
unsigned bufStereo(Linear buffer, unsigned count)
Automatically convert and put arbitrary linear stereo data into the audio file.
Encoded framebuf
Definition: audio2.h:1513
The AudioTone class is used to create a frame of audio encoded single or dualtones.
Definition: audio2.h:775
Rate getRate(void)
Get the sample encoding rate being used for the tone generator.
Definition: audio2.h:823
Rate rate
Definition: audio2.h:777
AudioTone(unsigned f1, unsigned f2, Level l1, Level l2, timeout_t duration=20, Rate sample=rate8khz)
Construct a dual tone frame generator.
unsigned getFrames(Linear buffer, unsigned number)
This is used to copy one or more pages of framed audio quickly to an external buffer.
bool isSilent(void)
Test if the tone generator is currently set to silence.
bool silencer
Definition: audio2.h:782
AudioTone(timeout_t duration=20, Rate rate=rate8khz)
Construct a silent tone generator of specific frame size.
size_t getSamples(void)
Get the frame size for the number of audio samples generated.
Definition: audio2.h:831
void single(unsigned freq, Level level)
Set frame to generate single tone...
Linear frame
Definition: audio2.h:779
void dual(unsigned f1, unsigned f2, Level l1, Level l2)
Set frame to generate dual tone...
virtual Linear getFrame(void)
Iterate the tone frame, and extract linear samples in native frame.
Level m1
Definition: audio2.h:781
double df1
Definition: audio2.h:780
void reset(void)
Reset the tone generator completely.
void cleanup(void)
Cleanup for virtual destructors to use.
void silence(void)
Set the frame to silent.
unsigned samples
Definition: audio2.h:778
AudioTone(unsigned freq, Level level, timeout_t duration=20, Rate sample=rate8khz)
Construct a single tone frame generator.
virtual bool isComplete(void)
See if at end of tone.
DTMFDetect is used for detecting DTMF tones in a stream of audio.
Definition: audio2.h:2204
float goertzelResult(goertzel_state_t *s)
void goertzelInit(goertzel_state_t *s, tone_detection_descriptor_t *t)
void goertzelUpdate(goertzel_state_t *s, Sample x[], int samples)
int getResult(char *data, int size)
Copy detected dtmf results into a data buffer.
int putSamples(Linear buffer, int count)
This routine is used to push linear audio data into the dtmf tone detection analysizer.
DTMFTones is used to generate a series of dtmf audio data from a "telephone" number passed as an ASCI...
Definition: audio2.h:2138
Level level
Definition: audio2.h:2143
DTMFTones(const char *digits, Level level, timeout_t duration=20, timeout_t interdigit=60)
Generate a dtmf dialer for a specified dialing string.
const char * digits
Definition: audio2.h:2142
timeout_t frametime
Definition: audio2.h:2141
bool complete
Definition: audio2.h:2144
unsigned dtmfframes
Definition: audio2.h:2140
MFTones is used to generate a series of mf audio data from a "telephone" number passed as an ASCII st...
Definition: audio2.h:2173
timeout_t frametime
Definition: audio2.h:2176
bool complete
Definition: audio2.h:2179
const char * digits
Definition: audio2.h:2177
Level level
Definition: audio2.h:2178
unsigned mfframes
Definition: audio2.h:2175
MFTones(const char *digits, Level level, timeout_t duration=20, timeout_t interdigit=60)
Generate a mf dialer for a specified dialing string.
An object that is used to sequence and extract telephony tones based on a telephony tone descriptor r...
Definition: audio2.h:2057
static tonekey_t * find(const char *tone, const char *locale=NULL)
find an entry in the teltones database.
timeout_t framing
Definition: audio2.h:2123
tonekey_t * tone
Definition: audio2.h:2120
TelTone(tonekey_t *key, Level level, timeout_t frame=20)
Create a tone sequencing object for a specific telephony tone key id.
Linear getFrame(void)
Generate and retrieve one frame of linear audio data for the telephony tone sequence being created.
tonedef_t * def
Definition: audio2.h:2121
bool complete
Definition: audio2.h:2125
Level level
Definition: audio2.h:2124
bool isComplete(void)
Check if all audio frames for this tone has been created.
static bool load(const char *pathname, const char *locale=NULL)
Load a teltones database file into memory.
unsigned count
Definition: audio2.h:2122
int hit1
Definition: audio2.h:116
float energy
Definition: audio2.h:128
int current_digits
Definition: audio2.h:132
goertzel_state_t fax_tone2nd
Definition: audio2.h:127
int lost_digits
Definition: audio2.h:134
goertzel_state_t fax_tone
Definition: audio2.h:126
int fax_hits
Definition: audio2.h:136
int hit2
Definition: audio2.h:117
int detected_digits
Definition: audio2.h:133
int current_sample
Definition: audio2.h:130
int mhit
Definition: audio2.h:120
int hit3
Definition: audio2.h:118
int hit4
Definition: audio2.h:119
float fac
Definition: audio2.h:112
float v2
Definition: audio2.h:110
float v3
Definition: audio2.h:111
unsigned char mp_priv
Definition: audio2.h:289
unsigned char mp_sync1
Definition: audio2.h:283
unsigned char mp_extend
Definition: audio2.h:297
unsigned char mp_channels
Definition: audio2.h:298
unsigned char mp_layer
Definition: audio2.h:285
unsigned char mp_ver
Definition: audio2.h:286
unsigned char mp_emp
Definition: audio2.h:294
unsigned char mp_srate
Definition: audio2.h:291
unsigned char mp_crc
Definition: audio2.h:284
unsigned char mp_sync2
Definition: audio2.h:287
unsigned char mp_original
Definition: audio2.h:295
unsigned char mp_brate
Definition: audio2.h:292
unsigned char mp_copyright
Definition: audio2.h:296
unsigned char mp_pad
Definition: audio2.h:290
unsigned char genre
Definition: audio2.h:328
float fac
Definition: audio2.h:140
Definition: audio2.h:2059
timeout_t duration
Definition: audio2.h:2061
struct _tonedef * next
Definition: audio2.h:2060
unsigned count
Definition: audio2.h:2062
unsigned short f1
Definition: audio2.h:2063
Definition: audio2.h:2066
struct _tonedef * first
Definition: audio2.h:2068
struct _tonekey * next
Definition: audio2.h:2067
struct _tonedef * last
Definition: audio2.h:2069