arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | List of all members
AudioPlayerThreadSafe< QueueT > Class Template Reference

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)
 

Detailed Description

template<template< class > class QueueT>
class audio_tools::AudioPlayerThreadSafe< QueueT >

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

Template Parameters
QueueTQueue class template taking a single type parameter (the command type).

Constructor & Destructor Documentation

◆ AudioPlayerThreadSafe()

template<template< class > class QueueT>
AudioPlayerThreadSafe ( AudioPlayer p,
QueueT< AudioPlayerCommand > &  queue 
)
inline

Construct an async-control wrapper around an AudioPlayer.

Parameters
pUnderlying AudioPlayer to protect
queueSizeCapacity of the internal command queue

The documentation for this class was generated from the following file: