Struct riddle_audio::ClipPlayerBuilder[][src]

pub struct ClipPlayerBuilder { /* fields omitted */ }

Builder for ClipPlayer

A builder instance may be used to construct multiple players.

Example

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

// Play the clip
let player = ClipPlayerBuilder::new(&audio_system)
    .with_volume(0.5)
    .with_mode(PlayMode::Loop)
    .play(&clip)?;

Implementations

impl ClipPlayerBuilder[src]

pub fn new(audio: &AudioSystem) -> Self[src]

Make a new builder.

Defaults:

pub fn with_mode(&mut self, mode: PlayMode) -> &mut Self[src]

Set the playback mode of the player. Defaults to PlayMode::OneShot.

pub fn with_volume(&mut self, volume: f32) -> &mut Self[src]

Set the playback volume of the player. Defaults to 1.0.

pub fn play(&self, clip: &Clip) -> Result<ClipPlayer, AudioError>[src]

Build the ClipPlayer, and start playing the clip immediately.

pub fn paused(&self, clip: &Clip) -> Result<ClipPlayer, AudioError>[src]

Build the ClipPlayer in the paused state. ClipPlayer::resume will need to be called on the player to start playback.

Auto Trait Implementations

impl RefUnwindSafe for ClipPlayerBuilder

impl Send for ClipPlayerBuilder

impl Sync for ClipPlayerBuilder

impl Unpin for ClipPlayerBuilder

impl UnwindSafe for ClipPlayerBuilder

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, 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.