NAME
Audio - Generic audio class to hold master data types and various useful class encapsulated friend functions as per GNU Common C++ 2 coding standard.Master audio class.
SYNOPSIS
#include <audio.h>
Inherited by AudioCodec, AudioFile, AudioSample, and CDAudio.
Public Types
typedef enum Rate Rate
typedef enum Encoding Encoding
typedef enum Format Format
typedef enum Error Error
rateUnknown
rate6khz = 6000
rate8khz = 8000
rate44khz = 44100
unknownEncoding = 0
g721ADPCM
g722Audio
g722_7bit
g722_6bit
g723_3bit
g723_5bit
gsmVoice
mulawAudio
alawAudio
okiADPCM
voxADPCM
cdaStereo
cdaMono
pcm8Stereo
pcm8Mono
pcm16Stereo
pcm16Mono
pcm32Stereo
pcm32Mono
raw
sun
riff
wave
errSuccess = 0
errReadLast
errNotOpened
errEndOfFile
errStartOfFile
errRateInvalid
errEncodingInvalid
errReadInterrupt
errWriteInterrupt
errReadFailure
errWriteFailure
errReadIncomplete
errWriteIncomplete
errRequestInvalid
errTOCFailed
errStatFailed
errInvalidTrack
errPlaybackFailed
errNotPlaying
errNoCodec
enum Rate { rateUnknown, rate6khz = 6000, rate8khz = 8000, rate44khz = 44100 }
enum Encoding { unknownEncoding = 0, g721ADPCM, g722Audio, g722_7bit, g722_6bit, g723_3bit, g723_5bit, gsmVoice, mulawAudio, alawAudio, okiADPCM, voxADPCM, cdaStereo, cdaMono, pcm8Stereo, pcm8Mono, pcm16Stereo, pcm16Mono, pcm32Stereo, pcm32Mono }
enum Format { raw, sun, riff, wave }
enum Error { errSuccess = 0, errReadLast, errNotOpened, errEndOfFile, errStartOfFile, errRateInvalid, errEncodingInvalid, errReadInterrupt, errWriteInterrupt, errReadFailure, errWriteFailure, errReadIncomplete, errWriteIncomplete, errRequestInvalid, errTOCFailed, errStatFailed, errInvalidTrack, errPlaybackFailed, errNotPlaying, errNoCodec }
Static Public Member Functions
static bool isMono (Encoding encoding)
static bool isStereo (Encoding encoding)
static Rate getRate (Encoding encoding)
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 integer. static int getCount (Encoding encoding)
Returns the number of samples in all channels for a frame in the given encoding. static unsigned long toSamples (Encoding encoding, size_t bytes)
static unsigned long toBytes (Encoding encoding, unsigned long samples)
static void fill (unsigned char *addr, int samples, Encoding encoding)
Detailed Description
Generic audio class to hold master data types and various useful class encapsulated friend functions as per GNU Common C++ 2 coding standard.Master audio class.
Author:
David Sugar <[email protected]>
Member Function Documentation
static int Audio::getCount (Encoding encoding) [static]
Returns the number of samples in all channels for a frame in the given encoding.
For example, pcm32Stereo has a frame size of 8 bytes: Note that different codecs have different definitions of a frame - for example, compressed encodings have a rather large frame size relative to the sample size due to the way bytes are fed to the decompression engine.
Parameters:
encoding The encoding to calculate the frame sample count for.
Returns:
samples The number of samples in a frame of the given encoding.
static int Audio::getFrame (Encoding encoding, int samples = 0) [static]
Returns the number of bytes in a sample frame for the given encoding type, rounded up to the nearest integer.
A frame is defined as the minimum number of bytes necessary to create a point or points in the output waveform for all output channels. For example, 16-bit mono PCM has a frame size of two (because those two bytes constitute a point in the output waveform). GSM has it's own definition of a frame which involves decompressing a sequence of bytes to determine the final points on the output waveform. The minimum number of bytes you can feed to the decompression engine is 32.5 (260 bits), so this function will return 33 (because we round up) given an encoding type of GSM. Other compressed encodings will return similar results. Be prepared to deal with nonintuitive return values for rare encodings.
Parameters:
encoding The encoding type to get the frame size for.
samples Reserved. Use zero.
Returns:
The number of bytes in a frame for the given encoding.
Author
Generated automatically by Doxygen for ccAudio from the source code.