Struct Wave Writer
pub struct WaveWriter<W> { /* private fields */ }Expand description
Bounded interleaved WAV recorder on a control/worker thread.
Output must initially be empty. Call finish explicitly to patch sizes;
Drop never performs file I/O. An I/O failure poisons further writing/finalization.
Implementations§
§impl<W: Write + Seek> WaveWriter<W>
impl<W: Write + Seek> WaveWriter<W>
pub fn new( destination: W, format: WaveFormat, maximum_frames: usize, ) -> Result<Self, AudioFileError>
pub fn frames(&self) -> u64
pub fn write_frames(&mut self, input: &[f32]) -> Result<(), AudioFileError>
pub fn write_frames(&mut self, input: &[f32]) -> Result<(), AudioFileError>
Validate complete block before writing. PCM clips finite values to [-1,1] and rounds to nearest integer; NaN/infinite PCM input rejects. Float32 preserves bit patterns. Failed file writes can leave partial bytes; discard that file. Prefix repair/recovery is not attempted automatically.
pub fn finish(self) -> Result<W, AudioFileError>
pub fn finish(self) -> Result<W, AudioFileError>
Patch RIFF/data sizes and flush; add an odd-data pad byte when needed.