Trait ggez::audio::SoundSource[][src]

pub trait SoundSource {
Show 17 methods fn play_later(&self) -> GameResult;
fn play_detached(&mut self, ctx: &Context) -> GameResult;
fn set_repeat(&mut self, repeat: bool);
fn set_fade_in(&mut self, dur: Duration);
fn set_pitch(&mut self, ratio: f32);
fn repeat(&self) -> bool;
fn pause(&self);
fn resume(&self);
fn stop(&mut self, ctx: &Context) -> GameResult;
fn stopped(&self) -> bool;
fn volume(&self) -> f32;
fn set_volume(&mut self, value: f32);
fn paused(&self) -> bool;
fn playing(&self) -> bool;
fn elapsed(&self) -> Duration;
fn set_query_interval(&mut self, t: Duration); fn play(&mut self, ctx: &Context) -> GameResult { ... }
}
Expand description

A trait defining the operations possible on a sound; it is implemented by both Source and SpatialSource.

Required methods

Plays the SoundSource; waits until done if the sound is currently playing

Play source “in the background”; cannot be stopped

Sets the source to repeat playback infinitely on next play()

Sets the fade-in time of the source

Sets the speed ratio (by adjusting the playback speed)

Gets whether or not the source is set to repeat.

Pauses playback

Resumes playback

Stops playback

Returns whether or not the source is stopped – that is, has no more data to play.

Gets the current volume.

Sets the current volume.

Get whether or not the source is paused.

Get whether or not the source is playing (ie, not paused and not stopped).

Get the time the source has been playing since the last call to play().

Time measurement is based on audio samples consumed, so it may drift from the system

Set the update interval of the internal sample counter.

This parameter determines the precision of the time measured by elapsed().

Provided methods

Plays the audio source; restarts the sound if currently playing

Implementors