Memory-mapped audio file reader.
More...
#include <mmap_reader.hpp>
Memory-mapped audio file reader.
Maps the file into memory and decodes on demand. Ideal for large sample libraries where loading the entire file is impractical.
◆ MemoryMappedAudioReader() [1/2]
| pulp::audio::MemoryMappedAudioReader::MemoryMappedAudioReader |
( |
| ) |
|
◆ ~MemoryMappedAudioReader()
| pulp::audio::MemoryMappedAudioReader::~MemoryMappedAudioReader |
( |
| ) |
|
◆ MemoryMappedAudioReader() [2/2]
| pulp::audio::MemoryMappedAudioReader::MemoryMappedAudioReader |
( |
MemoryMappedAudioReader && | | ) |
|
|
noexcept |
◆ close()
| void pulp::audio::MemoryMappedAudioReader::close |
( |
| ) |
|
◆ copy_access_policy_to()
| bool pulp::audio::MemoryMappedAudioReader::copy_access_policy_to |
( |
std::string_view | destination | ) |
const |
|
noexcept |
Copy the access policy captured by the retained source handle to an existing artifact.
Control thread only.
◆ data()
| const uint8_t * pulp::audio::MemoryMappedAudioReader::data |
( |
| ) |
const |
Raw bytes from the immutable source snapshot (for custom decoding).
◆ info()
| const AudioFileInfo & pulp::audio::MemoryMappedAudioReader::info |
( |
| ) |
const |
|
inline |
File info (available after open).
◆ is_open()
| bool pulp::audio::MemoryMappedAudioReader::is_open |
( |
| ) |
const |
Whether an immutable snapshot of the source is currently mapped.
◆ open() [1/2]
| bool pulp::audio::MemoryMappedAudioReader::open |
( |
std::string_view | path | ) |
|
Open and memory-map an audio file. Returns false on failure.
◆ open() [2/2]
| bool pulp::audio::MemoryMappedAudioReader::open |
( |
std::string_view | path, |
|
|
std::size_t | maximum_mapped_bytes ) |
◆ opened_file_identity()
◆ operator=()
◆ path_refers_to_open_file()
| bool pulp::audio::MemoryMappedAudioReader::path_refers_to_open_file |
( |
std::string_view | path | ) |
const |
|
noexcept |
◆ prepare_access_policy_target()
◆ read_all()
| std::optional< AudioFileData > pulp::audio::MemoryMappedAudioReader::read_all |
( |
| ) |
|
Read the entire immutable source snapshot.
◆ read_frames()
| bool pulp::audio::MemoryMappedAudioReader::read_frames |
( |
float ** | dest_channels, |
|
|
uint32_t | num_channels, |
|
|
uint64_t | start_frame, |
|
|
uint64_t | num_frames ) |
Read a range of frames into deinterleaved float buffers.
Seekable formats use the mapped ranged decoder; unsupported formats or an unexpected ranged decode failure fall back to a cached whole-file decode. Returns false on error. Frames past end-of-file are zero-filled. RT note: this performs decode/copy work, so it is for the control or background reader thread, never the audio callback. Concurrent calls on one instance are serialized internally. Open, close, move, and destruction must not overlap reads. This API remains non-RT: callers may block on decoding, allocation, I/O, or another reader.
◆ read_frames_ranged_only()
| bool pulp::audio::MemoryMappedAudioReader::read_frames_ranged_only |
( |
float ** | dest_channels, |
|
|
uint32_t | num_channels, |
|
|
uint64_t | start_frame, |
|
|
uint64_t | num_frames ) |
Strict counterpart to read_frames().
Returns false unless the requested frames were served by the mapped ranged decoder; it never starts or uses the whole-file fallback cache.
◆ size()
| size_t pulp::audio::MemoryMappedAudioReader::size |
( |
| ) |
const |
◆ supports_ranged_read()
| bool pulp::audio::MemoryMappedAudioReader::supports_ranged_read |
( |
| ) |
const |
True when a ranged (seek-based, no whole-file decode) reader is active for this file.
False means read_frames falls back to a one-time whole-file decode cached on first use (e.g. a format the streaming reader can't seek).
The documentation for this class was generated from the following file: