[−][src]Struct riddle_audio::ClipPlayerBuilder
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::new(&bytes[..])?; // 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]
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]
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,
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, 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.
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>,