Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Member Functions | List of all members
Mezzanine::Audio::iDecoder Class Referenceabstract

This is an interface class for the decoding of audio from a stream. More...

#include <decoder.h>

Public Member Functions

 iDecoder ()
 Class constructor.
 
virtual ~iDecoder ()
 Class destructor.
 
virtual Audio::BitConfig GetBitConfiguration () const =0
 Gets the Bit Configuration used to decode the audio stream. More...
 
virtual UInt32 GetCompressedSize () const =0
 Gets the size of the encoded audio source in use. More...
 
virtual UInt32 GetCurrentCompressedPosition () const =0
 Gets the sounds current position in the encoded audio source. More...
 
virtual UInt32 GetCurrentPosition () const =0
 Gets the sounds current position in the decoded audio source. More...
 
virtual Real GetCurrentTime () const =0
 Gets the current time position in the stream. More...
 
virtual Audio::Encoding GetEncoding () const =0
 Gets the encoding supported by this decoder. More...
 
virtual UInt32 GetFrequency () const =0
 Gets the frequency used to decode the audio stream. More...
 
virtual UInt32 GetSampleSize () const
 Gets the sample size based on the decoders current configuration. More...
 
virtual Resource::DataStreamPtr GetStream () const =0
 Gets the stream being decoded. More...
 
virtual UInt32 GetTotalSize () const =0
 Gets the size of the decoded audio source in use. More...
 
virtual Real GetTotalTime () const =0
 Gets the length of the stream in seconds. More...
 
virtual Boole IsEndOfStream () const =0
 Checks to see if the decode has reached the end of the stream. More...
 
virtual Boole IsSeekingSupported ()=0
 Gets whether or not seeking is supported. More...
 
virtual Boole IsValid ()=0
 Gets whether or not the decoder is ready to be used. More...
 
virtual UInt32 ReadAudioData (void *Output, UInt32 Amount)=0
 Reads from the audio stream and writes what is read to a buffer. More...
 
virtual Boole Seek (const Real Seconds, const Boole Relative)=0
 Moves the current time position in the stream. More...
 
virtual Boole SetPosition (Int32 Position, const Boole Relative)=0
 Sets the position (in bytes) of the stream. More...
 

Protected Member Functions

virtual void ClearStreamErrors ()=0
 Clears EoF and Fail bits from the stream if they are present. More...
 

Detailed Description

This is an interface class for the decoding of audio from a stream.

Definition at line 59 of file decoder.h.

Member Function Documentation

virtual void Mezzanine::Audio::iDecoder::ClearStreamErrors ( )
protectedpure virtual

Clears EoF and Fail bits from the stream if they are present.

Remarks
This should only check for the EoF bit, and if found clear EoF and Fail bits. Both of these can be encountered when the stream reaches EoF and isn't an error condition when streaming audio.
virtual Audio::BitConfig Mezzanine::Audio::iDecoder::GetBitConfiguration ( ) const
pure virtual

Gets the Bit Configuration used to decode the audio stream.

Returns
Returns the Bit Configuration currently being used to decode this stream.
virtual UInt32 Mezzanine::Audio::iDecoder::GetCompressedSize ( ) const
pure virtual

Gets the size of the encoded audio source in use.

Returns
Returns the size of the encoded audio source.
virtual UInt32 Mezzanine::Audio::iDecoder::GetCurrentCompressedPosition ( ) const
pure virtual

Gets the sounds current position in the encoded audio source.

Returns
Returns the current position in the encoded audio source in bytes.
virtual UInt32 Mezzanine::Audio::iDecoder::GetCurrentPosition ( ) const
pure virtual

Gets the sounds current position in the decoded audio source.

Returns
Returns the current position in the decoded audio source in bytes.
virtual Real Mezzanine::Audio::iDecoder::GetCurrentTime ( ) const
pure virtual

Gets the current time position in the stream.

Returns
Returns the current position in the stream in seconds.
virtual Audio::Encoding Mezzanine::Audio::iDecoder::GetEncoding ( ) const
pure virtual

Gets the encoding supported by this decoder.

Returns
Returns an Audio::Encoding value representing the encoding supported by this decoder.
virtual UInt32 Mezzanine::Audio::iDecoder::GetFrequency ( ) const
pure virtual

Gets the frequency used to decode the audio stream.

Returns
Returns the frequency (or sample rate) currently being used to decode this stream.
virtual UInt32 Mezzanine::Audio::iDecoder::GetSampleSize ( ) const
inlinevirtual

Gets the sample size based on the decoders current configuration.

Returns
Returns a UInt32 representing the size of a single sample from the underlying stream.

Definition at line 104 of file decoder.h.

virtual Resource::DataStreamPtr Mezzanine::Audio::iDecoder::GetStream ( ) const
pure virtual

Gets the stream being decoded.

Returns
Returns a shared pointer to the DataStream being decoded.
virtual UInt32 Mezzanine::Audio::iDecoder::GetTotalSize ( ) const
pure virtual

Gets the size of the decoded audio source in use.

Returns
Returns the size of the decoded audio source.
virtual Real Mezzanine::Audio::iDecoder::GetTotalTime ( ) const
pure virtual

Gets the length of the stream in seconds.

Returns
Returns the total amount of time needed to playback the sound in seconds.
virtual Boole Mezzanine::Audio::iDecoder::IsEndOfStream ( ) const
pure virtual

Checks to see if the decode has reached the end of the stream.

Remarks
Multiple decoders may use the same stream, and when this happens the actual underlying stream position may be altered multiple times to varying positions in the stream. Because of this, checking the underlying stream directly may not give you an accurate idea of if this decoders point in the stream has reached it's end. That is what this function is meant to address.
Returns
Returns true if all of the data in the stream has been decoded, false otherwise.
virtual Boole Mezzanine::Audio::iDecoder::IsSeekingSupported ( )
pure virtual

Gets whether or not seeking is supported.

Returns
Returns true if you can skip to a specific point in the stream, false if you are stuck waiting.
virtual Boole Mezzanine::Audio::iDecoder::IsValid ( )
pure virtual

Gets whether or not the decoder is ready to be used.

Note
On failure the issue likely lies with the stream being an improper format/encoding.
Returns
Returns true if this decoder is ready for playback, false otherwise.
virtual UInt32 Mezzanine::Audio::iDecoder::ReadAudioData ( void *  Output,
UInt32  Amount 
)
pure virtual

Reads from the audio stream and writes what is read to a buffer.

Parameters
OutputThe buffer to write to when reading the audio stream.
AmountThe number of bytes desired to be read from the audio stream.
Returns
Returns the number of bytes successfully read from the audio stream.
virtual Boole Mezzanine::Audio::iDecoder::Seek ( const Real  Seconds,
const Boole  Relative 
)
pure virtual

Moves the current time position in the stream.

Parameters
SecondsThe position in seconds to move to in the stream.
RelativeWhether or not to move from the current position. If false this will seek from the beginning.
Returns
Returns true if the position was successfully moved, false otherwise.
virtual Boole Mezzanine::Audio::iDecoder::SetPosition ( Int32  Position,
const Boole  Relative 
)
pure virtual

Sets the position (in bytes) of the stream.

Parameters
PositionThe number of bytes to move(if relative) or the actual position in the stream to set.
RelativeWhether or not to move from the current position. If false this will set from the beginning.
Returns
Returns true if the position was successfully set, false otherwise.

The documentation for this class was generated from the following file: