Struct WaveFile

Source
pub struct WaveFile { /* private fields */ }

Implementations§

Source§

impl WaveFile

Source

pub fn open<S: Into<String>>(path: S) -> Result<WaveFile, WaveError>

Constructs a new WaveFile.

§Example
use wavefile::{WaveFile,WaveError};

match WaveFile::open("./fixtures/test-s24le.wav") {
  Ok(f)  => f,
  Err(e) => panic!("Couldn't open example file: {}", e)
};
Source

pub fn channels(&self) -> usize

The number of audio channels in the file.

Source

pub fn sample_rate(&self) -> usize

The number of samples present for one second of audio.

Source

pub fn len(&self) -> usize

The total number of frames present in the file. Each frame will contain channels() number of samples.

Source

pub fn bits_per_sample(&self) -> usize

Source

pub fn data_format(&self) -> Format

Source

pub fn speakers(&self) -> Option<Vec<SpeakerPosition>>

Source

pub fn info(&self) -> WaveInfo

Returns a copy of the WaveInfo for this file, parsed from the file header.

Source

pub fn iter(&self) -> WaveFileIterator<'_>

Returns an iterator which yields each individual Frame successively until it reaches the end of the file.

§Example
use wavefile::WaveFile;

let wav = WaveFile::open("./fixtures/test-s24le.wav").unwrap();

for frame in wav.iter() {
  println!("{:?}", frame);
}

Auto Trait Implementations§

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.