pub struct MixerBlock<S: Sample> { /* private fields */ }Expand description
A channel-wise audio mixer that sums multiple sources per output channel.
Unlike MatrixMixerBlock which requires explicit
gain setup, MixerBlock automatically groups inputs by channel and sums them. This is
useful for combining multiple audio sources into a single stereo (or N-channel) output.
§Input Organization
Inputs are organized in groups, where each group represents one source’s contribution to all output channels. For stereo output with 3 sources:
- Inputs 0, 1: Source A (L, R)
- Inputs 2, 3: Source B (L, R)
- Inputs 4, 5: Source C (L, R)
The mixer sums: Output L = A.L + B.L + C.L, Output R = A.R + B.R + C.R
Implementations§
Source§impl<S: Sample> MixerBlock<S>
impl<S: Sample> MixerBlock<S>
Sourcepub fn stereo(num_sources: usize) -> Self
pub fn stereo(num_sources: usize) -> Self
Create a stereo mixer for the given number of sources.
Sourcepub fn with_normalization(self, normalization: NormalizationStrategy) -> Self
pub fn with_normalization(self, normalization: NormalizationStrategy) -> Self
Set the normalization strategy.
Sourcepub fn num_sources(&self) -> usize
pub fn num_sources(&self) -> usize
Returns the number of sources being mixed.
Sourcepub fn num_channels(&self) -> usize
pub fn num_channels(&self) -> usize
Returns the number of output channels.
Trait Implementations§
Source§impl<S: Sample> Block<S> for MixerBlock<S>
impl<S: Sample> Block<S> for MixerBlock<S>
Source§fn process(
&mut self,
inputs: &[&[S]],
outputs: &mut [&mut [S]],
_modulation_values: &[S],
_context: &DspContext,
)
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
fn input_count(&self) -> usize
Returns the number of input ports this block accepts.
Source§fn output_count(&self) -> usize
fn output_count(&self) -> usize
Returns the number of output ports this block produces.
Source§fn modulation_outputs(&self) -> &[ModulationOutput]
fn modulation_outputs(&self) -> &[ModulationOutput]
Returns the modulation outputs this block provides. Read more
Source§fn channel_config(&self) -> ChannelConfig
fn channel_config(&self) -> ChannelConfig
Returns how this block handles multi-channel audio. Read more
Source§impl<S: Sample> From<MixerBlock<S>> for BlockType<S>
impl<S: Sample> From<MixerBlock<S>> for BlockType<S>
Source§fn from(block: MixerBlock<S>) -> Self
fn from(block: MixerBlock<S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<S> Freeze for MixerBlock<S>
impl<S> RefUnwindSafe for MixerBlock<S>where
S: RefUnwindSafe,
impl<S> Send for MixerBlock<S>
impl<S> Sync for MixerBlock<S>
impl<S> Unpin for MixerBlock<S>where
S: Unpin,
impl<S> UnwindSafe for MixerBlock<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more