FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
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 | 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... | |
SoundDecoder * | getDecoder () 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 |
SoundDecoder * | m_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 |
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 58 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 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().
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.
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().
uint32_t FIFE::SoundClip::countBuffers | ( | ) | const |
Returns the number of buffers used by the SoundClip (only for non-streaming sound clips)
Definition at line 146 of file soundclip.cpp.
References m_buffervec.
Referenced by FIFE::SoundEmitter::attachSoundClip().
|
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.
|
virtual |
Implements FIFE::IResource.
Definition at line 118 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().
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().
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().
|
virtual |
Implements FIFE::IResource.
Definition at line 287 of file soundclip.cpp.
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 228 of file soundclip.cpp.
References FIFE::_log, 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::update().
float FIFE::SoundClip::getStreamPos | ( | uint32_t | streamid, |
SoundPositionType | type | ||
) | const |
Gets the stream position.
Definition at line 206 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.
bool FIFE::SoundClip::isStream | ( | ) | const |
Does this SoundClip require a streaming mechanism?
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().
|
virtual |
Implements FIFE::IResource.
Definition at line 67 of file soundclip.cpp.
References FIFE::_log, 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 260 of file soundclip.cpp.
References FIFE::BUFFER_NUM, FIFE::SoundBufferEntry::buffers, and m_buffervec.
Referenced by FIFE::SoundEmitter::detachSoundClip(), and FIFE::SoundEmitter::reset().
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.
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().
|
private |
Definition at line 144 of file soundclip.h.
Referenced by acquireStream(), beginStreaming(), countBuffers(), endStreaming(), free(), getBuffers(), getStream(), getStreamPos(), load(), quitStreaming(), and setStreamPos().
|
private |
Definition at line 141 of file soundclip.h.
Referenced by adobtDecoder(), getDecoder(), getStream(), getStreamPos(), load(), setDecoder(), setStreamPos(), and ~SoundClip().
|
private |
Definition at line 143 of file soundclip.h.
Referenced by adobtDecoder(), setDecoder(), and ~SoundClip().
|
private |
Definition at line 139 of file soundclip.h.
Referenced by free(), isStream(), and load().