pub struct MatrixMixerBlock<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: Sample> MatrixMixerBlock<S>
impl<S: Sample> MatrixMixerBlock<S>
Sourcepub fn new(inputs: usize, outputs: usize) -> Self
pub fn new(inputs: usize, outputs: usize) -> Self
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.
Sourcepub fn identity(channels: usize) -> Self
pub fn identity(channels: usize) -> Self
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.
Sourcepub fn get_gain(&self, input: usize, output: usize) -> S
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.
Sourcepub fn num_inputs(&self) -> usize
pub fn num_inputs(&self) -> usize
Returns the number of input channels.
Sourcepub fn num_outputs(&self) -> usize
pub fn num_outputs(&self) -> usize
Returns the number of output channels.