pub struct SpatialSourceManager {
pub sources: HashMap<String, SoundSource>,
pub culling_distance: f32,
/* private fields */
}Expand description
Dynamic source manager for spatial audio
Fields§
§sources: HashMap<String, SoundSource>Active sound sources
culling_distance: f32Distance-based culling threshold
Implementations§
Source§impl SpatialSourceManager
impl SpatialSourceManager
Sourcepub fn new(bounds: (Position3D, Position3D), cell_size: f32) -> Self
pub fn new(bounds: (Position3D, Position3D), cell_size: f32) -> Self
Create new spatial source manager
Sourcepub fn add_source(&mut self, source: SoundSource) -> Result<()>
pub fn add_source(&mut self, source: SoundSource) -> Result<()>
Add source to manager
Sourcepub fn remove_source(&mut self, source_id: &str) -> Option<SoundSource>
pub fn remove_source(&mut self, source_id: &str) -> Option<SoundSource>
Remove source from manager
Sourcepub fn update_source_position(
&mut self,
source_id: &str,
position: Position3D,
) -> Result<()>
pub fn update_source_position( &mut self, source_id: &str, position: Position3D, ) -> Result<()>
Update source position
Sourcepub fn get_nearby_sources(
&self,
listener_position: Position3D,
radius: f32,
) -> Vec<&SoundSource>
pub fn get_nearby_sources( &self, listener_position: Position3D, radius: f32, ) -> Vec<&SoundSource>
Get nearby sources for listener
Sourcepub fn check_occlusion(
&self,
source_position: Position3D,
listener_position: Position3D,
) -> OcclusionResult
pub fn check_occlusion( &self, source_position: Position3D, listener_position: Position3D, ) -> OcclusionResult
Check occlusion for source
Sourcepub fn cull_distant_sources(&mut self, listener_position: Position3D)
pub fn cull_distant_sources(&mut self, listener_position: Position3D)
Cull distant sources
Sourcepub fn get_active_sources(&self) -> Vec<&SoundSource>
pub fn get_active_sources(&self) -> Vec<&SoundSource>
Get all active sources
Auto Trait Implementations§
impl Freeze for SpatialSourceManager
impl RefUnwindSafe for SpatialSourceManager
impl Send for SpatialSourceManager
impl Sync for SpatialSourceManager
impl Unpin for SpatialSourceManager
impl UnsafeUnpin for SpatialSourceManager
impl UnwindSafe for SpatialSourceManager
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> 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