Struct MatrixMixerBlock

Source
pub struct MatrixMixerBlock<S>
where S: Sample,
{ /* private fields */ }
Expand description

An NxM mixing matrix for flexible channel routing.

Each output is a weighted sum of all inputs, allowing arbitrary channel mixing configurations. The gain matrix determines how much of each input contributes to each output.

§Example

A 4x2 matrix mixer can down-mix 4 channels to stereo by setting appropriate gains for left/right output combinations.

Implementations§

Source§

impl<S> MatrixMixerBlock<S>
where S: Sample,

Source

pub fn new(inputs: usize, outputs: usize) -> MatrixMixerBlock<S>

Create a new matrix mixer with the given input and output counts.

All gains are initialized to zero.

§Panics

Panics if inputs or outputs is 0 or greater than 16.

Source

pub fn identity(channels: usize) -> MatrixMixerBlock<S>

Create a matrix mixer initialized as an identity matrix (passthrough).

Each input channel maps directly to the corresponding output channel with unity gain. Requires inputs == outputs.

§Panics

Panics if channels is 0 or greater than 16.

Source

pub fn set_gain(&mut self, input: usize, output: usize, gain: S)

Set the gain for a specific input-to-output routing.

§Arguments
  • input - The input channel index (0-based)
  • output - The output channel index (0-based)
  • gain - The gain to apply (typically 0.0 to 1.0)
§Panics

Panics if input >= num_inputs or output >= num_outputs.

Source

pub fn get_gain(&self, input: usize, output: usize) -> S

Get the gain for a specific input-to-output routing.

§Panics

Panics if input >= num_inputs or output >= num_outputs.

Source

pub fn num_inputs(&self) -> usize

Returns the number of input channels.

Source

pub fn num_outputs(&self) -> usize

Returns the number of output channels.

Trait Implementations§

Source§

impl<S> Block<S> for MatrixMixerBlock<S>
where S: Sample,

Source§

fn process( &mut self, inputs: &[&[S]], outputs: &mut [&mut [S]], _modulation_values: &[S], _context: &DspContext, )

Process audio through this block. Read more
Source§

fn input_count(&self) -> usize

Returns the number of input ports this block accepts.
Source§

fn output_count(&self) -> usize

Returns the number of output ports this block produces.
Source§

fn modulation_outputs(&self) -> &[ModulationOutput]

Returns the modulation outputs this block provides. Read more
Source§

fn channel_config(&self) -> ChannelConfig

Returns how this block handles multi-channel audio. Read more
Source§

fn set_smoothing(&mut self, _sample_rate: f64, _ramp_time_ms: f64)

Configure smoothing time for parameter changes. Read more
Source§

impl<S> From<MatrixMixerBlock<S>> for BlockType<S>
where S: Sample,

Source§

fn from(block: MatrixMixerBlock<S>) -> BlockType<S>

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<S> Freeze for MatrixMixerBlock<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for MatrixMixerBlock<S>
where S: RefUnwindSafe,

§

impl<S> Send for MatrixMixerBlock<S>

§

impl<S> Sync for MatrixMixerBlock<S>

§

impl<S> Unpin for MatrixMixerBlock<S>
where S: Unpin,

§

impl<S> UnwindSafe for MatrixMixerBlock<S>
where S: 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.