pub struct SoundSource {
pub id: String,
/* private fields */
}Expand description
Sound source in 3D space
Fields§
§id: StringUnique identifier
Implementations§
Source§impl SoundSource
impl SoundSource
Sourcepub fn new_point(id: String, position: Position3D) -> Self
pub fn new_point(id: String, position: Position3D) -> Self
Create new point source
Sourcepub fn new_directional(
id: String,
position: Position3D,
orientation: (f32, f32, f32),
directivity: DirectivityPattern,
) -> Self
pub fn new_directional( id: String, position: Position3D, orientation: (f32, f32, f32), directivity: DirectivityPattern, ) -> Self
Create new directional source
Sourcepub fn position(&self) -> Position3D
pub fn position(&self) -> Position3D
Get current position
Sourcepub fn set_position(&mut self, position: Position3D)
pub fn set_position(&mut self, position: Position3D)
Set position and update velocity
Sourcepub fn velocity(&self) -> Position3D
pub fn velocity(&self) -> Position3D
Get current velocity
Sourcepub fn set_orientation(&mut self, orientation: (f32, f32, f32))
pub fn set_orientation(&mut self, orientation: (f32, f32, f32))
Set orientation
Sourcepub fn source_type(&self) -> SourceType
pub fn source_type(&self) -> SourceType
Get source type
Sourcepub fn attenuation(&self) -> &AttenuationParams
pub fn attenuation(&self) -> &AttenuationParams
Get attenuation parameters
Sourcepub fn set_attenuation(&mut self, attenuation: AttenuationParams)
pub fn set_attenuation(&mut self, attenuation: AttenuationParams)
Set attenuation parameters
Sourcepub fn directivity(&self) -> Option<&DirectivityPattern>
pub fn directivity(&self) -> Option<&DirectivityPattern>
Get directivity pattern
Sourcepub fn set_directivity(&mut self, directivity: DirectivityPattern)
pub fn set_directivity(&mut self, directivity: DirectivityPattern)
Set directivity pattern
Sourcepub fn set_active(&mut self, active: bool)
pub fn set_active(&mut self, active: bool)
Set active state
Sourcepub fn calculate_directional_gain(&self, listener_position: Position3D) -> f32
pub fn calculate_directional_gain(&self, listener_position: Position3D) -> f32
Calculate gain based on direction for directional sources
Sourcepub fn predict_position(&self, time_ahead: Duration) -> Position3D
pub fn predict_position(&self, time_ahead: Duration) -> Position3D
Predict future position based on current velocity
Trait Implementations§
Source§impl Clone for SoundSource
impl Clone for SoundSource
Source§fn clone(&self) -> SoundSource
fn clone(&self) -> SoundSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SoundSource
impl Debug for SoundSource
Source§impl<'de> Deserialize<'de> for SoundSource
impl<'de> Deserialize<'de> for SoundSource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SoundSource
impl RefUnwindSafe for SoundSource
impl Send for SoundSource
impl Sync for SoundSource
impl Unpin for SoundSource
impl UnsafeUnpin for SoundSource
impl UnwindSafe for SoundSource
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more