Struct let_engine::resources::sounds::Sound
source · pub struct Sound { /* private fields */ }Expand description
A playable sound.
You can bind an object to this sound making it directional.
Implementations§
source§impl Sound
impl Sound
sourcepub fn new(data: SoundData, settings: SoundSettings) -> Self
pub fn new(data: SoundData, settings: SoundSettings) -> Self
Makes a new sound with the given settings and data.
sourcepub fn set_settings(&mut self, settings: SoundSettings)
pub fn set_settings(&mut self, settings: SoundSettings)
Sets the settings of this sound.
sourcepub fn settings(&self) -> SoundSettings
pub fn settings(&self) -> SoundSettings
Returns the settings of this sounds.
sourcepub fn set_spatial_settings(&mut self, settings: SpatialSettings)
pub fn set_spatial_settings(&mut self, settings: SpatialSettings)
Sets the spatial settings of this sound.
Spatial settings are applied with the play function.
sourcepub fn spatial_settings(&self) -> SpatialSettings
pub fn spatial_settings(&self) -> SpatialSettings
Returns the spatial settings of this sounds.
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<()>
pub fn set_volume( &mut self, volume: impl Into<Volume>, tween: Tween ) -> Result<()>
Sets the volume of the sound.
Returns an error in case the command queue is full.
sourcepub fn set_playback_rate(
&mut self,
playback_rate: impl Into<PlaybackRate>,
tween: Tween
) -> Result<()>
pub fn set_playback_rate( &mut self, playback_rate: impl Into<PlaybackRate>, tween: Tween ) -> Result<()>
Sets the rate, at which the sound is getting played.
Returns an error in case the command queue is full.
sourcepub fn set_panning(&mut self, panning: f64, tween: Tween) -> Result<()>
pub fn set_panning(&mut self, panning: f64, tween: Tween) -> Result<()>
Sets the panning of the sound, where 0.0 is left and 1.0 is right.
Returns an error in case the command queue is full.
sourcepub fn set_playback_region(
&mut self,
playback_region: impl Into<Region>
) -> Result<()>
pub fn set_playback_region( &mut self, playback_region: impl Into<Region> ) -> Result<()>
Sets the region, where the sound is getting played.
Returns an error in case the command queue is full.
sourcepub fn set_loop_region(
&mut self,
loop_region: impl IntoOptionalRegion
) -> Result<()>
pub fn set_loop_region( &mut self, loop_region: impl IntoOptionalRegion ) -> Result<()>
Sets the optional region, where the sound is getting looped.
Returns an error in case the command queue is full.
sourcepub fn bind_to_object(&mut self, object: Option<&Object>)
pub fn bind_to_object(&mut self, object: Option<&Object>)
Binds an object to this sound and plays it where this object is located at.
sourcepub fn update(&mut self, tween: Tween) -> Result<()>
pub fn update(&mut self, tween: Tween) -> Result<()>
Updates the position of the sound.
Returns an error in case the command queue is full.
sourcepub fn pause(&mut self, tween: Tween) -> Result<()>
pub fn pause(&mut self, tween: Tween) -> Result<()>
Pauses this sound.
Returns an error in case the command queue is full.
sourcepub fn resume(&mut self, tween: Tween) -> Result<()>
pub fn resume(&mut self, tween: Tween) -> Result<()>
Resumes the playback of this sound.
Returns an error in case the command queue is full.
sourcepub fn stop(&mut self, tween: Tween) -> Result<()>
pub fn stop(&mut self, tween: Tween) -> Result<()>
Stops this sound.
Returns an error in case the command queue is full.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Sound
impl Send for Sound
impl Sync for Sound
impl Unpin for Sound
impl !UnwindSafe for Sound
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.