pub struct StaticSoundHandle { /* private fields */ }
Expand description

Controls a static sound.

Implementations§

source§

impl StaticSoundHandle

source

pub fn state(&self) -> PlaybackState

Returns the current playback state of the sound.

source

pub fn position(&self) -> f64

Returns the current playback position of the sound (in seconds).

source

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).

source

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.

source

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.

source

pub fn pause(&mut self, tween: Tween) -> Result<(), CommandError>

Fades out the sound to silence with the given tween and then pauses playback.

source

pub fn resume(&mut self, tween: Tween) -> Result<(), CommandError>

Resumes playback and fades in the sound from silence with the given tween.

source

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.

source

pub fn seek_to(&mut self, position: f64) -> Result<(), CommandError>

Sets the playback position to the specified time in seconds.

source

pub fn seek_by(&mut self, amount: f64) -> Result<(), CommandError>

Moves the playback position by the specified amount of time in seconds.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for Fwhere T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,