[][src]Struct rusty_audio::Audio

pub struct Audio { /* fields omitted */ }

A simple 4-track audio system to load/decode audio files from disk to play later. Supported formats are: MP3, WAV, Vorbis and Flac.

Methods

impl Audio[src]

pub fn new() -> Self[src]

Create a new sound subsystem. You only need one of these -- you can use it to load and play any number of audio clips.

pub fn add(&mut self, name: &'static str, path: &str)[src]

Add an audio clip to play. Audio clips will be decoded and buffered during this call so the first call to .play() is not staticky if you compile in debug mode. name is what you will refer to this clip as when you need to play it. Files known to be supported by the underlying library (rodio) at the time of this writing are MP3, WAV, Vorbis and Flac.

pub fn play(&mut self, name: &str)[src]

Play an audio clip that has already been loaded. name is the name you chose when you added the clip to the Audio system. If you forgot to load the clip first, this will crash.

pub fn wait(&self)[src]

Block until no sounds are playing. Convenient for keeping a thread alive until all sounds have played.

Auto Trait Implementations

impl Send for Audio

impl Sync for Audio

impl Unpin for Audio

impl UnwindSafe for Audio

impl RefUnwindSafe for Audio

Blanket Implementations

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

impl<T> From<T> for 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.

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]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>,