(8.D.2.7) MixerV3
Overview
M-input x N-output mixer
Discussion
The mixer module takes multiple input signals, and "mixes" them down to provide one or more output signals
This module implements a full M-input x N-output mixer with a total of MxN coefficients. N = number of channels on the one output pin. M = sum of number of channels on all input pins. When using the module in MATLAB, the coefficients are contained in the .coeffs matrix with the gain from the ith input to the jth output found at coeffs(i, j). From the C code point of view, the .coeffs array is a one dimensional array of length MxN. The gain from input m (0 <= m <= M-1) to output n (0 <= n <= N-1) is stored at:
coeffs[m + n*M]
Put another way, the first M coefficients are the gains needed to compute the first output channel. The next M coefficients are the gains needed to compute the second output channel, and so on.
To avoid unnecessary processing and memory utilization, this module implements a sparse mixer, where only the non-zero gains are used to calculate the output channels. During runtime, if the number of mixer gains that are non-zero is > the maxNonZero argument, only the first maxNonZero gains will be used to calculate the output. The additional gain values will be ignored, regardless of their values in the matrix. Designer will display an error if the number of non-zero gains is > maxNonZero at design and build time, but will not display a warning if gains are changed while the layout is running.
When the module is bypassed, it copies the ith input channel to the ith output channel. If the module has more output channels than input channels, the remaining output channels are set to 0.
Type Definition
typedef struct _ModuleMixerV3
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 maxNonZero; // Maximum number of non zero coefficients.
INT32 numIn; // Number of input channels.
FLOAT32* gain; // Linear gain.
FLOAT32* nonZeroGain; // Instanteous gain being applied.
SparseItem * table; // Internal data holding data for quick processing
} ModuleMixerV3Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
maxNonZero | int | const | 1 | 2 | Unrestricted | Â |
numIn | int | derived | 1 | 1 | Unrestricted | Â |
gain | float* | parameter | 0 | [1 x 2] | -60:20 | Â |
nonZeroGain | float* | state | 1 | [8 x 1] | Unrestricted | Â |
table | SparseItem * | parameter | 1 | Â | Unrestricted | Â |
Pins
Input Pins
Name: in1
Description: Input signal
Data type: float
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: mixer_v3_module.m
M=mixer_v3_module(NAME, NUMOUT, NUMINPIN, MAXNONZERO)
Creates a mixer module for use in the Audio Weaver environment.
The mixer has multiple input pins and one output pin. Each of the pins
can contain multiple interleaved channels. The number of input channels
per input pin is determined by the upstream audio module. You must
specify the number of input pins and output channels.
Arguments:
NAME - name of the module.
NUMOUT - number of output channels.
NUMINPIN - number of input pins.
MAXNONZERO - maximum number of non zero coefficients.
Â