AudioSource with a notion of position. More...
#include <source.hpp>
Public Member Functions | |
| virtual void | set_next_read_position (uint64_t new_position)=0 |
| Move the read head to new_position (frames from the start of the source). | |
| virtual uint64_t | get_next_read_position () const =0 |
| Current frame position the next get_next_audio_block call will read from. | |
| virtual uint64_t | get_total_length () const =0 |
| Total length in frames. 0 means "unknown" or "infinite". | |
| virtual bool | is_looping () const =0 |
| True if the source should wrap back to 0 when it reaches the end. | |
| virtual void | set_looping (bool) |
| Enable / disable looping. | |
| virtual void | prepare_to_play (int samples_per_block_expected, double sample_rate)=0 |
| Called before playback begins. | |
| virtual void | release_resources ()=0 |
| Called when playback is finished. | |
| virtual void | get_next_audio_block (BufferView< float > out, int start_sample, int num_samples)=0 |
| Fill num_samples of out, starting at start_sample within out. | |
AudioSource with a notion of position.
Subclasses expose a monotonic frame counter that can be reset (set_next_read_position), queried (get_next_read_position), and an optional total length for finite sources (returns 0 for infinite streams).
|
pure virtualinherited |
Fill num_samples of out, starting at start_sample within out.
The source writes (not adds) into the range so callers don't need to pre-zero.
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
pure virtual |
Current frame position the next get_next_audio_block call will read from.
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
pure virtual |
Total length in frames. 0 means "unknown" or "infinite".
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
pure virtual |
True if the source should wrap back to 0 when it reaches the end.
Looping infinite sources are no-op.
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
pure virtualinherited |
Called before playback begins.
samples_per_block_expected is the maximum block length the host will ever ask for; implementations may allocate scratch buffers of that size here.
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
pure virtualinherited |
Called when playback is finished.
Implementations should free any buffers allocated in prepare_to_play.
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
inlinevirtual |
Enable / disable looping.
Default no-op for sources that don't support it; concrete sources override.
Reimplemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.
|
pure virtual |
Move the read head to new_position (frames from the start of the source).
For finite sources, positions past get_total_length() are caller-defined behavior — most implementations clamp to total length or wrap on the next read.
Implemented in pulp::audio::AudioFormatReaderSource, and pulp::audio::AudioTransportSource.