Expand description
Incremental decoding and encoding.
Decoder decodes WAV, FLAC, MP3 or Ogg Vorbis bytes held in memory a chunk at a time, with
seeking. PcmDecoder and PcmEncoder convert raw PCM whose input chunks may
end in the middle of a frame, and Resampler resamples across chunks.
With file-stream on native targets, FileStream reads WAV/FLAC/MP3 through a
dedicated reader thread and bounded encoded/PCM buffers. Its read and seek
never wait or allocate. ErrorCode::Underrun means retry; only Ok(0) means EOF
for a destination holding at least one frame. Keep FileStreamHandle off the
callback: it owns cancellation and joins the worker on destruction. Mixer
integration is enabled by mixer; underruns produce silence while source
position holds and output-time fades continue. Disk availability can change
the timing of these silent gaps; delivered PCM itself matches memory decoding.
Structsยง
- Decoder
- Decodes WAV, FLAC, MP3, Ogg Vorbis or Ogg Opus in memory a chunk at a time.
- Decoder
Options - Options for
Decoder. - File
Stream - A nonblocking, allocation-free consumer of a fixed PCM ring. Requires
file-streamon native targets; mixer integration additionally needsmixer. - File
Stream Handle - Owns reader lifetime and memory until destruction on a control/loading thread. Dropping this cancels playback and waits for the reader; never drop in a callback.
- File
Stream Options - Resident and input admission limits for a native disk stream.
- File
Stream Status - Snapshot of the reader. Frame positions refer to source audio, not device time.
- PcmDecoder
- PcmEncoder
- Resampler
- Windowed-sinc resampling across chunk boundaries. Retains only filter history.
Call
finishto drain the final filter tail using the last sample as the edge value.