Class thl::audio_io::DataSource#
-
class DataSource#
Thin wrapper around a decoded audio data source.
Provides streaming read and seek access to PCM audio data without exposing the underlying audio backend. The output format is always 32-bit float interleaved.
Instances are created via AudioFileLoader::load_data_source_from_file or AudioFileLoader::load_data_source_from_memory. The class is move-only.
Public Functions
-
~DataSource()#
-
DataSource(DataSource&&) noexcept#
-
DataSource &operator=(DataSource&&) noexcept#
-
DataSource(const DataSource&) = delete#
-
DataSource &operator=(const DataSource&) = delete#
-
uint64_t read_pcm_frames(float *output, uint64_t frame_count)#
Read interleaved PCM frames from the current position.
- Parameters:
output – Destination buffer (must hold at least frame_count * channel_count floats).
frame_count – Number of frames to read.
- Returns:
The number of frames actually read (may be less at EOF).
-
bool seek(uint64_t frame_index)#
Seek to an absolute PCM frame position.
- Parameters:
frame_index – Target frame index (0-based).
- Returns:
true on success.
-
uint32_t get_channel_count() const#
-
uint32_t get_sample_rate() const#
-
uint64_t get_total_frames() const#
-
uint64_t get_cursor() const#
-
bool is_valid() const#
-
~DataSource()#