Struct riddle_audio::Clip [−][src]
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]
R: Read,
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]
data: R,
format: ClipFormat
) -> Result<Clip, AudioError> where
R: AsyncRead + Unpin,
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,