Struct Wave Reader
pub struct WaveReader<R> { /* private fields */ }Expand description
Prepared bounded interleaved f32 decoder over a seekable WAV stream. File operations block. Unknown chunks are skipped within declared RIFF size; duplicate fmt/data chunks, truncation and inconsistent byte rates reject.
Implementations§
§impl<R: Read + Seek> WaveReader<R>
impl<R: Read + Seek> WaveReader<R>
pub fn new(source: R, maximum_frames: usize) -> Result<Self, AudioFileError>
pub fn new(source: R, maximum_frames: usize) -> Result<Self, AudioFileError>
Inspect from stream offset zero and allocate bounded scratch. Trailing bytes outside RIFF are ignored; the declared RIFF must be complete.
pub fn format(&self) -> WaveFormat
pub fn frames(&self) -> u64
pub fn position(&self) -> u64
pub fn maximum_frames(&self) -> usize
pub fn maximum_frames(&self) -> usize
Prepared frame scratch capacity for each bounded read call.
pub fn seek_frame(&mut self, frame: u64) -> Result<(), AudioFileError>
pub fn seek_frame(&mut self, frame: u64) -> Result<(), AudioFileError>
Set requested frame; actual stream seek happens on the next read.
pub fn read_frames(
&mut self,
output: &mut [f32],
) -> Result<usize, AudioFileError>
pub fn read_frames( &mut self, output: &mut [f32], ) -> Result<usize, AudioFileError>
Decode up to output capacity, preserving tail after returned frame count. Output length must be a whole number of interleaved frames and within preparation maximum. I/O failures leave destination and logical position unchanged; the next read seeks back before retrying.