[][src]Struct tetra::audio::SoundInstance

pub struct SoundInstance { /* fields omitted */ }

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.

Implementations

impl SoundInstance[src]

pub fn play(&self)[src]

Plays the sound if it is stopped, or resumes the sound if it is paused.

pub fn stop(&self)[src]

Stops the sound. If playback is resumed, it will start over from the beginning.

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]

Returns the current state of playback.

pub fn set_state(&self, state: SoundState)[src]

Sets the current state of playback.

In most cases, using the play, stop and pause methods is easier than explicitly setting a state, but this may be useful when, for example, defining transitions from one state to another.

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]

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]

Sets whether the sound should repeat or not.

pub fn toggle_repeating(&self)[src]

Toggles whether the sound should repeat or not.

Trait Implementations

impl Clone for SoundInstance[src]

impl Debug for SoundInstance[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.