pub struct WaveWriter<T>{
pub pcm_format: PcmFormat,
/* private fields */
}
Expand description
Helper struct that takes ownership of a writer and can be used to write data to a PCM wave file.
Fields§
§pcm_format: PcmFormat
Represents the PCM format for this wave file.
Implementations§
Source§impl<T> WaveWriter<T>
impl<T> WaveWriter<T>
Sourcepub fn new(
num_channels: u16,
sample_rate: u32,
bits_per_sample: u16,
writer: T,
) -> WriteResult<WaveWriter<T>>
pub fn new( num_channels: u16, sample_rate: u32, bits_per_sample: u16, writer: T, ) -> WriteResult<WaveWriter<T>>
Returns a new wave writer for the given writer.
§Panics
Panics if num_channels or sample_rate is zero, or if bits_per_sample doesn’t match 8, 16, 24, or 32.
Sourcepub fn write_sample_u8(&mut self, sample: u8) -> WriteResult<()>
pub fn write_sample_u8(&mut self, sample: u8) -> WriteResult<()>
Writes a single sample as an unsigned 8-bit value.
Sourcepub fn write_sample_i16(&mut self, sample: i16) -> WriteResult<()>
pub fn write_sample_i16(&mut self, sample: i16) -> WriteResult<()>
Writes a single sample as a signed 16-bit value.
Sourcepub fn write_sample_i24(&mut self, sample: i32) -> WriteResult<()>
pub fn write_sample_i24(&mut self, sample: i32) -> WriteResult<()>
Writes a single sample as a signed 24-bit value. The value will be truncated to fit in a 24-bit value.
Sourcepub fn write_sample_i32(&mut self, sample: i32) -> WriteResult<()>
pub fn write_sample_i32(&mut self, sample: i32) -> WriteResult<()>
Writes a single sample as a signed 32-bit value.
Sourcepub fn sync_header(&mut self) -> Result<()>
pub fn sync_header(&mut self) -> Result<()>
Updates the header at the beginning of the file with the new chunk sizes.
Trait Implementations§
Source§impl<T> Debug for WaveWriter<T>
impl<T> Debug for WaveWriter<T>
Auto Trait Implementations§
impl<T> Freeze for WaveWriter<T>where
T: Freeze,
impl<T> RefUnwindSafe for WaveWriter<T>where
T: RefUnwindSafe,
impl<T> Send for WaveWriter<T>where
T: Send,
impl<T> Sync for WaveWriter<T>where
T: Sync,
impl<T> Unpin for WaveWriter<T>where
T: Unpin,
impl<T> UnwindSafe for WaveWriter<T>where
T: UnwindSafe,
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