openalpp::StreamUpdater Class Reference

Inheritance diagram for openalpp::StreamUpdater:

openalpp::DeviceUpdater openalpp::FileStreamUpdater

List of all members.

Public Member Functions

 StreamUpdater (ALuint buffer1, ALuint buffer2, ALenum format, unsigned int frequency)
void addSource (ALuint sourcename)
void removeSource (ALuint sourcename)
virtual void seek (float time_s)
void hold ()
void release ()
bool update (void *buffer, unsigned int length)
virtual void stop ()
bool shouldStop () const
void cancelCleanup ()
void setSleepTime (int mseconds)

Protected Member Functions

void processRemovedSources ()
void processAddedSources ()
virtual ~StreamUpdater ()
void waitForPlay ()
void sleep ()

Protected Attributes

ALuint buffers_ [2]
ALenum format_
unsigned int frequency_
std::vector< ALuint > sources_
std::vector< ALuint > newsources_
std::vector< ALuint > removesources_
bool stoprunning_
OpenThreads::Mutex runmutex_
int sleepTime_
Event m_playEvent


Detailed Description

Base class for (threaded) updating of stream buffers.

Constructor & Destructor Documentation

openalpp::StreamUpdater::StreamUpdater ( ALuint  buffer1,
ALuint  buffer2,
ALenum  format,
unsigned int  frequency 
)

Constructor.

Parameters:
buffer1 and...
buffer2 are the buffers used for double-buffered streaming.
format is the (OpenAL) format of the sound.
frequency is the frequency of the sound.

virtual openalpp::StreamUpdater::~StreamUpdater (  )  [protected, virtual]

Destructor.


Member Function Documentation

void openalpp::StreamUpdater::addSource ( ALuint  sourcename  ) 

Add a source to the stream.

Parameters:
sourcename is the OpenAL name of the source.

void openalpp::StreamUpdater::removeSource ( ALuint  sourcename  ) 

Remove a source from the stream.

Parameters:
sourcename is the OpenAL name of the source.

virtual void openalpp::StreamUpdater::seek ( float  time_s  )  [inline, virtual]

Seeks to specified time

Reimplemented in openalpp::FileStreamUpdater.

void openalpp::StreamUpdater::hold (  )  [inline]

Tell this StreamUpdater thread to wait until some thread call its release

void openalpp::StreamUpdater::release (  )  [inline]

Release this thread.

bool openalpp::StreamUpdater::update ( void *  buffer,
unsigned int  length 
)

Update the stream. I.e. add new data to play.

Parameters:
buffer is a pointer to sound data.
length is the length of the sound data (in bytes).
Returns:
done flag. I.e. stoprunning_.

virtual void openalpp::StreamUpdater::stop (  )  [inline, virtual]

Tell the thread to stop executing, also release it if its waiting to play.

Returns:
nothing

Reimplemented in openalpp::DeviceUpdater.

bool openalpp::StreamUpdater::shouldStop (  )  const [inline]

Returns:
true if the stop method has been called

void openalpp::StreamUpdater::cancelCleanup (  ) 

Inherited from Thread. Is called after run() finishes, and deletes this.

void openalpp::StreamUpdater::setSleepTime ( int  mseconds  )  [inline]

void openalpp::StreamUpdater::processRemovedSources (  )  [protected]

Remove any sources that the user has scheduled for removal.

void openalpp::StreamUpdater::processAddedSources (  )  [protected]

Add any sources that the user has scheduled for adding.

void openalpp::StreamUpdater::waitForPlay (  )  [inline, protected]

Wait for someone to call release. This indicates that we should start playing a stream

void openalpp::StreamUpdater::sleep (  )  [inline, protected]


Member Data Documentation

ALuint openalpp::StreamUpdater::buffers_[2] [protected]

Names of the buffers to update.

ALenum openalpp::StreamUpdater::format_ [protected]

OpenAL format of the sound data.

unsigned int openalpp::StreamUpdater::frequency_ [protected]

Frequency of the sound data.

std::vector<ALuint> openalpp::StreamUpdater::sources_ [protected]

Source to update.

std::vector<ALuint> openalpp::StreamUpdater::newsources_ [protected]

std::vector<ALuint> openalpp::StreamUpdater::removesources_ [protected]

bool openalpp::StreamUpdater::stoprunning_ [protected]

Flag for when Run should stop running..

OpenThreads::Mutex openalpp::StreamUpdater::runmutex_ [protected]

Mutex for stoprunning_.

int openalpp::StreamUpdater::sleepTime_ [protected]

Time to sleep in run method, i.e. sleeptime to reduce CPU usage

Event openalpp::StreamUpdater::m_playEvent [protected]

Event signalling that source is playing


The documentation for this class was generated from the following file:
Generated on Mon Nov 12 03:32:35 2007 for osgAL by  doxygen 1.5.3-20071008