AUDIO
Source snapshot · 11 November 2026

API reference / ravet_audio_file::WaveReader

Struct WaveReader 

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>

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

Prepared frame scratch capacity for each bounded read call.

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>

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.

Trait Implementations§

§

impl<R: Read + Seek> IndexedPlaybackReader for WaveReader<R>

§

fn seek_original_frame(&mut self, frame: u64) -> Result<(), Error>

§

impl<R: Read + Seek> PlaybackReader for WaveReader<R>

§

fn channels(&self) -> usize

§

fn sample_rate(&self) -> u32

§

fn position_frames(&self) -> u64

§

fn declared_frames(&self) -> Option<u64>

§

fn maximum_read_frames(&self) -> usize

§

fn read_frames(&mut self, output: &mut [f32]) -> Result<usize, Error>

Auto Trait Implementations§

§

impl<R> Freeze for WaveReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for WaveReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for WaveReader<R>
where R: Send,

§

impl<R> Sync for WaveReader<R>
where R: Sync,

§

impl<R> Unpin for WaveReader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for WaveReader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for WaveReader<R>
where R: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for Fwhere T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.