Drives an AudioSource from a host audio callback. More...
#include <source_player.hpp>
Public Member Functions | |
| AudioSourcePlayer ()=default | |
| void | set_source (AudioSource *source) |
| Bind a source (or nullptr to detach). | |
| AudioSource * | source () const |
| void | set_gain (float gain) |
| Overall gain applied after the source's render. Default 1.0. | |
| float | gain () const |
| void | audio_callback (BufferView< float > out, int num_samples, double sample_rate) |
| Call from the host's audio callback. | |
| void | release () |
| Manually release the source's resources (mirrors what set_source(nullptr) does for the prior source). | |
Drives an AudioSource from a host audio callback.
The player re-issues prepare_to_play automatically when the host's sample-rate or block-size differs from the last call, so callers don't need to call it manually after a device change.
Output is multi-channel via BufferView<float>; channels are rendered into the buffer at offset 0 (the player does not chase start_sample; that's a per-source concern).
|
default |
|
inline |
Call from the host's audio callback.
Re-prepares the source if sample_rate or num_samples differs from the last call.
|
inline |
|
inline |
Manually release the source's resources (mirrors what set_source(nullptr) does for the prior source).
|
inline |
Overall gain applied after the source's render. Default 1.0.
|
inline |
Bind a source (or nullptr to detach).
If a source was already playing, the previous source's resources are released first.
|
inline |