[][src]Struct bwavfile::AudioFrameReader

pub struct AudioFrameReader<R: Read + Seek> { /* fields omitted */ }

Read audio frames

The inner reader is interpreted as a raw audio data bitstream having a format specified by format.

Implementations

impl<R: Read + Seek> AudioFrameReader<R>[src]

pub fn new(inner: R, format: WaveFmt) -> Self[src]

Create a new AudioFrameReader

Panics

This method does a few sanity checks on the provided format parameter to confirm the block_alignment law is fulfilled and the format tag is readable by this implementation (only format 0x01 is supported at this time.)

pub fn locate(&mut self, to: u64) -> Result<u64, Error>[src]

Locate the read position to a different frame

Seeks within the audio stream.

Returns the new location of the read position.

pub fn create_frame_buffer(&self) -> Vec<i32>[src]

Create a frame buffer sized to hold frames of the reader

This is a conveneince method that creates a Vec<i32> with as many elements as there are channels in the underlying stream.

pub fn read_integer_frame(&mut self, buffer: &mut [i32]) -> Result<u64, Error>[src]

Read a frame

A single frame is read from the audio stream and the read location is advanced one frame.

Regardless of the number of bits in the audio sample, this method always writes i32 samples back to the buffer. These samples are written back "left-aligned" so samples that are shorter than i32 will leave the MSB bits empty.

For example: A full-code sample in 16 bit (0xFFFF) will be written back to the buffer as 0x0000FFFF.

Panics

The buffer must have a number of elements equal to the number of channels and this method will panic if this is not the case.

Trait Implementations

impl<R: Debug + Read + Seek> Debug for AudioFrameReader<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for AudioFrameReader<R> where
    R: RefUnwindSafe

impl<R> Send for AudioFrameReader<R> where
    R: Send

impl<R> Sync for AudioFrameReader<R> where
    R: Sync

impl<R> Unpin for AudioFrameReader<R> where
    R: Unpin

impl<R> UnwindSafe for AudioFrameReader<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.