pub struct Sound<G: Eq + Hash + Send + 'static = ()> { /* private fields */ }
Expand description
Represents a sound in the AudioEngine.
If this is dropped, the sound will continue to play, but will be removed when it reachs its ends, even if it is set to loop.
Implementations§
Source§impl<G: Eq + Hash + Send + 'static> Sound<G>
impl<G: Eq + Hash + Send + 'static> Sound<G>
Sourcepub fn play(&mut self)
pub fn play(&mut self)
Starts or continue to play the sound.
If the sound was paused or stop, it will start playing again. Otherwise, does nothing.
Sourcepub fn pause(&mut self)
pub fn pause(&mut self)
Pause the sound.
If the sound is playing, it will pause. If play is called, this sound will continue from where it was before pause. If the sound is not playing, does nothing.
Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Stop the sound.
If the sound is playing, it will pause and reset the song. When play is called, this sound will start from the beginning. Even if the sound is not playing, it will reset the sound to the start.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the sound to the start.
The behaviour is the same being the sound playing or not.
Sourcepub fn set_volume(&mut self, volume: f32)
pub fn set_volume(&mut self, volume: f32)
Set the volume of the sound.