Struct WavFileWriter

Source
pub struct WavFileWriter<S: Sample> { /* private fields */ }
Expand description

A WAV file writer implementing Writer.

Writes 32-bit floating point WAV files. Call finalize when done to ensure proper file closure.

Implementations§

Source§

impl<S: Sample> WavFileWriter<S>

Source

pub fn new( file_path: &str, sample_rate: f64, num_channels: usize, ) -> Result<Self, Box<dyn Error>>

Create a WavFileWriter with the specified sample rate and number of audio channels.

Trait Implementations§

Source§

impl<S: Sample> Writer<S> for WavFileWriter<S>

Source§

fn sample_rate(&self) -> f64

Get the sample rate of the writer.
Source§

fn num_channels(&self) -> usize

Get the number of channels of the writer.
Source§

fn can_write(&self) -> bool

Check whether the writer can write to audio an audio file. This is useful for particular audio files that use closing byte signatures, unlike WAV files which can usually be appended with more audio data at any time.
Source§

fn write_channel( &mut self, channel_index: usize, samples: &[S], ) -> Result<(), Box<dyn Error>>

Write samples to a specified channel.
Source§

fn finalize(&mut self) -> Result<(), Box<dyn Error>>

Finalize the writing of an audio file.

Auto Trait Implementations§

§

impl<S> Freeze for WavFileWriter<S>

§

impl<S> RefUnwindSafe for WavFileWriter<S>
where S: RefUnwindSafe,

§

impl<S> Send for WavFileWriter<S>

§

impl<S> Sync for WavFileWriter<S>

§

impl<S> Unpin for WavFileWriter<S>
where S: Unpin,

§

impl<S> UnwindSafe for WavFileWriter<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.