blip  0.1
AudioDecoder Class Referenceabstract

An abstract base class for audio decoders. More...

#include <AudioDecoder.hpp>

Inheritance diagram for AudioDecoder:

Public Member Functions

 AudioDecoder (ccxx::DataReader *reader)
 Construct a new AudioDecoder that will read an image from the given DataReader. More...
 
virtual ~AudioDecoder ()
 Destructor. More...
 
void decodeMetadata ()
 Decode the metadata for the audio clip. More...
 
void decodeAudio (AudioClip *audio)
 Decode the audio clip itself. More...
 
const AudioFormatgetAudioFormat () const
 Get the audio format. More...
 
uint32_t getNumSamples () const
 Get the number of PCM samples in the audio data. More...
 

Protected Member Functions

virtual void readMetadata (ccxx::DataReader *reader)=0
 This method must be implemented to perform the audio metadata decoding. More...
 
virtual void readAudio (ccxx::DataReader *reader, AudioClip *audio)=0
 This method must be implemented to perform the audio data decoding. More...
 
void setAudioFormat (const AudioFormat &format)
 This method should be called from readMetadata() to store the audio format information, once it has been determined. More...
 
void setNumSamples (uint32_t numSamples)
 This method should be called from readMetadata() to store the number of PCM samples, once it has been determined. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ AudioDecoder()

AudioDecoder ( ccxx::DataReader *  reader)

Construct a new AudioDecoder that will read an image from the given DataReader.

◆ ~AudioDecoder()

~AudioDecoder ( )
virtual

Destructor.

Member Function Documentation

◆ decodeAudio()

void decodeAudio ( AudioClip audio)

Decode the audio clip itself.

This method must be called after decodeMetadata().

Parameters
audioThe AudioClip in which to store the image data.
Exceptions
IOExceptionIf an I/O error occurs, or if the supplied AudioClip is too small to accommodate the audio data.

◆ decodeMetadata()

void decodeMetadata ( )

Decode the metadata for the audio clip.

This method must be called before decodeAudio().

Exceptions
IOExceptionIf an I/O error occurs.

◆ getAudioFormat()

const AudioFormat& getAudioFormat ( ) const
inline

Get the audio format.

This method will return an invalid AudioFormat if decodeMetadata() has not yet been called.

◆ 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
readerThe DataReader that the audio clip is being read from.
audioThe AudioClip to store the audio data into.
Exceptions
IOExceptionIf 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
readerThe DataReader that the audio clip is being read from.
Exceptions
IOExceptionIf an I/O error occurs.

Implemented in WAVAudioDecoder, and MP3AudioDecoder.

◆ setAudioFormat()

void setAudioFormat ( const AudioFormat format)
inlineprotected

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: