StereoMultiMixer

Struct StereoMultiMixer 

Source
pub struct StereoMultiMixer<T: Float> { /* private fields */ }
Expand description

Upmix/downmix a stereo signal to an (even) multi-channel signal

When spreading out, it rotates the input by various amounts (e.g. a four-channel signal would produce (left, right, mid, side)), such that energy is preserved for each pair.

When mixing together, it uses the opposite rotations, such that upmix → downmix produces the same stereo signal (when scaled by .scaling_factor1()).

Implementations§

Source§

impl<T: Float + FromPrimitive> StereoMultiMixer<T>

Source

pub fn new(channels: usize) -> Self

Create a new mixer with the specified number of channels (must be even)

Source

pub fn stereo_to_multi(&self, input: &[T; 2], output: &mut [T])

Convert a stereo signal to a multi-channel signal

Source

pub fn multi_to_stereo(&self, input: &[T], output: &mut [T; 2])

Convert a multi-channel signal back to stereo

Source

pub fn scaling_factor1(&self) -> T

Scaling factor for the downmix, if channels are phase-aligned

Source

pub fn scaling_factor2(&self) -> T

Scaling factor for the downmix, if channels are independent

Auto Trait Implementations§

§

impl<T> Freeze for StereoMultiMixer<T>

§

impl<T> RefUnwindSafe for StereoMultiMixer<T>
where T: RefUnwindSafe,

§

impl<T> Send for StereoMultiMixer<T>
where T: Send,

§

impl<T> Sync for StereoMultiMixer<T>
where T: Sync,

§

impl<T> Unpin for StereoMultiMixer<T>
where T: Unpin,

§

impl<T> UnwindSafe for StereoMultiMixer<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.