Struct kira::sound::static_sound::StaticSoundHandle
source · pub struct StaticSoundHandle { /* private fields */ }
Expand description
Controls a static sound.
Implementations§
source§impl StaticSoundHandle
impl StaticSoundHandle
sourcepub fn state(&self) -> PlaybackState
pub fn state(&self) -> PlaybackState
Returns the current playback state of the sound.
sourcepub fn set_volume(
&mut self,
volume: impl Into<Volume>,
tween: Tween
) -> Result<(), CommandError>
pub fn set_volume( &mut self, volume: impl Into<Volume>, tween: Tween ) -> Result<(), CommandError>
Sets the volume of the sound (as a factor of the original volume).
sourcepub fn set_playback_rate(
&mut self,
playback_rate: impl Into<PlaybackRate>,
tween: Tween
) -> Result<(), CommandError>
pub fn set_playback_rate( &mut self, playback_rate: impl Into<PlaybackRate>, tween: Tween ) -> Result<(), CommandError>
Sets the playback rate of the sound.
Changing the playback rate will change both the speed and pitch of the sound.
sourcepub fn set_panning(
&mut self,
panning: f64,
tween: Tween
) -> Result<(), CommandError>
pub fn set_panning( &mut self, panning: f64, tween: Tween ) -> Result<(), CommandError>
Sets the panning of the sound, where 0.0
is hard left,
0.5
is center, and 1.0
is hard right.
sourcepub fn pause(&mut self, tween: Tween) -> Result<(), CommandError>
pub fn pause(&mut self, tween: Tween) -> Result<(), CommandError>
Fades out the sound to silence with the given tween and then pauses playback.
sourcepub fn resume(&mut self, tween: Tween) -> Result<(), CommandError>
pub fn resume(&mut self, tween: Tween) -> Result<(), CommandError>
Resumes playback and fades in the sound from silence with the given tween.
sourcepub fn stop(&mut self, tween: Tween) -> Result<(), CommandError>
pub fn stop(&mut self, tween: Tween) -> Result<(), CommandError>
Fades out the sound to silence with the given tween and then stops playback.
Once the sound is stopped, it cannot be restarted.