AudioFormat Class Reference
[Audio]

Classes | |
| struct | AudioFormatEntry |
Public Member Functions | |
| virtual | ~AudioFormat () |
| virtual int | GetChannels ()=0 |
| virtual int | GetFrequency ()=0 |
| virtual int | GetBitsPerSample ()=0 |
| virtual int | GetSize ()=0 |
| virtual int | GetPosition ()=0 |
| virtual void | SetPosition (int position)=0 |
| virtual int | CopySoundChunk (void *buffer, int bytes)=0 |
Static Public Member Functions | |
| static AudioFormat * | CreateAudioFormat (const Asset &asset) |
Static Protected Member Functions | |
| static void | RegisterAudioFormat (bool(*TestFunction)(const Asset &), AudioFormat *(*CreateFunction)(const Asset &)) |
Detailed Description
Definition at line 22 of file AudioFormat.h.
Constructor & Destructor Documentation
| virtual AudioFormat::~AudioFormat | ( | ) | [virtual] |
Destructor
Definition at line 28 of file AudioFormat.h.
Member Function Documentation
| virtual int AudioFormat::GetChannels | ( | ) | [pure virtual] |
Returns the number of channels this audio data is using 1=mono, 2=stereo
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| virtual int AudioFormat::GetFrequency | ( | ) | [pure virtual] |
Returns the frequency of the audio data in number of samples per second
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| virtual int AudioFormat::GetBitsPerSample | ( | ) | [pure virtual] |
Returns the number of bits per sample, normally 8 or 16
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| virtual int AudioFormat::GetSize | ( | ) | [pure virtual] |
Returns the total size (in bytes) of the raw audio data. To calculate the length of the data in seconds, use this: float length=((float)GetSize())/(float)(GetChannels()*GetFrequency()*GetBitsPerSample())
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| virtual int AudioFormat::GetPosition | ( | ) | [pure virtual] |
Returns the current position (in bytes) in the raw audio data stream, meaning the position from which the next call to CopySoundChunk will start outputting data. To convert this position to second, use the same formula as described for GetSize
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| virtual void AudioFormat::SetPosition | ( | int | position | ) | [pure virtual] |
Sets the current position (in bytes) in the raw audio data stream, meaning the position from which the next call to CopySoundChunk will start outputting data.
- Parameters:
-
position Position in bytes from the start
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| virtual int AudioFormat::CopySoundChunk | ( | void * | buffer, | |
| int | bytes | |||
| ) | [pure virtual] |
Copy a chunk of the raw audio data to the specified memory buffer. The requested number of bytes will be written to the buffer, unless the end of the audio data is reached. The total number of bytes written is always returned.
- Parameters:
-
buffer Buffer to write data to. Must be large enough to hold the requested number of bytes bytes Number of bytes to write. The actual number of bytes written may be less than this if the end of the data is reached.
Implemented in AudioFormat_MOD, AudioFormat_OGG, and AudioFormat_YM.
| AudioFormat * AudioFormat::CreateAudioFormat | ( | const Asset & | asset | ) | [static] |
Definition at line 23 of file AudioFormat.cpp.
| void AudioFormat::RegisterAudioFormat | ( | bool(*)(const Asset &) | TestFunction, | |
| AudioFormat *(*)(const Asset &) | CreateFunction | |||
| ) | [static, protected] |
Definition at line 12 of file AudioFormat.cpp.
Reproduction/republishing of any material on this site without permission is strictly prohibited.
