FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::SoundClip Class Reference

Class to handle the buffers of an audio file. More...

#include <soundclip.h>

+ Inheritance diagram for FIFE::SoundClip:
+ Collaboration diagram for FIFE::SoundClip:

Public Member Functions

 SoundClip (IResourceLoader *loader=0)
 
 SoundClip (const std::string &name, IResourceLoader *loader=0)
 
 ~SoundClip ()
 
bool isStream () const
 Does this SoundClip require a streaming mechanism? More...
 
uint32_t countBuffers () const
 Returns the number of buffers used by the SoundClip (only for non-streaming sound clips) More...
 
ALuint * getBuffers (uint32_t streamid=0) const
 Returns the array of buffers for queuing. More...
 
uint32_t beginStreaming ()
 Starts streaming the soundclip. More...
 
void acquireStream (uint32_t streamid)
 Fills the streaming-buffers with initial data. More...
 
bool setStreamPos (uint32_t streamid, SoundPositionType type, float value)
 Sets the stream position. More...
 
float getStreamPos (uint32_t streamid, SoundPositionType type) const
 Gets the stream position. More...
 
bool getStream (uint32_t streamid, ALuint buffer)
 Refill a processed buffer with new data. More...
 
void quitStreaming (uint32_t streamid)
 Quits Streaming. More...
 
void endStreaming (uint32_t streamid)
 Ends streaming, invalidate also the stream id. More...
 
void adobtDecoder (SoundDecoder *decoder)
 Adopts a decoder to use so DONT delete it. More...
 
void setDecoder (SoundDecoder *decoder)
 Sets the decoder to use so DONT delete it before this SoundClip is done with it. More...
 
SoundDecodergetDecoder () const
 Returns the attached decoder. More...
 
virtual size_t getSize ()
 
virtual void load ()
 
virtual void free ()
 
- Public Member Functions inherited from FIFE::IResource
 IResource (const std::string &name, IResourceLoader *loader=0)
 
virtual ~IResource ()
 
virtual const std::string & getName ()
 
ResourceHandle getHandle ()
 
virtual ResourceState getState ()
 
virtual void setState (const ResourceState &state)
 

Private Member Functions

std::string createUniqueClipName ()
 

Private Attributes

bool m_isStream
 
SoundDecoderm_decoder
 
bool m_deleteDecoder
 
std::vector< SoundBufferEntry * > m_buffervec
 

Additional Inherited Members

- Public Types inherited from FIFE::IResource
- Protected Attributes inherited from FIFE::IResource
std::string m_name
 
IResourceLoaderm_loader
 
ResourceState m_state
 

Detailed Description

Class to handle the buffers of an audio file.

Definition at line 58 of file soundclip.h.

Constructor & Destructor Documentation

FIFE::SoundClip::SoundClip ( IResourceLoader loader = 0)

Definition at line 42 of file soundclip.cpp.

FIFE::SoundClip::SoundClip ( const std::string &  name,
IResourceLoader loader = 0 
)

Definition at line 50 of file soundclip.cpp.

FIFE::SoundClip::~SoundClip ( )

Definition at line 58 of file soundclip.cpp.

References free(), m_decoder, and m_deleteDecoder.

Member Function Documentation

void FIFE::SoundClip::acquireStream ( uint32_t  streamid)

Fills the streaming-buffers with initial data.

Parameters
streamidThe stream ID

Definition at line 219 of file soundclip.cpp.

References FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, getStream(), and m_buffervec.

Referenced by FIFE::SoundEmitter::attachSoundClip(), and FIFE::SoundEmitter::setCursor().

+ Here is the caller graph for this function:

void FIFE::SoundClip::adobtDecoder ( SoundDecoder decoder)

Adopts a decoder to use so DONT delete it.

Definition at line 273 of file soundclip.cpp.

References m_decoder, and m_deleteDecoder.

uint32_t FIFE::SoundClip::beginStreaming ( )

Starts streaming the soundclip.

Returns
Returns the streamid

Definition at line 154 of file soundclip.cpp.

References FIFE::_log, FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, CHECK_OPENAL_LOG, FIFE::SoundBufferEntry::deccursor, FIFE::LogManager::LEVEL_ERROR, m_buffervec, and FIFE::SoundBufferEntry::usedbufs.

Referenced by FIFE::SoundEmitter::attachSoundClip().

+ Here is the caller graph for this function:

uint32_t FIFE::SoundClip::countBuffers ( ) const

Returns the number of buffers used by the SoundClip (only for non-streaming sound clips)

Returns
Returns the number of buffers.

Definition at line 146 of file soundclip.cpp.

References m_buffervec.

Referenced by FIFE::SoundEmitter::attachSoundClip().

+ Here is the caller graph for this function:

std::string FIFE::SoundClip::createUniqueClipName ( )
private

Definition at line 291 of file soundclip.cpp.

void FIFE::SoundClip::endStreaming ( uint32_t  streamid)

Ends streaming, invalidate also the stream id.

Definition at line 267 of file soundclip.cpp.

References m_buffervec.

void FIFE::SoundClip::free ( )
virtual
ALuint * FIFE::SoundClip::getBuffers ( uint32_t  streamid = 0) const

Returns the array of buffers for queuing.

Definition at line 150 of file soundclip.cpp.

References m_buffervec.

Referenced by FIFE::SoundEmitter::attachSoundClip(), and FIFE::SoundEmitter::setCursor().

+ Here is the caller graph for this function:

SoundDecoder * FIFE::SoundClip::getDecoder ( ) const

Returns the attached decoder.

Definition at line 283 of file soundclip.cpp.

References m_decoder.

Referenced by FIFE::SoundEmitter::getBitResolution(), FIFE::SoundEmitter::getDecodedLength(), FIFE::SoundEmitter::getSampleRate(), and FIFE::SoundEmitter::isStereo().

+ Here is the caller graph for this function:

size_t FIFE::SoundClip::getSize ( )
virtual

Implements FIFE::IResource.

Definition at line 287 of file soundclip.cpp.

bool FIFE::SoundClip::getStream ( uint32_t  streamid,
ALuint  buffer 
)
float FIFE::SoundClip::getStreamPos ( uint32_t  streamid,
SoundPositionType  type 
) const
bool FIFE::SoundClip::isStream ( ) const

Does this SoundClip require a streaming mechanism?

Returns
Returns true if streaming is required, false if not.

Definition at line 142 of file soundclip.cpp.

References m_isStream.

Referenced by FIFE::SoundEmitter::attachSoundClip(), FIFE::SoundEmitter::detachSoundClip(), FIFE::SoundEmitter::getCursor(), FIFE::SoundEmitter::reset(), FIFE::SoundEmitter::rewind(), FIFE::SoundEmitter::setCursor(), FIFE::SoundEmitter::setLooping(), and FIFE::SoundEmitter::update().

+ Here is the caller graph for this function:

void FIFE::SoundClip::quitStreaming ( uint32_t  streamid)

Quits Streaming.

Definition at line 260 of file soundclip.cpp.

References FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, and m_buffervec.

Referenced by FIFE::SoundEmitter::detachSoundClip(), and FIFE::SoundEmitter::reset().

+ Here is the caller graph for this function:

void FIFE::SoundClip::setDecoder ( SoundDecoder decoder)

Sets the decoder to use so DONT delete it before this SoundClip is done with it.

Definition at line 278 of file soundclip.cpp.

References m_decoder, and m_deleteDecoder.

bool FIFE::SoundClip::setStreamPos ( uint32_t  streamid,
SoundPositionType  type,
float  value 
)

Sets the stream position.

Returns
True if position is invalid (EOF has been reached)

Definition at line 181 of file soundclip.cpp.

References FIFE::SoundDecoder::getBitResolution(), FIFE::SoundDecoder::getDecodedLength(), FIFE::SoundDecoder::getSampleRate(), FIFE::SoundDecoder::isStereo(), m_buffervec, m_decoder, FIFE::SD_BYTE_POS, FIFE::SD_SAMPLE_POS, and FIFE::SD_TIME_POS.

Referenced by FIFE::SoundEmitter::setCursor(), and FIFE::SoundEmitter::update().

+ Here is the caller graph for this function:

Member Data Documentation

std::vector<SoundBufferEntry*> FIFE::SoundClip::m_buffervec
private
SoundDecoder* FIFE::SoundClip::m_decoder
private
bool FIFE::SoundClip::m_deleteDecoder
private

Definition at line 143 of file soundclip.h.

Referenced by adobtDecoder(), setDecoder(), and ~SoundClip().

bool FIFE::SoundClip::m_isStream
private

Definition at line 139 of file soundclip.h.

Referenced by free(), isStream(), and load().


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