#include <audio.h>
Inheritance diagram for Audio:
typedef enum Encoding Audio::Encoding |
typedef enum Error Audio::Error |
typedef enum Format Audio::Format |
typedef enum Rate Audio::Rate |
enum Audio::Encoding |
enum Audio::Error |
enum Audio::Format |
enum Audio::Rate |
static void Audio::fill | ( | unsigned char * | addr, | |
int | samples, | |||
Encoding | encoding | |||
) | [static] |
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 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 bool Audio::isMono | ( | Encoding | encoding | ) | [static] |
static bool Audio::isStereo | ( | Encoding | encoding | ) | [static] |
static unsigned long Audio::toBytes | ( | Encoding | encoding, | |
unsigned long | samples | |||
) | [static] |
static unsigned long Audio::toSamples | ( | Encoding | encoding, | |
size_t | bytes | |||
) | [static] |