Struct rg3d_sound::source::spatial::SpatialSource [−][src]
pub struct SpatialSource { /* fields omitted */ }
Expand description
See module docs.
Implementations
Sets position of source in world space.
Sets radius of imaginable sphere around source in which no distance attenuation is applied.
Sets rolloff factor. Rolloff factor is used in distance attenuation and has different meaning in various distance models. It is applicable only for InverseDistance and ExponentDistance distance models. See DistanceModel docs for formulae.
Returns rolloff factor.
Sets maximum distance until which distance gain will be applicable. Basically it doing this min(max(distance, radius), max_distance) which clamps distance in radius..max_distance range. From listener’s perspective this will sound like source has stopped decreasing its volume even if distance continue to grow.
Returns max distance.
Returns shared reference to inner generic source.
Returns mutable reference to inner generic source.
Methods from Deref<Target = GenericSource>
Returns the name of the sound source.
pub fn set_buffer(
&mut self,
buffer: Option<Arc<Mutex<SoundBuffer>>>
) -> Result<Option<Arc<Mutex<SoundBuffer>>>, SoundError>
[src]
pub fn set_buffer(
&mut self,
buffer: Option<Arc<Mutex<SoundBuffer>>>
) -> Result<Option<Arc<Mutex<SoundBuffer>>>, SoundError>
[src]Changes buffer of source. Returns old buffer. Source will continue playing from beginning, old position will be discarded.
Marks buffer for single play. It will be automatically destroyed when it will finish playing.
Notes
Make sure you not using handles to “play once” sounds, attempt to get reference of “play once” sound may result in panic if source already deleted. Looping sources will never be automatically deleted because their playback never stops.
Returns true if this source is marked for single play, false - otherwise.
Sets new gain (volume) of sound. Value should be in 0..1 range, but it is not clamped and larger values can be used to “overdrive” sound.
Notes
Physical volume has non-linear scale (logarithmic) so perception of sound at 0.25 gain will be different if logarithmic scale was used.
Sets panning coefficient. Value must be in -1..+1 range. Where -1 - only left channel will be audible, 0 - both, +1 - only right.
Returns current panning coefficient in -1..+1 range. For more info see set_panning
. Default value is 0.
Enabled or disables sound looping. Looping sound will never stop by itself, but can be stopped or paused
by calling stop
or pause
methods. Useful for music, ambient sounds, etc.
Returns looping status.
Sets sound pitch. Defines “tone” of sounds. Default value is 1.0
Stops sound source. Automatically rewinds streaming buffers.
Returns playback duration.
Sets playback duration.
Trait Implementations
type Target = GenericSource
type Target = GenericSource
The resulting type after dereferencing.
Auto Trait Implementations
impl RefUnwindSafe for SpatialSource
impl Send for SpatialSource
impl Sync for SpatialSource
impl Unpin for SpatialSource
impl UnwindSafe for SpatialSource
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
pub fn vzip(self) -> V