An abstract base class for audio decoders.
More...
#include <AudioDecoder.hpp>
An abstract base class for audio decoders.
An AudioDecoder decodes audio data into an AudioClip. Thus it can be used to read audio from files, from memory buffers, or from Android assets.
The steps to decode an audio clip are as follows:
- Author
- Mark Lindner
◆ AudioDecoder()
Construct a new AudioDecoder that will read an image from the given DataReader.
◆ ~AudioDecoder()
◆ decodeAudio()
Decode the audio clip itself.
This method must be called after decodeMetadata().
- Parameters
-
audio | The AudioClip in which to store the image data. |
- Exceptions
-
IOException | If an I/O error occurs, or if the supplied AudioClip is too small to accommodate the audio data. |
◆ decodeMetadata()
Decode the metadata for the audio clip.
This method must be called before decodeAudio().
- Exceptions
-
IOException | If an I/O error occurs. |
◆ getAudioFormat()
◆ getNumSamples()
uint32_t getNumSamples |
( |
| ) |
const |
|
inline |
Get the number of PCM samples in the audio data.
This method will return 0 if decodeMetadata() has not yet been called.
◆ readAudio()
virtual void readAudio |
( |
ccxx::DataReader * |
reader, |
|
|
AudioClip * |
audio |
|
) |
| |
|
protectedpure virtual |
This method must be implemented to perform the audio data decoding.
- Parameters
-
reader | The DataReader that the audio clip is being read from. |
audio | The AudioClip to store the audio data into. |
- Exceptions
-
IOException | If an I/O error occurs. |
Implemented in WAVAudioDecoder, and MP3AudioDecoder.
◆ readMetadata()
virtual void readMetadata |
( |
ccxx::DataReader * |
reader | ) |
|
|
protectedpure virtual |
This method must be implemented to perform the audio metadata decoding.
- Parameters
-
reader | The DataReader that the audio clip is being read from. |
- Exceptions
-
IOException | If an I/O error occurs. |
Implemented in WAVAudioDecoder, and MP3AudioDecoder.
◆ setAudioFormat()
This method should be called from readMetadata() to store the audio format information, once it has been determined.
◆ setNumSamples()
void setNumSamples |
( |
uint32_t |
numSamples | ) |
|
|
inlineprotected |
This method should be called from readMetadata() to store the number of PCM samples, once it has been determined.
The documentation for this class was generated from the following files: