FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 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
enum  ResourceState { RES_INVALID = 0, RES_NOT_LOADED, RES_LOADED }
 
- 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 234 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 187 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)
inline

Adopts a decoder to use so DONT delete it.

Definition at line 124 of file soundclip.h.

References m_decoder, and m_deletedecoder.

uint32_t FIFE::SoundClip::beginStreaming ( )

Starts streaming the soundclip.

Returns
Returns the streamid

Definition at line 136 of file soundclip.cpp.

References FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, CHECK_OPENAL_LOG, 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
inline

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

Returns
Returns the number of buffers.

Definition at line 79 of file soundclip.h.

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 243 of file soundclip.cpp.

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

Returns the array of buffers for queuing.

Definition at line 86 of file soundclip.h.

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
inline

Returns the attached decoder.

Definition at line 132 of file soundclip.h.

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:

virtual size_t FIFE::SoundClip::getSize ( )
inlinevirtual

Implements FIFE::IResource.

Definition at line 136 of file soundclip.h.

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

Does this SoundClip require a streaming mechanism?

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

Definition at line 70 of file soundclip.h.

References m_isstream.

Referenced by FIFE::SoundEmitter::attachSoundClip(), FIFE::SoundEmitter::getCursor(), FIFE::SoundEmitter::play(), FIFE::SoundEmitter::reset(), FIFE::SoundEmitter::setCursor(), FIFE::SoundEmitter::setLooping(), and FIFE::SoundEmitter::stop().

+ Here is the caller graph for this function:

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

Quits Streaming.

Definition at line 227 of file soundclip.cpp.

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

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

+ Here is the caller graph for this function:

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

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

Definition at line 128 of file soundclip.h.

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 149 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::updateEvent().

+ 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 144 of file soundclip.h.

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

bool FIFE::SoundClip::m_isstream
private

Definition at line 142 of file soundclip.h.

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


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