Struct tetra::audio::SoundInstance [−][src]
pub struct SoundInstance { /* fields omitted */ }
Expand description
A handle to a single instance of a Sound
.
The audio thread will poll this for updates every 220 samples (roughly every 5ms at a 44100hz sample rate).
Cloning a SoundInstance
will create a new handle to the same instance,
rather than creating a new instance.
Note that dropping a SoundInstance
does not stop playback, and the underlying
data will not be freed until playback has finished. This means that dropping a
repeating SoundInstance
without stopping it
first will cause the sound to loop forever.
Implementations
impl SoundInstance
[src]
impl SoundInstance
[src]pub fn stop(&self)
[src]
pub fn stop(&self)
[src]Stops the sound. If playback is resumed, it will start over from the beginning.
pub fn pause(&self)
[src]
pub fn pause(&self)
[src]Pauses the sound. If playback is resumed, it will continue from the point where it was paused.
pub fn state(&self) -> SoundState
[src]
pub fn state(&self) -> SoundState
[src]Returns the current state of playback.
pub fn set_state(&self, state: SoundState)
[src]
pub fn set_state(&self, state: SoundState)
[src]pub fn set_volume(&self, volume: f32)
[src]
pub fn set_volume(&self, volume: f32)
[src]Sets the volume of the sound.
The parameter is used as a multiplier - for example, 1.0
would result in the
sound being played back at its original volume.
pub fn set_speed(&self, speed: f32)
[src]
pub fn set_speed(&self, speed: f32)
[src]Sets the speed (and by extension, the pitch) of the sound.
The parameter is used as a multiplier - for example, 1.0
would result in the
sound being played back at its original speed.
pub fn set_repeating(&self, repeating: bool)
[src]
pub fn set_repeating(&self, repeating: bool)
[src]Sets whether the sound should repeat or not.
pub fn toggle_repeating(&self)
[src]
pub fn toggle_repeating(&self)
[src]Toggles whether the sound should repeat or not.
Trait Implementations
impl Clone for SoundInstance
[src]
impl Clone for SoundInstance
[src]fn clone(&self) -> SoundInstance
[src]
fn clone(&self) -> SoundInstance
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for SoundInstance
impl Send for SoundInstance
impl Sync for SoundInstance
impl Unpin for SoundInstance
impl UnwindSafe for SoundInstance
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more