An audio playback object.
More...
#include <AudioPlayer.hpp>
An audio playback object.
Instances of this class are created using the AudioEngine. Each AudioPlayer represents an independent audio playback stream; all such streams are mixed to the audio device by the AudioEngine.
- Author
- Mark Lindner
◆ ~AudioPlayer()
◆ clear()
Release all enequeued audio data buffers.
- Exceptions
-
◆ enqueueData()
bool enqueueData |
( |
byte_t * |
data, |
|
|
size_t |
length |
|
) |
| |
Enqueue a buffer of audio data for playback.
- Parameters
-
data | The buffer of audio data. |
length | The length of the buffer, in bytes. |
- Exceptions
-
◆ getAudioFormat()
◆ getDuration()
timespan_ms_t getDuration |
( |
| ) |
|
Get the total duration of the currently enqueued audio data.
- Returns
- The duration, in milliseconds.
- Exceptions
-
◆ getPosition()
timespan_ms_t getPosition |
( |
| ) |
|
Get the position within the currently enqueued audio data.
- Returns
- The current position, in milliseconds. This position is relative to the beginning of the first buffer that was enqueued after the most recent clear() call.
- Exceptions
-
◆ isPlaying()
Test if this player is currently playing audio.
◆ pause()
Pause audio playback.
A subsequent call to start() will resume playback at the point where it was paused.
- Exceptions
-
◆ setVolume()
void setVolume |
( |
int |
volumeMB | ) |
|
Set the player volume.
- Parameters
-
volumeMB | The new volume, in millibars. |
- Exceptions
-
◆ start()
Start audio playback.
- Exceptions
-
◆ stop()
Stop audio playback.
A subsequent call to start() will resume playback at the beginning.
- Exceptions
-
The documentation for this class was generated from the following files: