Struct riddle_audio::Clip[][src]

pub struct Clip { /* fields omitted */ }

Stores the raw data of an audio file.

To play the clip construct a ClipPlayer using a ClipPlayerBuilder.

Example

let clip_bytes = include_bytes!("../../example_assets/boop.wav");
let clip = Clip::load(&clip_bytes[..], ClipFormat::Wav)?;

Implementations

impl Clip[src]

pub fn load<R>(data: R, format: ClipFormat) -> Result<Clip, AudioError> where
    R: Read
[src]

Reads the entirety of the data reader in to memory.

An AudioError::ClipDecodeError value will be returned if the data isn’t a known format.

pub async fn load_async<R>(
    data: R,
    format: ClipFormat
) -> Result<Clip, AudioError> where
    R: AsyncRead + Unpin
[src]

Reads the entirety of the data reader in to memory, asynchronously.

An AudioError::ClipDecodeError value will be returned if the data isn’t a known format.

Example

let clip_bytes = include_bytes!("../../example_assets/boop.wav");
let clip = Clip::load_async(&clip_bytes[..], ClipFormat::Wav).await?;

pub fn duration(&self) -> Option<Duration>[src]

Get the run time of the clip, if it can be determined.

Example

let clip_bytes = include_bytes!("../../example_assets/boop.wav");
let clip = Clip::load(&clip_bytes[..], ClipFormat::Wav)?;

assert!(clip.duration().unwrap() > std::time::Duration::from_secs(0));

Trait Implementations

impl Clone for Clip[src]

Auto Trait Implementations

impl RefUnwindSafe for Clip

impl Send for Clip

impl Sync for Clip

impl Unpin for Clip

impl UnwindSafe for Clip

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.