FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::SoundDecoder Class Referenceabstract

#include <sounddecoder.h>

+ Inheritance diagram for FIFE::SoundDecoder:
+ Collaboration diagram for FIFE::SoundDecoder:

Public Member Functions

virtual ~SoundDecoder ()
 
virtual uint64_t getDecodedLength () const =0
 Returns the decoded length of the file in bytes. More...
 
bool needsStreaming () const
 A stream or not? More...
 
virtual bool setCursor (uint64_t pos)=0
 Sets the current position in the file (in bytes) More...
 
virtual bool decode (uint64_t length)=0
 Request the decoding of the next part of the stream. More...
 
virtual void * getBuffer () const =0
 Returns the next decoded buffer. More...
 
virtual uint64_t getBufferSize ()=0
 Returns the byte-size of the buffer returned by getBuffer(). More...
 
virtual void releaseBuffer ()=0
 Releases the buffer returned by getBuffer() More...
 
bool isStereo () const
 Tests if the audio data is stereo data or mono. More...
 
ALenum getALFormat () const
 Returns the openAL-Format of the audio file. More...
 
int16_t getBitResolution () const
 Returns the bit resolution. More...
 
uint64_t getSampleRate () const
 Returns the sample rate. More...
 

Protected Attributes

bool m_isstereo
 
bool m_is8bit
 
uint64_t m_samplerate
 

Detailed Description

Definition at line 41 of file sounddecoder.h.

Constructor & Destructor Documentation

◆ ~SoundDecoder()

virtual FIFE::SoundDecoder::~SoundDecoder ( )
inlinevirtual

Definition at line 44 of file sounddecoder.h.

References getDecodedLength().

Member Function Documentation

◆ decode()

virtual bool FIFE::SoundDecoder::decode ( uint64_t  length)
pure virtual

Request the decoding of the next part of the stream.

Parameters
lengthThe length of the decoded part
Returns
0 (False), if decoding was successful

Implemented in FIFE::SoundDecoderOgg.

Referenced by FIFE::SoundClip::getStream(), FIFE::SoundClip::load(), and needsStreaming().

+ Here is the caller graph for this function:

◆ getALFormat()

ALenum FIFE::SoundDecoder::getALFormat ( ) const
inline

Returns the openAL-Format of the audio file.

Definition at line 98 of file sounddecoder.h.

References m_is8bit, and m_isstereo.

Referenced by FIFE::SoundClip::getStream(), and FIFE::SoundClip::load().

+ Here is the caller graph for this function:

◆ getBitResolution()

int16_t FIFE::SoundDecoder::getBitResolution ( ) const
inline

Returns the bit resolution.

Definition at line 108 of file sounddecoder.h.

References m_is8bit.

Referenced by FIFE::SoundEmitter::getBitResolution(), FIFE::SoundClip::getStreamPos(), and FIFE::SoundClip::setStreamPos().

+ Here is the caller graph for this function:

◆ getBuffer()

virtual void* FIFE::SoundDecoder::getBuffer ( ) const
pure virtual

Returns the next decoded buffer.

The length of the buffer is returned by getBufferSize().

Implemented in FIFE::SoundDecoderOgg.

Referenced by FIFE::SoundClip::getStream(), FIFE::SoundClip::load(), and needsStreaming().

+ Here is the caller graph for this function:

◆ getBufferSize()

virtual uint64_t FIFE::SoundDecoder::getBufferSize ( )
pure virtual

Returns the byte-size of the buffer returned by getBuffer().

Implemented in FIFE::SoundDecoderOgg.

Referenced by FIFE::SoundClip::getStream(), FIFE::SoundClip::load(), and needsStreaming().

+ Here is the caller graph for this function:

◆ getDecodedLength()

virtual uint64_t FIFE::SoundDecoder::getDecodedLength ( ) const
pure virtual

Returns the decoded length of the file in bytes.

Implemented in FIFE::SoundDecoderOgg.

Referenced by FIFE::SoundEmitter::getDecodedLength(), FIFE::SoundClip::getStream(), needsStreaming(), FIFE::SoundClip::setStreamPos(), and ~SoundDecoder().

+ Here is the caller graph for this function:

◆ getSampleRate()

uint64_t FIFE::SoundDecoder::getSampleRate ( ) const
inline

Returns the sample rate.

Definition at line 114 of file sounddecoder.h.

References m_samplerate.

Referenced by FIFE::SoundEmitter::getSampleRate(), FIFE::SoundClip::getStream(), FIFE::SoundClip::getStreamPos(), FIFE::SoundClip::load(), and FIFE::SoundClip::setStreamPos().

+ Here is the caller graph for this function:

◆ isStereo()

bool FIFE::SoundDecoder::isStereo ( ) const
inline

Tests if the audio data is stereo data or mono.

Returns
Returns true if the audio data is stereo, false if mono.

Definition at line 92 of file sounddecoder.h.

References m_isstereo.

Referenced by FIFE::SoundClip::getStreamPos(), FIFE::SoundEmitter::isStereo(), and FIFE::SoundClip::setStreamPos().

+ Here is the caller graph for this function:

◆ needsStreaming()

bool FIFE::SoundDecoder::needsStreaming ( ) const
inline

A stream or not?

The decision if we decode the whole audio file in one buffer or use a kind of streaming depends on the value of MAX_KEEP_IN_MEM from soundconfig.h

Returns
Return true for a streaming decoder, false if the sound is decoded in one buffer

Definition at line 59 of file sounddecoder.h.

References decode(), getBuffer(), getBufferSize(), getDecodedLength(), FIFE::MAX_KEEP_IN_MEM, releaseBuffer(), and setCursor().

Referenced by FIFE::SoundClip::load().

+ Here is the caller graph for this function:

◆ releaseBuffer()

virtual void FIFE::SoundDecoder::releaseBuffer ( )
pure virtual

Releases the buffer returned by getBuffer()

Implemented in FIFE::SoundDecoderOgg.

Referenced by FIFE::SoundClip::getStream(), FIFE::SoundClip::load(), and needsStreaming().

+ Here is the caller graph for this function:

◆ setCursor()

virtual bool FIFE::SoundDecoder::setCursor ( uint64_t  pos)
pure virtual

Sets the current position in the file (in bytes)

Returns
True, if the positioning was successful

Implemented in FIFE::SoundDecoderOgg.

Referenced by FIFE::SoundClip::getStream(), and needsStreaming().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_is8bit

bool FIFE::SoundDecoder::m_is8bit
protected

◆ m_isstereo

bool FIFE::SoundDecoder::m_isstereo
protected

◆ m_samplerate

uint64_t FIFE::SoundDecoder::m_samplerate
protected

Definition at line 121 of file sounddecoder.h.

Referenced by getSampleRate(), and FIFE::SoundDecoderOgg::SoundDecoderOgg().


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