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

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

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

Pauses the sound. If playback is resumed, it will continue from the point where it was paused.

Returns the current state of playback.

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.

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.

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.

Sets whether the sound should repeat or not.

Toggles whether the sound should repeat or not.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.