Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <OpenALStreamingSound.h>
Public Member Functions | |
OpenALStreamingSound (const std::string &name, VSFileSystem::VSFileType type=VSFileSystem::UnknownFile, unsigned int bufferSamples=0) throw () | |
virtual | ~OpenALStreamingSound () |
ALBufferHandle | readAndFlip () throw (Exception) |
void | unqueueBuffer (ALBufferHandle buffer) throw (Exception) |
void | flushBuffers () throw () |
Timestamp | getTimeBase () const throw () |
void | seek (double position) throw (Exception) |
![]() | |
virtual | ~SimpleSound () |
VSFileSystem::VSFileType | getType () const |
![]() | |
virtual | ~Sound () |
const std::string & | getName () const throw () |
const Format & | getFormat () const throw () |
bool | isLoaded () const throw () |
bool | isLoading () const throw () |
bool | isStreaming () const throw () |
void | load (bool wait=true) throw (Exception) |
void | unload () throw () |
Protected Member Functions | |
virtual void | loadImpl (bool wait) throw (Exception) |
virtual void | unloadImpl () throw () |
![]() | |
SimpleSound (const std::string &name, VSFileSystem::VSFileType type=VSFileSystem::UnknownFile, bool streaming=false) throw () | |
bool | isStreamLoaded () const |
void | loadStream () throw (Exception) |
void | closeStream () throw (ResourceNotLoadedException) |
SharedPtr< Stream > | getStream () const throw (ResourceNotLoadedException) |
void | readBuffer (SoundBuffer &buffer) throw (Exception) |
virtual void | abortLoad () throw () |
![]() | |
Sound (const std::string &name, bool streaming) throw () | |
Format & | getFormat () throw () |
virtual void | onLoaded (bool success) throw () |
virtual void | waitLoad () throw (Exception) |
Additional Inherited Members | |
![]() | |
struct Audio::Sound::Flags | flags |
OpenAL Streaming Sound implementation class
A package-private function is called to fill buffers for a configurable amount of buffer time - whenever a source is playing this sound, this has to happen regularly.
Definition at line 34 of file OpenALStreamingSound.h.
Audio::OpenALStreamingSound::OpenALStreamingSound | ( | const std::string & | name, |
VSFileSystem::VSFileType | type = VSFileSystem::UnknownFile , |
||
unsigned int | bufferSamples = 0 |
||
) | |||
throw | ( | ||
) |
Internal constructor used by derived classes
name | the resource's name |
type | the resource's type |
bufferSamples | how many samples a single buffer should hold. remember double buffering is used, so this holds the number of samples below which a read would be triggered. |
Definition at line 29 of file OpenALStreamingSound.cpp.
References AL_NULL_BUFFER, i, and NUM_BUFFERS.
|
virtual |
Definition at line 39 of file OpenALStreamingSound.cpp.
void Audio::OpenALStreamingSound::flushBuffers | ( | ) | ||
throw | ( | |||
) |
Reset the buffer queue
Definition at line 94 of file OpenALStreamingSound.cpp.
References NUM_BUFFERS.
Timestamp Audio::OpenALStreamingSound::getTimeBase | ( | ) | const | |
throw | ( | |||
) |
Get the time base of the stream
Definition at line 166 of file OpenALStreamingSound.cpp.
Load the resource
Implements Audio::Sound.
Definition at line 43 of file OpenALStreamingSound.cpp.
References buffer, checkAlError, clearAlError, e, max(), and NUM_BUFFERS.
ALBufferHandle Audio::OpenALStreamingSound::readAndFlip | ( | ) | ||
throw | ( | Exception | ||
) |
Keep buffers going.
EndOfStreamException | when there's no more data to feed from the stream. You may seek the stream and keep going, for instance, for a looping stream. Any other exception would be fatal. |
Definition at line 115 of file OpenALStreamingSound.cpp.
References AL_NULL_BUFFER, Audio::__impl::OpenAL::asALFormat(), buffer, checkAlError, clearAlError, UnitUtil::getName(), and NUM_BUFFERS.
Referenced by Audio::OpenALRenderableStreamingSource::queueALBuffers().
void Audio::OpenALStreamingSound::seek | ( | double | position) | ||
throw | ( | Exception | |||
) |
Set the stream's position, in seconds
Definition at line 157 of file OpenALStreamingSound.cpp.
References UnitUtil::getName().
Referenced by Audio::OpenALRenderableStreamingSource::queueALBuffers().
|
protectedvirtual |
Unload the resource.
Implements Audio::Sound.
Definition at line 106 of file OpenALStreamingSound.cpp.
References AL_NULL_BUFFER.
void Audio::OpenALStreamingSound::unqueueBuffer | ( | ALBufferHandle | buffer) | ||
throw | ( | Exception | |||
) |
Notify a dequeued buffer
Definition at line 149 of file OpenALStreamingSound.cpp.
References buffer, and NUM_BUFFERS.
Referenced by Audio::OpenALRenderableStreamingSource::queueALBuffers().