blip
0.1
|
An audio playback engine. More...
#include <AudioEngine.hpp>
Public Member Functions | |
AudioEngine () | |
Construct a new AudioEngine. More... | |
~AudioEngine () | |
Destructor. More... | |
void | initialize () |
Initialize the audio engine. More... | |
void | shutdown () |
Deallocate any allocated AudioPlayer instances and shut down the audio engine. More... | |
void | allocatePlayer (const AudioFormat &format) |
Allocate an AudioPlayer instance within the engine that will play back audio with the given format. More... | |
AudioPlayer * | reservePlayer (const AudioFormat &format) |
Reserve an AudioPlayer instance that can play back the given audio format. More... | |
void | releasePlayer (AudioPlayer *player) |
Release a previously reserved AudioPlayer instance. More... | |
LEDArray * | getLEDArray () |
Get the LEDArray object representing the device's LED arrays. More... | |
Vibrator * | getVibrator () |
Get the Vibrator object representing the device's vibrator (haptic feedback) device. More... | |
An audio playback engine.
This class is a wrapper around the OpenSL API. The engine manages zero or more AudioPlayer instances, each of which can be used to play back an independent audio stream; the audio from all of these instances is automatically mixed by the engine.
In addition to audio playback, it also provides access to LED array and vibrator (haptic feedback) devices, if the OpenSL implementation has such support.
AudioEngine | ( | ) |
Construct a new AudioEngine.
The engine must be initialized with initialize() before it can be used.
~AudioEngine | ( | ) |
Destructor.
The engine should be shut down with shutdown() before it is destroyed.
void allocatePlayer | ( | const AudioFormat & | format | ) |
Allocate an AudioPlayer instance within the engine that will play back audio with the given format.
The number of AudioPlayer instances that can be allocated by an application is implementation defined.
format | The format of the audio that the player will play back. |
AudioException | If an error occurs. |
LEDArray * getLEDArray | ( | ) |
Get the LEDArray object representing the device's LED arrays.
AudioException | If an error occurs. |
Vibrator * getVibrator | ( | ) |
Get the Vibrator object representing the device's vibrator (haptic feedback) device.
AudioException | If an error occurs. |
void initialize | ( | ) |
Initialize the audio engine.
This method is idempotent.
AudioException | If an error occurs. |
void releasePlayer | ( | AudioPlayer * | player | ) |
Release a previously reserved AudioPlayer instance.
If necessary, stops playback and releases all enqueued buffers.
player | The instance to release. |
AudioPlayer * reservePlayer | ( | const AudioFormat & | format | ) |
Reserve an AudioPlayer instance that can play back the given audio format.
format | The audio format. |
void shutdown | ( | ) |
Deallocate any allocated AudioPlayer instances and shut down the audio engine.
This method is idempotent.