Class: MonoMixer
Overview
Mixes up to 4 mono inputs. Every input and the output has individual gain control.
One instance allocates just a few bytes of memory. Combining multiple instances of the MonoMixer is the recommended way to support more than 4 channels.
How to implement
// Constructor. Has no additional parameters.let mixer = new Superpowered.MonoMixer();// Gain per input channel. Default value for all: 1. Changes between consecutive process() calls are automatically smoothed.mixer.inputGain[2] = 0.5; // third input// Gain for the output. Default value: 1. Changes between consecutive process() calls are automatically smoothed.mixer.outputGain = 2;// Mixes up to 4 mono inputs into a mono output. Has no return value.mixer.process(input0, // Pointer to floating point numbers. 32-bit input buffer for the first input. Can be null.input1, // Pointer to floating point numbers. 32-bit input buffer for the second input. Can be null.input2, // Pointer to floating point numbers. 32-bit input buffer for the third input. Can be null.input3, // Pointer to floating point numbers. 32-bit input buffer for the fourth input. Can be null.output, // Pointer to floating point numbers. 32-bit output buffer.128 // Number of frames to process. Must be a multiple of 4.);// Destructor (to free up memory).mixer.destruct();
#include "SuperpoweredMixer.h"void initMixer() {mixer = new Superpowered::MonoMixer();// Gain per input channel. Default value for all: 1. Changes between consecutive process() calls are automatically smoothed.mixer->inputGain[2] = 0.5; // third input// Gain for the output. Default value: 1. Changes between consecutive process() calls are automatically smoothed.mixer->outputGain = 2;}void processAudio(float *interleavedInput, float *interleavedOutput, unsigned int numberOfFrames) {...mixer->process(input0, input1, input2, input3, interleavedOutput, numberOfFrames);...}
Properties
inputGain
PROPERTYGain per input channel. Array of four numbers. Default value for all: 1. Changes between consecutive process() calls are automatically smoothed.
Type | Min | Max | Default | Array[4] |
---|
inputGain
PROPERTYGain per input channel. Array of four numbers. Default value for all: 1. Changes between consecutive process() calls are automatically smoothed.
Type | Min | Max | Default | float[4] |
---|
outputGain
PROPERTYGain for the output. Default value: 1. Changes between consecutive process() calls are automatically smoothed.
Type | Min | Max | Default | Number |
---|
outputGain
PROPERTYGain for the output. Default value: 1. Changes between consecutive process() calls are automatically smoothed.
Type | Min | Max | Default | float |
---|
Methods
constructor
METHODCreates a MonoMixer instance.ParametersNoneReturnsType Description Superpowered.MonoMixer
The constructed instance. constructor
METHODCreates a MonoMixer instance.ParametersNoneReturnsType Description Superpowered::MonoMixer
The constructed instance. destruct
METHODDestructor to free Linear Memory.ParametersNoneReturnsNoneprocess
METHODMixes up to 4 mono inputs into a mono output.ParametersReturnsName Type Description input0 Number (pointer in Linear Memory)
32-bit input buffer for the first input. Can be 0. input1 Number (pointer in Linear Memory)
32-bit input buffer for the second input. Can be 0. input2 Number (pointer in Linear Memory)
32-bit input buffer for the third input. Can be 0. input3 Number (pointer in Linear Memory)
32-bit input buffer for the fourth input. Can be 0. output Number (pointer in Linear Memory)
32-bit output buffer. numberOfFrames Number
Number of frames to process. Must be a multiple of 4. Noneprocess
METHODMixes up to 4 mono inputs into a mono output.ParametersReturnsName Type Default Description input0 float *
32-bit input buffer for the first input. Can be NULL. input1 float *
32-bit input buffer for the second input. Can be NULL. input2 float *
32-bit input buffer for the third input. Can be NULL. input3 float *
32-bit input buffer for the fourth input. Can be NULL. output float *
32-bit output buffer. numberOfFrames unsigned int
Number of frames to process. Must be a multiple of 4. None