pub struct Space2d {
pub width: f32,
pub min_distance: f32,
pub max_distance: f32,
pub model: Distance,
}Expand description
How a 2D position relative to the listener becomes a pan and a gain.
The horizontal offset x pans the sound with the mixer’s constant-power law:
pan = x / width, limited to -1..=1, so a sound width units to the right is fully
right. The distance d = √(x² + y²) sets a gain of 1 up to min_distance and 0 from
max_distance; in between, Distance::Linear falls in a straight line and
Distance::Inverse follows min/d, shifted and scaled so it reaches 0 at the
maximum instead of jumping there.
Fields§
§width: f32Horizontal offset at which a sound is fully to one side. Default 1.
min_distance: f32Distance up to which a sound plays at full gain. Default 1.
max_distance: f32Distance from which a sound is silent. Default 10.
model: DistanceImplementations§
Trait Implementations§
impl Copy for Space2d
impl StructuralPartialEq for Space2d
Auto Trait Implementations§
impl Freeze for Space2d
impl RefUnwindSafe for Space2d
impl Send for Space2d
impl Sync for Space2d
impl Unpin for Space2d
impl UnsafeUnpin for Space2d
impl UnwindSafe for Space2d
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