This device plays through OpenAL.
More...
#include <OpenALDevice.h>
|
static std::list< std::string > | getDeviceNames () |
| Retrieves a list of available hardware devices to open with OpenAL.
|
|
static void | registerPlugin () |
| Registers this plugin.
|
|
This device plays through OpenAL.
◆ OpenALDevice()
Opens the OpenAL audio device for playback.
- Parameters
-
specs | The wanted audio specification. |
buffersize | The size of the internal buffer. |
name | The name of the device to be opened. |
- Note
- The specification really used for opening the device may differ.
-
The buffersize will be multiplicated by three for this device.
- Exceptions
-
◆ getDeviceNames()
static std::list< std::string > OpenALDevice::getDeviceNames |
( |
| ) |
|
|
static |
Retrieves a list of available hardware devices to open with OpenAL.
- Returns
- The list of devices to open.
◆ getDistanceModel()
Retrieves the distance model.
- Returns
- The distance model.
Implements I3DDevice.
◆ getDopplerFactor()
virtual float 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.
- Returns
- The doppler factor.
Implements I3DDevice.
◆ getListenerLocation()
virtual Vector3 OpenALDevice::getListenerLocation |
( |
| ) |
const |
|
virtual |
Retrieves the listener location.
- Returns
- The listener location.
Implements I3DDevice.
◆ getListenerOrientation()
virtual Quaternion OpenALDevice::getListenerOrientation |
( |
| ) |
const |
|
virtual |
Retrieves the listener orientation.
- Returns
- The listener orientation as quaternion.
Implements I3DDevice.
◆ getListenerVelocity()
virtual Vector3 OpenALDevice::getListenerVelocity |
( |
| ) |
const |
|
virtual |
Retrieves the listener velocity.
- Returns
- The listener velocity.
Implements I3DDevice.
◆ getSpecs()
Returns the specification of the device.
Implements IDevice.
◆ getSpeedOfSound()
virtual float OpenALDevice::getSpeedOfSound |
( |
| ) |
const |
|
virtual |
Retrieves the speed of sound.
This value is needed for doppler effect calculation.
- Returns
- The speed of sound.
Implements I3DDevice.
◆ getSynchronizer()
Retrieves the synchronizer for this device, which enables accurate synchronization between audio playback and video playback for example.
- Returns
- The synchronizer which will be the DefaultSynchronizer if synchonization is not supported.
Implements IDevice.
◆ getVolume()
virtual float OpenALDevice::getVolume |
( |
| ) |
const |
|
virtual |
Retrieves the overall device volume.
- Returns
- The overall device volume.
Implements IDevice.
◆ lock()
virtual void 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.
- Warning
- Make sure the locking time is as small as possible to avoid playback delays that result in unexpected noise and cracks.
Implements IDevice.
◆ play() [1/2]
virtual std::shared_ptr< IHandle > OpenALDevice::play |
( |
std::shared_ptr< IReader > | reader, |
|
|
bool | keep = false ) |
|
virtual |
Plays a sound source.
- Parameters
-
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. |
- Returns
- Returns a handle with which the playback can be controlled. This is nullptr if the sound couldn't be played back.
- Exceptions
-
Exception | Thrown if there's an unexpected (from the device side) error during creation of the reader. |
Implements IDevice.
◆ play() [2/2]
virtual std::shared_ptr< IHandle > OpenALDevice::play |
( |
std::shared_ptr< ISound > | sound, |
|
|
bool | keep = false ) |
|
virtual |
Plays a sound source.
- Parameters
-
sound | The sound 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. |
- Returns
- Returns a handle with which the playback can be controlled. This is nullptr if the sound couldn't be played back.
- Exceptions
-
Exception | Thrown if there's an unexpected (from the device side) error during creation of the reader. |
Implements IDevice.
◆ setDistanceModel()
virtual void OpenALDevice::setDistanceModel |
( |
DistanceModel | model | ) |
|
|
virtual |
Sets the distance model.
- Parameters
-
Implements I3DDevice.
◆ setDopplerFactor()
virtual void 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.
- Parameters
-
factor | The new doppler factor. |
Implements I3DDevice.
◆ setListenerLocation()
virtual void OpenALDevice::setListenerLocation |
( |
const Vector3 & | location | ) |
|
|
virtual |
Sets the listener location.
- Parameters
-
location | The new location. |
- Note
- The location is not updated with the velocity and remains constant until the next call of this method.
Implements I3DDevice.
◆ setListenerOrientation()
virtual void OpenALDevice::setListenerOrientation |
( |
const Quaternion & | orientation | ) |
|
|
virtual |
Sets the listener orientation.
- Parameters
-
orientation | The new orientation as quaternion. |
- Note
- The coordinate system used is right handed and the listener by default is oriented looking in the negative z direction with the positive y axis as up direction.
Implements I3DDevice.
◆ setListenerVelocity()
virtual void OpenALDevice::setListenerVelocity |
( |
const Vector3 & | velocity | ) |
|
|
virtual |
Sets the listener velocity.
- Parameters
-
velocity | The new velocity. |
- Note
- This velocity does not change the position of the listener over time, it is simply used for the calculation of the doppler effect.
Implements I3DDevice.
◆ setSpeedOfSound()
virtual void OpenALDevice::setSpeedOfSound |
( |
float | speed | ) |
|
|
virtual |
Sets the speed of sound.
This value is needed for doppler effect calculation.
- Parameters
-
speed | The new speed of sound. |
Implements I3DDevice.
◆ setVolume()
virtual void OpenALDevice::setVolume |
( |
float | volume | ) |
|
|
virtual |
Sets the overall device volume.
- Parameters
-
volume | The overall device volume. |
Implements IDevice.
◆ stopAll()
virtual void OpenALDevice::stopAll |
( |
| ) |
|
|
virtual |
Stops all playing sounds.
Implements IDevice.
◆ unlock()
virtual void OpenALDevice::unlock |
( |
| ) |
|
|
virtual |
Unlocks the previously locked device.
Implements IDevice.
The documentation for this class was generated from the following file: