pub struct WavFileSink { /* private fields */ }Expand description
WAV file sink that writes audio incrementally.
Writes the WAV header on the first write_chunk call with a placeholder
data size, then appends sample data on each chunk. On finalize, seeks
back to update the RIFF file size and data chunk size fields.
Implementations§
Source§impl WavFileSink
impl WavFileSink
Sourcepub fn new(path: &Path) -> Result<Self, PiperError>
pub fn new(path: &Path) -> Result<Self, PiperError>
Create a new WAV file sink.
The file is created immediately but the WAV header is written on the
first call to write_chunk (so that we know the sample rate).
Trait Implementations§
Source§impl AudioSink for WavFileSink
impl AudioSink for WavFileSink
Source§fn write_chunk(
&mut self,
samples: &[i16],
sample_rate: u32,
) -> Result<(), PiperError>
fn write_chunk( &mut self, samples: &[i16], sample_rate: u32, ) -> Result<(), PiperError>
Called for each audio chunk produced by the synthesizer.
Auto Trait Implementations§
impl Freeze for WavFileSink
impl RefUnwindSafe for WavFileSink
impl Send for WavFileSink
impl Sync for WavFileSink
impl Unpin for WavFileSink
impl UnsafeUnpin for WavFileSink
impl UnwindSafe for WavFileSink
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more