Blender V2.61 - r43446
|
#include <AUD_OpenALDevice.h>
Classes | |
class | AUD_OpenALHandle |
Saves the data for playback. | |
Public Member Functions | |
AUD_OpenALDevice (AUD_DeviceSpecs specs, int buffersize=AUD_DEFAULT_BUFFER_SIZE) | |
void | updateStreams () |
virtual | ~AUD_OpenALDevice () |
virtual AUD_DeviceSpecs | getSpecs () const |
virtual AUD_Reference < AUD_IHandle > | play (AUD_Reference< AUD_IReader > reader, bool keep=false) |
virtual AUD_Reference < AUD_IHandle > | play (AUD_Reference< AUD_IFactory > factory, bool keep=false) |
virtual void | stopAll () |
virtual void | lock () |
virtual void | unlock () |
virtual float | getVolume () const |
virtual void | setVolume (float volume) |
virtual AUD_Vector3 | getListenerLocation () const |
virtual void | setListenerLocation (const AUD_Vector3 &location) |
virtual AUD_Vector3 | getListenerVelocity () const |
virtual void | setListenerVelocity (const AUD_Vector3 &velocity) |
virtual AUD_Quaternion | getListenerOrientation () const |
virtual void | setListenerOrientation (const AUD_Quaternion &orientation) |
virtual float | getSpeedOfSound () const |
virtual void | setSpeedOfSound (float speed) |
virtual float | getDopplerFactor () const |
virtual void | setDopplerFactor (float factor) |
virtual AUD_DistanceModel | getDistanceModel () const |
virtual void | setDistanceModel (AUD_DistanceModel model) |
This device plays through OpenAL.
Definition at line 48 of file AUD_OpenALDevice.h.
AUD_OpenALDevice::AUD_OpenALDevice | ( | AUD_DeviceSpecs | specs, |
int | buffersize = AUD_DEFAULT_BUFFER_SIZE |
||
) |
Opens the OpenAL audio device for playback.
specs | The wanted audio specification. |
buffersize | The size of the internal buffer. |
AUD_Exception | Thrown if the audio device cannot be opened. |
Definition at line 969 of file AUD_OpenALDevice.cpp.
References AUD_CHANNELS_STEREO, AUD_ERROR_OPENAL, AUD_FORMAT_FLOAT32, AUD_FORMAT_S16, AUD_RATE_INVALID, AUD_THROW, AUD_DeviceSpecs::channels, addon::enums::devices, AUD_DeviceSpecs::format, NULL, AUD_DeviceSpecs::rate, and strlen().
AUD_OpenALDevice::~AUD_OpenALDevice | ( | ) | [virtual] |
Definition at line 1032 of file AUD_OpenALDevice.cpp.
AUD_DistanceModel AUD_OpenALDevice::getDistanceModel | ( | ) | const [virtual] |
Retrieves the distance model.
Implements AUD_I3DDevice.
Definition at line 1513 of file AUD_OpenALDevice.cpp.
References AUD_DISTANCE_MODEL_EXPONENT, AUD_DISTANCE_MODEL_EXPONENT_CLAMPED, AUD_DISTANCE_MODEL_INVALID, AUD_DISTANCE_MODEL_INVERSE, AUD_DISTANCE_MODEL_INVERSE_CLAMPED, AUD_DISTANCE_MODEL_LINEAR, and AUD_DISTANCE_MODEL_LINEAR_CLAMPED.
float AUD_OpenALDevice::getDopplerFactor | ( | ) | const [virtual] |
Retrieves the doppler factor. This value is a scaling factor for the velocity vectors of sources and listener which is used while calculating the doppler effect.
Implements AUD_I3DDevice.
Definition at line 1503 of file AUD_OpenALDevice.cpp.
AUD_Vector3 AUD_OpenALDevice::getListenerLocation | ( | ) | const [virtual] |
Retrieves the listener location.
Implements AUD_I3DDevice.
Definition at line 1445 of file AUD_OpenALDevice.cpp.
AUD_Quaternion AUD_OpenALDevice::getListenerOrientation | ( | ) | const [virtual] |
Retrieves the listener orientation.
Implements AUD_I3DDevice.
Definition at line 1469 of file AUD_OpenALDevice.cpp.
AUD_Vector3 AUD_OpenALDevice::getListenerVelocity | ( | ) | const [virtual] |
Retrieves the listener velocity.
Implements AUD_I3DDevice.
Definition at line 1457 of file AUD_OpenALDevice.cpp.
AUD_DeviceSpecs AUD_OpenALDevice::getSpecs | ( | ) | const [virtual] |
Returns the specification of the device.
Implements AUD_IDevice.
Definition at line 1068 of file AUD_OpenALDevice.cpp.
float AUD_OpenALDevice::getSpeedOfSound | ( | ) | const [virtual] |
Retrieves the speed of sound. This value is needed for doppler effect calculation.
Implements AUD_I3DDevice.
Definition at line 1493 of file AUD_OpenALDevice.cpp.
float AUD_OpenALDevice::getVolume | ( | ) | const [virtual] |
Retrieves the overall device volume.
Implements AUD_IDevice.
Definition at line 1311 of file AUD_OpenALDevice.cpp.
void AUD_OpenALDevice::lock | ( | ) | [virtual] |
Locks the device. Used to make sure that between lock and unlock, no buffers are read, so that it is possible to start, resume, pause, stop or seek several playback handles simultaneously.
Implements AUD_IDevice.
Definition at line 1301 of file AUD_OpenALDevice.cpp.
Referenced by play(), stopAll(), updateStreams(), and ~AUD_OpenALDevice().
AUD_Reference< AUD_IHandle > AUD_OpenALDevice::play | ( | AUD_Reference< AUD_IFactory > | factory, |
bool | keep = false |
||
) | [virtual] |
Plays a sound source.
factory | The factory to create the reader for the sound source. |
keep | When keep is true the sound source will not be deleted but set to paused when its end has been reached. |
AUD_Exception | Thrown if there's an unexpected (from the device side) error during creation of the reader. |
Implements AUD_IDevice.
Definition at line 1209 of file AUD_OpenALDevice.cpp.
References play().
AUD_Reference< AUD_IHandle > AUD_OpenALDevice::play | ( | AUD_Reference< AUD_IReader > | reader, |
bool | keep = false |
||
) | [virtual] |
Plays a sound source.
reader | The reader to play. |
keep | When keep is true the sound source will not be deleted but set to paused when its end has been reached. |
AUD_Exception | Thrown if there's an unexpected (from the device side) error during creation of the reader. |
Implements AUD_IDevice.
Definition at line 1164 of file AUD_OpenALDevice.cpp.
References AUD_CHANNELS_INVALID, AUD_FORMAT_FLOAT32, AUD_Specs::channels, AUD_DeviceSpecs::format, lock(), and unlock().
Referenced by play().
void AUD_OpenALDevice::setDistanceModel | ( | AUD_DistanceModel | model | ) | [virtual] |
Sets the distance model.
model | distance model. |
Implements AUD_I3DDevice.
Definition at line 1534 of file AUD_OpenALDevice.cpp.
References AUD_DISTANCE_MODEL_EXPONENT, AUD_DISTANCE_MODEL_EXPONENT_CLAMPED, AUD_DISTANCE_MODEL_INVERSE, AUD_DISTANCE_MODEL_INVERSE_CLAMPED, AUD_DISTANCE_MODEL_LINEAR, and AUD_DISTANCE_MODEL_LINEAR_CLAMPED.
void AUD_OpenALDevice::setDopplerFactor | ( | float | factor | ) | [virtual] |
Sets the doppler factor. This value is a scaling factor for the velocity vectors of sources and listener which is used while calculating the doppler effect.
factor | The new doppler factor. |
Implements AUD_I3DDevice.
Definition at line 1508 of file AUD_OpenALDevice.cpp.
void AUD_OpenALDevice::setListenerLocation | ( | const AUD_Vector3 & | location | ) | [virtual] |
Sets the listener location.
location | The new location. |
Implements AUD_I3DDevice.
Definition at line 1452 of file AUD_OpenALDevice.cpp.
References AUD_Vector3::get().
void AUD_OpenALDevice::setListenerOrientation | ( | const AUD_Quaternion & | orientation | ) | [virtual] |
Sets the listener orientation.
orientation | The new orientation as quaternion. |
Implements AUD_I3DDevice.
Definition at line 1474 of file AUD_OpenALDevice.cpp.
References AUD_Quaternion::w(), AUD_Quaternion::x(), AUD_Quaternion::y(), and AUD_Quaternion::z().
void AUD_OpenALDevice::setListenerVelocity | ( | const AUD_Vector3 & | velocity | ) | [virtual] |
Sets the listener velocity.
velocity | The new velocity. |
Implements AUD_I3DDevice.
Definition at line 1464 of file AUD_OpenALDevice.cpp.
References AUD_Vector3::get().
void AUD_OpenALDevice::setSpeedOfSound | ( | float | speed | ) | [virtual] |
Sets the speed of sound. This value is needed for doppler effect calculation.
speed | The new speed of sound. |
Implements AUD_I3DDevice.
Definition at line 1498 of file AUD_OpenALDevice.cpp.
void AUD_OpenALDevice::setVolume | ( | float | volume | ) | [virtual] |
Sets the overall device volume.
handle | The sound handle. |
volume | The overall device volume. |
Implements AUD_IDevice.
Definition at line 1318 of file AUD_OpenALDevice.cpp.
void AUD_OpenALDevice::stopAll | ( | ) | [virtual] |
Stops all playing sounds.
Implements AUD_IDevice.
Definition at line 1286 of file AUD_OpenALDevice.cpp.
void AUD_OpenALDevice::unlock | ( | ) | [virtual] |
Unlocks the previously locked device.
Implements AUD_IDevice.
Definition at line 1306 of file AUD_OpenALDevice.cpp.
Referenced by play(), stopAll(), updateStreams(), and ~AUD_OpenALDevice().
void AUD_OpenALDevice::updateStreams | ( | ) |
Streaming thread main function.
Definition at line 800 of file AUD_OpenALDevice.cpp.
References AUD_Buffer::assureSize(), AUD_DEVICE_SAMPLE_SIZE, err, AUD_Buffer::getBuffer(), length(), lock(), NULL, AUD_DeviceSpecs::rate, Sleep, AUD_DeviceSpecs::specs, and unlock().
Referenced by AUD_openalRunThread().