pub struct Gains {
pub left: i16,
pub right: i16,
pub listener: u8,
pub dist: i32,
}Expand description
The result of placing a sound: the two ear levels and where they came from.
§Example
use psx_sfx::space::*;
let space = Space::new(0, PanLaw::Off);
let ears = Listeners::new([Listener::new([0; 3], 0)]);
let g = gains(&space, &ears, ListenerRule::Loudest, &Emitter::new([0, 0, 100]), &Curve::Flat(900)).unwrap();
assert_eq!((g.left, g.right, g.dist), (900, 900, 100));Fields§
§left: i16Left ear level, SPU range.
right: i16Right ear level, SPU range.
listener: u8Index of the listener the sound is heard from (0 for a centroid).
dist: i32Distance to that listener, after the world shift.
Implementations§
Source§impl Gains
impl Gains
Sourcepub fn audibility(&self) -> i32
pub fn audibility(&self) -> i32
The louder ear, floored at zero: what a voice allocator ranks by.
let g = Gains { left: -3, right: 700, listener: 0, dist: 10 };
assert_eq!(g.audibility(), 700);Trait Implementations§
impl Copy for Gains
impl Eq for Gains
impl StructuralPartialEq for Gains
Auto Trait Implementations§
impl Freeze for Gains
impl RefUnwindSafe for Gains
impl Send for Gains
impl Sync for Gains
impl Unpin for Gains
impl UnsafeUnpin for Gains
impl UnwindSafe for Gains
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)