FIFE
|
Class to handle the buffers of an audio file. More...
#include <soundclip.h>
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... | |
SoundDecoder * | getDecoder () const |
Returns the attached decoder. More... | |
virtual size_t | getSize () |
virtual void | load () |
virtual void | free () |
![]() | |
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 |
SoundDecoder * | m_decoder |
bool | m_deletedecoder |
std::vector< SoundBufferEntry * > | m_buffervec |
Additional Inherited Members | |
![]() | |
enum | ResourceState { RES_INVALID = 0, RES_NOT_LOADED, RES_LOADED } |
![]() | |
std::string | m_name |
IResourceLoader * | m_loader |
ResourceState | m_state |
Class to handle the buffers of an audio file.
Definition at line 58 of file soundclip.h.
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.
void FIFE::SoundClip::acquireStream | ( | uint32_t | streamid | ) |
Fills the streaming-buffers with initial data.
streamid | The 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().
|
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.
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().
|
inline |
Returns the number of buffers used by the SoundClip (only for non-streaming sound clips)
Definition at line 79 of file soundclip.h.
References m_buffervec.
Referenced by FIFE::SoundEmitter::attachSoundClip().
|
private |
Definition at line 243 of file soundclip.cpp.
|
virtual |
Implements FIFE::IResource.
Definition at line 110 of file soundclip.cpp.
References FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, m_buffervec, m_isstream, FIFE::IResource::m_state, FIFE::IResource::RES_LOADED, FIFE::IResource::RES_NOT_LOADED, and FIFE::SoundBufferEntry::usedbufs.
Referenced by ~SoundClip().
|
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().
|
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().
|
inlinevirtual |
Implements FIFE::IResource.
Definition at line 136 of file soundclip.h.
bool FIFE::SoundClip::getStream | ( | uint32_t | streamid, |
ALuint | buffer | ||
) |
Refill a processed buffer with new data.
streamid | The stream ID |
buffer | The OpenAL buffer ID |
Definition at line 196 of file soundclip.cpp.
References FIFE::BUFFER_LEN, CHECK_OPENAL_LOG, FIFE::SoundBufferEntry::deccursor, FIFE::SoundDecoder::decode(), FIFE::SoundDecoder::getALFormat(), FIFE::SoundDecoder::getBuffer(), FIFE::SoundDecoder::getBufferSize(), FIFE::SoundDecoder::getDecodedLength(), FIFE::SoundDecoder::getSampleRate(), FIFE::LogManager::LEVEL_ERROR, m_buffervec, m_decoder, FIFE::SoundDecoder::releaseBuffer(), and FIFE::SoundDecoder::setCursor().
Referenced by acquireStream(), and FIFE::SoundEmitter::updateEvent().
float FIFE::SoundClip::getStreamPos | ( | uint32_t | streamid, |
SoundPositionType | type | ||
) | const |
Gets the stream position.
Definition at line 174 of file soundclip.cpp.
References FIFE::SoundDecoder::getBitResolution(), 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::getCursor().
|
inline |
Does this SoundClip require a streaming mechanism?
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().
|
virtual |
Implements FIFE::IResource.
Definition at line 58 of file soundclip.cpp.
References FIFE::BUFFER_LEN, FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, CHECK_OPENAL_LOG, FIFE::SoundDecoder::decode(), FL_WARN, FIFE::SoundDecoder::getALFormat(), FIFE::SoundDecoder::getBuffer(), FIFE::SoundDecoder::getBufferSize(), FIFE::SoundDecoder::getSampleRate(), FIFE::LogManager::LEVEL_ERROR, FIFE::OggLoader::load(), FIFE::IResourceLoader::load(), m_buffervec, m_decoder, m_isstream, FIFE::IResource::m_loader, FIFE::IResource::m_name, FIFE::IResource::m_state, FIFE::SoundDecoder::needsStreaming(), FIFE::SoundDecoder::releaseBuffer(), FIFE::IResource::RES_LOADED, and FIFE::SoundBufferEntry::usedbufs.
Referenced by FIFE::SoundClipManager::load().
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().
|
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.
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().
|
private |
Definition at line 145 of file soundclip.h.
Referenced by acquireStream(), beginStreaming(), countBuffers(), free(), getBuffers(), getStream(), getStreamPos(), load(), quitStreaming(), and setStreamPos().
|
private |
Definition at line 143 of file soundclip.h.
Referenced by adobtDecoder(), getDecoder(), getStream(), getStreamPos(), load(), setDecoder(), setStreamPos(), and ~SoundClip().
|
private |
Definition at line 144 of file soundclip.h.
Referenced by adobtDecoder(), setDecoder(), and ~SoundClip().
|
private |
Definition at line 142 of file soundclip.h.
Referenced by free(), isStream(), and load().