[][src]Struct cauldron::audio::AudioSegment

pub struct AudioSegment { /* fields omitted */ }

AudioSegment is returned to user to perform various operations and get decoded stream, audio info or encode to different format.

Methods

impl AudioSegment[src]

pub fn read(filename: &'static str, flag: CodecFlag) -> Result<AudioSegment>[src]

Constructs a new AudioSegment.

Example

use cauldron::audio::AudioSegment;
use cauldron::codecs::CodecFlag;

match AudioSegment::read("./samples/wav/test-s24le.wav", CodecFlag::WAV) {
  Ok(f)  => f,
  Err(e) => panic!("Couldn't open example file: {}", e)
};

read audio file from file path and returns AudioSegment

pub fn info(&self) -> AudioInfo[src]

returns audio info as AudioInfo

pub fn number_channels(&self) -> usize[src]

pub fn duration(&self) -> f32[src]

Returns the duration of the audio file in seconds

duration = (total_samples / no_channels) / sampling_rate

pub fn bitrate(&self) -> u32[src]

Returns bitrate of the audio in kbps

pub fn samples<'a, S: Sample + 'a>(
    &'a mut self
) -> Box<dyn AudioSamplesIterator<S> + 'a>
[src]

Returns an iterator on samples

Trait Implementations

impl Display for AudioSegment[src]

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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.

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

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

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