#include <audio.h>
Inheritance diagram for Audio:
Public Types | |
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 } |
typedef enum Rate | Rate |
typedef enum Encoding | Encoding |
typedef enum Format | Format |
typedef enum Error | Error |
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) |
Classes | |
class | Info |
typedef enum Rate Audio::Rate |
typedef enum Encoding Audio::Encoding |
typedef enum Format Audio::Format |
typedef enum Error Audio::Error |
enum Audio::Rate |
enum Audio::Encoding |
enum Audio::Format |
enum Audio::Error |
static bool Audio::isMono | ( | Encoding | encoding | ) | [static] |
static bool Audio::isStereo | ( | Encoding | encoding | ) | [static] |
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.
encoding | The encoding type to get the frame size for. | |
samples | Reserved. Use zero. |
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.
encoding | The encoding to calculate the frame sample count for. |
static unsigned long Audio::toSamples | ( | Encoding | encoding, | |
size_t | bytes | |||
) | [static] |
static unsigned long Audio::toBytes | ( | Encoding | encoding, | |
unsigned long | samples | |||
) | [static] |
static void Audio::fill | ( | unsigned char * | addr, | |
int | samples, | |||
Encoding | encoding | |||
) | [static] |