Struct riff_wave::WaveWriter
[−]
[src]
pub struct WaveWriter<T> where T: Seek + Write { pub pcm_format: PcmFormat, // some fields omitted }
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.
Methods
impl<T> WaveWriter<T> where T: Seek + Write[src]
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.
fn write_sample_u8(&mut self, sample: u8) -> WriteResult<()>
Writes a single sample as an unsigned 8-bit value.
fn write_sample_i16(&mut self, sample: i16) -> WriteResult<()>
Writes a single sample as a signed 16-bit value.
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.
fn write_sample_i32(&mut self, sample: i32) -> WriteResult<()>
Writes a single sample as a signed 32-bit value.
fn sync_header(&mut self) -> Result<()>
Updates the header at the beginning of the file with the new chunk sizes.