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

PROPERTY
Gain per input channel. Array of four numbers. Default value for all: 1. Changes between consecutive process() calls are automatically smoothed.
TypeMinMaxDefault
Array[4]

inputGain

PROPERTY
Gain per input channel. Array of four numbers. Default value for all: 1. Changes between consecutive process() calls are automatically smoothed.
TypeMinMaxDefault
float[4]

outputGain

PROPERTY
Gain for the output. Default value: 1. Changes between consecutive process() calls are automatically smoothed.
TypeMinMaxDefault
Number

outputGain

PROPERTY
Gain for the output. Default value: 1. Changes between consecutive process() calls are automatically smoothed.
TypeMinMaxDefault
float

Methods

  • constructor

    METHOD
    Creates a MonoMixer instance.
    Parameters
    None
    Returns
    TypeDescription
    Superpowered.MonoMixerThe constructed instance.
  • constructor

    METHOD
    Creates a MonoMixer instance.
    Parameters
    None
    Returns
    TypeDescription
    Superpowered::MonoMixerThe constructed instance.
  • destruct

    METHOD
    Destructor to free Linear Memory.
    Parameters
    None
    Returns
    None
  • process

    METHOD
    Mixes up to 4 mono inputs into a mono output.
    Parameters
    NameTypeDescription
    input0Number (pointer in Linear Memory)32-bit input buffer for the first input. Can be 0.
    input1Number (pointer in Linear Memory)32-bit input buffer for the second input. Can be 0.
    input2Number (pointer in Linear Memory)32-bit input buffer for the third input. Can be 0.
    input3Number (pointer in Linear Memory)32-bit input buffer for the fourth input. Can be 0.
    outputNumber (pointer in Linear Memory)32-bit output buffer.
    numberOfFramesNumberNumber of frames to process. Must be a multiple of 4.
    Returns
    None
  • process

    METHOD
    Mixes up to 4 mono inputs into a mono output.
    Parameters
    NameTypeDefaultDescription
    input0float *32-bit input buffer for the first input. Can be NULL.
    input1float *32-bit input buffer for the second input. Can be NULL.
    input2float *32-bit input buffer for the third input. Can be NULL.
    input3float *32-bit input buffer for the fourth input. Can be NULL.
    outputfloat *32-bit output buffer.
    numberOfFramesunsigned intNumber of frames to process. Must be a multiple of 4.
    Returns
    None
v2.7.2