|
arduino-audio-tools
|
Lock-free asynchronous control wrapper for AudioPlayer using a command queue. More...
#include <AudioPlayerThreadSafe.h>
Public Member Functions | |
| AudioPlayerThreadSafe (AudioPlayer &p, QueueT< AudioPlayerCommand > &queue) | |
| Construct an async-control wrapper around an AudioPlayer. | |
| bool | begin (int index=0, bool isActive=true) |
| size_t | copy () |
| size_t | copy (size_t bytes) |
| void | end () |
| bool | next (int offset=1) |
| void | setActive (bool active) |
| bool | setIndex (int idx) |
| bool | setMuted (bool muted) |
| bool | setPath (const char *path) |
| bool | setVolume (float v) |
Lock-free asynchronous control wrapper for AudioPlayer using a command queue.
Purpose Provides a minimal, thread-safe control surface (begin, end, next, setIndex, setPath, setVolume, setMuted, setActive) by enqueuing commands from any task and applying them inside copy() in the audio/render thread. This serializes all state changes without a mutex.
Contract
Thread-safety model
Callback / reentrancy guidance
Template parameter
| QueueT | Queue class template taking a single type parameter (the command type). |
|
inline |
Construct an async-control wrapper around an AudioPlayer.
| p | Underlying AudioPlayer to protect |
| queueSize | Capacity of the internal command queue |