The software device is a generic device with software mixing.
More...
#include <SoftwareDevice.h>
|
static void | setPanning (IHandle *handle, float pan) |
| Sets the panning of a specific handle.
|
|
|
void | create () |
| Initializes member variables.
|
|
void | destroy () |
| Uninitializes member variables.
|
|
void | mix (data_t *buffer, int length) |
| Mixes the next samples into the buffer.
|
|
virtual void | playing (bool playing)=0 |
| This function tells the device, to start or pause playback.
|
|
void | setSpecs (Specs specs) |
| Sets the audio output specification of the device.
|
|
void | setSpecs (DeviceSpecs specs) |
| Sets the audio output specification of the device.
|
|
| SoftwareDevice () |
| Empty default constructor.
|
|
The software device is a generic device with software mixing.
It is a base class for all software mixing classes. Classes implementing this have to:
- Implement the playing function.
- Prepare the m_specs, m_mixer variables.
- Call the create and destroy functions.
- Call the mix function to retrieve their audio data.
◆ SoftwareDevice()
SoftwareDevice::SoftwareDevice |
( |
| ) |
|
|
protected |
Empty default constructor.
To setup the device call the function create() and to uninitialize call destroy().
◆ getDistanceModel()
Retrieves the distance model.
- Returns
- The distance model.
Implements I3DDevice.
◆ getDopplerFactor()
virtual float SoftwareDevice::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 SoftwareDevice::getListenerLocation |
( |
| ) |
const |
|
virtual |
Retrieves the listener location.
- Returns
- The listener location.
Implements I3DDevice.
◆ getListenerOrientation()
virtual Quaternion SoftwareDevice::getListenerOrientation |
( |
| ) |
const |
|
virtual |
Retrieves the listener orientation.
- Returns
- The listener orientation as quaternion.
Implements I3DDevice.
◆ getListenerVelocity()
virtual Vector3 SoftwareDevice::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 SoftwareDevice::getSpeedOfSound |
( |
| ) |
const |
|
virtual |
Retrieves the speed of sound.
This value is needed for doppler effect calculation.
- Returns
- The speed of sound.
Implements I3DDevice.
◆ getSynchronizer()
◆ getVolume()
virtual float SoftwareDevice::getVolume |
( |
| ) |
const |
|
virtual |
Retrieves the overall device volume.
- Returns
- The overall device volume.
Implements IDevice.
◆ lock()
virtual void SoftwareDevice::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.
◆ mix()
void SoftwareDevice::mix |
( |
data_t * | buffer, |
|
|
int | length ) |
|
protected |
Mixes the next samples into the buffer.
- Parameters
-
buffer | The target buffer. |
length | The length in samples to be filled. |
◆ play() [1/2]
virtual std::shared_ptr< IHandle > SoftwareDevice::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 > SoftwareDevice::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.
◆ playing()
virtual void SoftwareDevice::playing |
( |
bool | playing | ) |
|
|
protectedpure virtual |
◆ setDistanceModel()
virtual void SoftwareDevice::setDistanceModel |
( |
DistanceModel | model | ) |
|
|
virtual |
Sets the distance model.
- Parameters
-
Implements I3DDevice.
◆ setDopplerFactor()
virtual void SoftwareDevice::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 SoftwareDevice::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 SoftwareDevice::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 SoftwareDevice::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.
◆ setPanning()
static void SoftwareDevice::setPanning |
( |
IHandle * | handle, |
|
|
float | pan ) |
|
static |
Sets the panning of a specific handle.
- Parameters
-
handle | The handle to set the panning from. |
pan | The new panning value, should be in the range [-2, 2]. |
◆ setQuality()
Sets the resampling quality.
- Parameters
-
quality | Resampling quality vs performance setting. |
◆ setSpecs() [1/2]
Sets the audio output specification of the device.
- Parameters
-
specs | The output specification. |
◆ setSpecs() [2/2]
void SoftwareDevice::setSpecs |
( |
Specs | specs | ) |
|
|
protected |
Sets the audio output specification of the device.
- Parameters
-
specs | The output specification. |
◆ setSpeedOfSound()
virtual void SoftwareDevice::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 SoftwareDevice::setVolume |
( |
float | volume | ) |
|
|
virtual |
Sets the overall device volume.
- Parameters
-
volume | The overall device volume. |
Implements IDevice.
◆ stopAll()
virtual void SoftwareDevice::stopAll |
( |
| ) |
|
|
virtual |
Stops all playing sounds.
Implements IDevice.
◆ unlock()
virtual void SoftwareDevice::unlock |
( |
| ) |
|
|
virtual |
Unlocks the previously locked device.
Implements IDevice.
The documentation for this class was generated from the following file: