pub struct WaveFile { /* private fields */ }
Implementations§
Source§impl WaveFile
impl WaveFile
Sourcepub fn open<S: Into<String>>(path: S) -> Result<WaveFile, WaveError>
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)
};
Sourcepub fn sample_rate(&self) -> usize
pub fn sample_rate(&self) -> usize
The number of samples present for one second of audio.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The total number of frames present in the file.
Each frame will contain channels()
number of samples.
pub fn bits_per_sample(&self) -> usize
pub fn data_format(&self) -> Format
pub fn speakers(&self) -> Option<Vec<SpeakerPosition>>
Sourcepub fn info(&self) -> WaveInfo
pub fn info(&self) -> WaveInfo
Returns a copy of the WaveInfo
for this file,
parsed from the file header.
Sourcepub fn iter(&self) -> WaveFileIterator<'_> ⓘ
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§
impl Freeze for WaveFile
impl RefUnwindSafe for WaveFile
impl Send for WaveFile
impl Sync for WaveFile
impl Unpin for WaveFile
impl UnwindSafe for WaveFile
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