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

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

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

Required methods

pub fn play_later(&self) -> GameResult[src]

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

pub fn play_detached(&mut self, ctx: &Context) -> GameResult[src]

Play source "in the background"; cannot be stopped

pub fn set_repeat(&mut self, repeat: bool)[src]

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

pub fn set_fade_in(&mut self, dur: Duration)[src]

Sets the fade-in time of the source

pub fn set_pitch(&mut self, ratio: f32)[src]

Sets the speed ratio (by adjusting the playback speed)

pub fn repeat(&self) -> bool[src]

Gets whether or not the source is set to repeat.

pub fn pause(&self)[src]

Pauses playback

pub fn resume(&self)[src]

Resumes playback

pub fn stop(&mut self, ctx: &Context) -> GameResult[src]

Stops playback

pub fn stopped(&self) -> bool[src]

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

pub fn volume(&self) -> f32[src]

Gets the current volume.

pub fn set_volume(&mut self, value: f32)[src]

Sets the current volume.

pub fn paused(&self) -> bool[src]

Get whether or not the source is paused.

pub fn playing(&self) -> bool[src]

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

pub fn elapsed(&self) -> Duration[src]

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

pub fn set_query_interval(&mut self, t: Duration)[src]

Set the update interval of the internal sample counter.

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

Loading content...

Provided methods

pub fn play(&mut self, ctx: &Context) -> GameResult[src]

Plays the audio source; restarts the sound if currently playing

Loading content...

Implementors

impl SoundSource for Source[src]

impl SoundSource for SpatialSource[src]

pub fn play_later(&self) -> GameResult[src]

Plays the SpatialSource; waits until done if the sound is currently playing.

Loading content...