audiere::ThreadedDevice Class Reference

Inheritance diagram for audiere::ThreadedDevice:

Inheritance graph
[legend]
Collaboration diagram for audiere::ThreadedDevice:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ThreadedDevice (AudioDevice *device)
 ~ThreadedDevice ()
void update ()
OutputStreamopenStream (SampleSource *source)
OutputStreamopenBuffer (void *samples, int frame_count, int channel_count, int sample_rate, SampleFormat sample_format)
const char * getName ()
void registerCallback (Callback *callback)
void unregisterCallback (Callback *callback)
void clearCallbacks ()

Detailed Description

Definition at line 266 of file device.cpp.


Constructor & Destructor Documentation

audiere::ThreadedDevice::ThreadedDevice AudioDevice device  )  [inline]
 

Todo:
what if thread creation fails?

Definition at line 268 of file device.cpp.

References ADR_GUARD, ADR_LOG, and audiere::AI_CreateThread().

audiere::ThreadedDevice::~ThreadedDevice  )  [inline]
 

Definition at line 287 of file device.cpp.

References audiere::AI_Sleep().


Member Function Documentation

void audiere::ThreadedDevice::clearCallbacks  )  [inline, virtual]
 

Clears all of the callbacks from the device.

Implements audiere::AudioDevice.

Definition at line 323 of file device.cpp.

const char* audiere::ThreadedDevice::getName  )  [inline, virtual]
 

Gets the name of the audio device. For example "directsound" or "oss".

Returns:
name of audio device

Implements audiere::AudioDevice.

Definition at line 311 of file device.cpp.

OutputStream* audiere::ThreadedDevice::openBuffer void *  samples,
int  frame_count,
int  channel_count,
int  sample_rate,
SampleFormat  sample_format
[inline, virtual]
 

Open a single buffer with the specified PCM data. This is sometimes more efficient than streaming and works on a larger variety of audio devices. In some implementations, this may download the audio data to the sound card's memory itself.

Parameters:
samples Buffer containing sample data. openBuffer() does not take ownership of the memory. The application is responsible for freeing it. There must be at least |frame_count * channel_count * GetSampleSize(sample_format)| bytes in the buffer.
frame_count Number of frames in the buffer.
channel_count Number of audio channels. 1 = mono, 2 = stereo.
sample_rate Number of samples per second.
sample_format Format of samples in buffer.
Returns:
new output stream if successful, 0 if failure

Implements audiere::AudioDevice.

Definition at line 302 of file device.cpp.

OutputStream* audiere::ThreadedDevice::openStream SampleSource source  )  [inline, virtual]
 

Open an output stream with a given sample source. If the sample source ever runs out of data, the output stream automatically stops itself.

The output stream takes ownership of the sample source, even if opening the output stream fails (in which case the source is immediately deleted).

Parameters:
source the source used to feed the output stream with samples
Returns:
new output stream if successful, 0 if failure

Implements audiere::AudioDevice.

Definition at line 298 of file device.cpp.

void audiere::ThreadedDevice::registerCallback Callback callback  )  [inline, virtual]
 

Registers 'callback' to receive events. Callbacks can be registered multiple times.

Implements audiere::AudioDevice.

Definition at line 315 of file device.cpp.

void audiere::ThreadedDevice::unregisterCallback Callback callback  )  [inline, virtual]
 

Unregisters 'callback' once. If it is registered multiple times, each unregisterStopCallback call unregisters one of the instances.

Implements audiere::AudioDevice.

Definition at line 319 of file device.cpp.

void audiere::ThreadedDevice::update  )  [inline, virtual]
 

Tell the device to do any internal state updates. Some devices update on an internal thread. If that is the case, this method does nothing.

Implements audiere::AudioDevice.

Definition at line 295 of file device.cpp.


The documentation for this class was generated from the following file:
Generated on Mon Feb 13 23:08:57 2006 for audiere by  doxygen 1.4.6