Struct SndFile

Source
pub struct SndFile { /* private fields */ }
Expand description

Main struct of this crate.

Implementations§

Source§

impl SndFile

Source

pub fn get_samplerate(&self) -> usize

Get sample rate.

Return values should be greater than zero.

Source

pub fn get_channels(&self) -> usize

Get channel count.

Return values should be greater than zero.

Source

pub fn get_major_format(&self) -> MajorFormat

Get audio container format

Source

pub fn get_subtype_format(&self) -> SubtypeFormat

Get audio encoding format

Source

pub fn get_endian(&self) -> Endian

Get audio file endian

Usually returns Endian::File

Source

pub fn is_seekable(&self) -> bool

Check if this file seekable

If not, many functions like len or read_all_to_vec will return an error.

Source

pub fn get_raw_struct(&self) -> &UnsafeSndFile

Useful if you want to do something unsafe.

Source

pub fn get_tag(&self, t: TagType) -> Option<String>

Get tag string, e.g., artist, album, etc.

Source

pub fn set_tag(&mut self, t: TagType, v: &str) -> Result<(), SndFileError>

Set tag string

Source

pub fn seek(&mut self, pos: SeekFrom) -> Result<u64, ()>

Modify the I/O cursor.

Source

pub fn len(&mut self) -> Result<u64, ()>

Get the length of audio file.

This function may affect the I/O cursor.

Trait Implementations§

Source§

impl Debug for SndFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl SndFileIO<f32> for SndFile

Source§

fn read_to_slice(&mut self, dst: &mut [f32]) -> Result<usize, ()>

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_slice(&mut self, src: &[f32]) -> Result<usize, ()>

Read frames from file, returns the number of frames written if success. Read more
Source§

fn read_all_to_vec(&mut self) -> Result<Vec<f32>, ()>

Read all frames into a Vec<_> if success. Read more
Source§

fn read_to_iter<'a, I>(&mut self, dst: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = &'a mut T>,

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_iter<'a, I>(&mut self, src: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = T>,

Read frames from file, returns the number of frames written if success. Read more
Source§

impl SndFileIO<f64> for SndFile

Source§

fn read_to_slice(&mut self, dst: &mut [f64]) -> Result<usize, ()>

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_slice(&mut self, src: &[f64]) -> Result<usize, ()>

Read frames from file, returns the number of frames written if success. Read more
Source§

fn read_all_to_vec(&mut self) -> Result<Vec<f64>, ()>

Read all frames into a Vec<_> if success. Read more
Source§

fn read_to_iter<'a, I>(&mut self, dst: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = &'a mut T>,

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_iter<'a, I>(&mut self, src: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = T>,

Read frames from file, returns the number of frames written if success. Read more
Source§

impl SndFileIO<i16> for SndFile

Source§

fn read_to_slice(&mut self, dst: &mut [i16]) -> Result<usize, ()>

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_slice(&mut self, src: &[i16]) -> Result<usize, ()>

Read frames from file, returns the number of frames written if success. Read more
Source§

fn read_all_to_vec(&mut self) -> Result<Vec<i16>, ()>

Read all frames into a Vec<_> if success. Read more
Source§

fn read_to_iter<'a, I>(&mut self, dst: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = &'a mut T>,

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_iter<'a, I>(&mut self, src: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = T>,

Read frames from file, returns the number of frames written if success. Read more
Source§

impl SndFileIO<i32> for SndFile

Source§

fn read_to_slice(&mut self, dst: &mut [i32]) -> Result<usize, ()>

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_slice(&mut self, src: &[i32]) -> Result<usize, ()>

Read frames from file, returns the number of frames written if success. Read more
Source§

fn read_all_to_vec(&mut self) -> Result<Vec<i32>, ()>

Read all frames into a Vec<_> if success. Read more
Source§

fn read_to_iter<'a, I>(&mut self, dst: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = &'a mut T>,

Read frames from current I/O cursor, returns the number of frames read if success. Read more
Source§

fn write_from_iter<'a, I>(&mut self, src: I) -> Result<usize, ()>
where I: ExactSizeIterator<Item = T>,

Read frames from file, returns the number of frames written if success. Read more
Source§

impl SndFileNDArrayIO<f32> for SndFile

Source§

impl SndFileNDArrayIO<f64> for SndFile

Source§

impl SndFileNDArrayIO<i16> for SndFile

Source§

impl SndFileNDArrayIO<i32> for SndFile

Source§

impl Send for SndFile

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.