pub enum PanLaw {
Off,
Sum,
Dot,
EqualPower(Center),
Custom(fn(i32, i32) -> (i32, i32)),
}Expand description
How a level is split over two ears.
pan is Q12 from -PAN_RIGHT (hard left) to PAN_RIGHT (hard
right).
§Example
use psx_sfx::space::{PanLaw, PAN_RIGHT};
// Quake's law: each ear gets (1 -+ pan) of the level.
let (l, r) = PanLaw::Dot.apply(1000, PAN_RIGHT / 2);
assert_eq!((l, r), (500, 1500));Variants§
Off
Both ears get the level: a mono source.
Sum
WipEout’s constant-sum law. The ears get v + d and v - d with
d = (v * -pan) >> 13, so a pan of PAN_RIGHT is a quarter turn and
moves half the level across. With pan = -4a this is bit for bit the
retail v * a >> 11 split, including the floor rounding.
Dot
Quake’s law: the left ear gets v * (1 - pan), the right v * (1 + pan).
EqualPower(Center)
Constant power: left = cos, right = sin of a quarter turn swept by
the pan, from the 256-entry sine table in psx-math.
Custom(fn(i32, i32) -> (i32, i32))
The caller’s own law, for retail-exact reproduction. Receives the level and the pan and returns the two ear levels.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PanLaw
impl RefUnwindSafe for PanLaw
impl Send for PanLaw
impl Sync for PanLaw
impl Unpin for PanLaw
impl UnsafeUnpin for PanLaw
impl UnwindSafe for PanLaw
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)