Jamoma API  0.6.0.a19
TTMixer Class Reference

TTMixer mixes N input channels of a signal to M output channels of a signal. More...

#include <TTMixer.h>

+ Inheritance diagram for TTMixer:
+ Collaboration diagram for TTMixer:

Protected Member Functions

TTErr setNumInputs (const TTValue &newValue)
 Set the number of audio input channels to the mixer. More...
 
TTErr setNumOutputs (const TTValue &newValue)
 Set the number of audio output channels from the mixer. More...
 
TTErr checkMatrixSize (const TTChannelCount x, const TTChannelCount y)
 Check what the current mixer size is. More...
 
TTErr clear ()
 Clear the matrix by setting all gain coefficients to 0. More...
 
TTErr restoreMatrix ()
 Restore matrix coefficients. More...
 
TTErr setGain (const TTValue &newValue, TTValue &)
 Set the gain as desibel for one inlet to one outlet. More...
 
TTErr setLinearGain (const TTValue &newValue, TTValue &)
 Set the gain as linear amplitude for one inlet to one outlet. More...
 
TTErr setMidiGain (const TTValue &newValue, TTValue &)
 Set the gain as midi value for one inlet to one outlet. More...
 
TTErr processAudio (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
 Process audio. More...
 
TTErr processAudioInterpolated (TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
 Process audio with interpolation. More...
 

Protected Attributes

TTMatrix mGainMatrix
 A NxM matrix of mixing coefficients.
 
TTBoolean mInterpolated
 A flag determine if we will be interpolating towards new matrix values whenever a gain value is being updated.
 
TTMatrix oldGainMatrix
 Required for the process of resizing when changing the number of inputs or outputs.
 
TTMatrix tempGainMatrix
 Required for the process of resizing when changing the number of inputs or outputs.
 
TTChannelCount mNumInputs
 The number of audio inputs.
 
TTChannelCount mNumOutputs
 The number of audio outputs.
 

Detailed Description

TTMixer mixes N input channels of a signal to M output channels of a signal.

Definition at line 24 of file TTMixer.h.

Member Function Documentation

TTErr TTMixer::checkMatrixSize ( const TTChannelCount  x,
const TTChannelCount  y 
)
protected

Check what the current mixer size is.

Parameters
xThe current number of audio input signals
yThe current number of audio output signals
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 126 of file TTMixer.cpp.

References kTTErrNone, mNumInputs, mNumOutputs, setNumInputs(), and setNumOutputs().

Referenced by setGain(), setLinearGain(), and setMidiGain().

+ Here is the call graph for this function:

TTErr TTMixer::clear ( )
protected

Clear the matrix by setting all gain coefficients to 0.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 119 of file TTMixer.cpp.

References TTMatrix::clear(), kTTErrNone, mGainMatrix, and oldGainMatrix.

Referenced by setNumInputs(), and setNumOutputs().

+ Here is the call graph for this function:

TTErr TTMixer::processAudio ( TTAudioSignalArrayPtr  inputs,
TTAudioSignalArrayPtr  outputs 
)
protected

Process audio.

This version of the processing method is the simpler and more efficient. It will be used whenever no gain values have been recently changes. If the mInterpolated flag is NOT set, it will also be used when gain coefficients change. This saves CPU as compared to the more expensive processAudioInterpolated method, but at the risk of audible clicks and discontinuities.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 212 of file TTMixer.cpp.

References TTAudioSignal::clear(), TTMatrix::get2d(), kTTErrNone, mGainMatrix, mNumInputs, mNumOutputs, TTAudioSignal::mSampleVectors, and TTAudioSignal::setMaxNumChannels().

Referenced by processAudioInterpolated().

+ Here is the call graph for this function:

TTErr TTMixer::processAudioInterpolated ( TTAudioSignalArrayPtr  inputs,
TTAudioSignalArrayPtr  outputs 
)
protected

Process audio with interpolation.

If a gain coefficient has been updated, and the mInterpolated flag is set, this method will be used for the next vector to be processed, and will ensure that matrix coefficients ramp (interpolate) to their new values over the duration of the next vector. Upon completion, this unit will be set to use the simpler and more efficient processAudio method again, until next time a matrix gain coefficient is changed.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 257 of file TTMixer.cpp.

References TTAudioSignal::clear(), TTMatrix::get2d(), kTTErrNone, mGainMatrix, mNumInputs, mNumOutputs, TTAudioSignal::mSampleVectors, oldGainMatrix, processAudio(), TTMatrix::set2d(), TTAudioSignal::setMaxNumChannels(), and setProcessMethod.

Referenced by setGain(), setLinearGain(), and setMidiGain().

+ Here is the call graph for this function:

TTErr TTMixer::restoreMatrix ( )
protected

Restore matrix coefficients.

This method is used when the matrix is being resized.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 98 of file TTMixer.cpp.

References TTObject::get(), TTMatrix::get2d(), kTTErrNone, mGainMatrix, mNumInputs, mNumOutputs, oldGainMatrix, TTMatrix::set2d(), and tempGainMatrix.

Referenced by setNumInputs(), and setNumOutputs().

+ Here is the call graph for this function:

TTErr TTMixer::setGain ( const TTValue newValue,
TTValue  
)
protected

Set the gain as desibel for one inlet to one outlet.

Parameters
newValueAn array of three values is expected:
  1. The audio inlet.
  2. The audio outlet.
  3. New gain value in desibel for this inlet-outlet pair

Definition at line 144 of file TTMixer.cpp.

References checkMatrixSize(), kTTErrNone, kTTErrWrongNumValues, mGainMatrix, mInterpolated, processAudioInterpolated(), TTMatrix::set2d(), setProcessMethod, TTValue::size(), and TTDecibelsToLinearGain().

+ Here is the call graph for this function:

TTErr TTMixer::setLinearGain ( const TTValue newValue,
TTValue  
)
protected

Set the gain as linear amplitude for one inlet to one outlet.

Parameters
newValueAn array of three values is expected:
  1. The audio inlet.
  2. The audio outlet.
  3. New gain value as linear amplitude for this inlet-outlet pair
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 167 of file TTMixer.cpp.

References checkMatrixSize(), kTTErrNone, kTTErrWrongNumValues, mGainMatrix, mInterpolated, processAudioInterpolated(), TTMatrix::set2d(), setProcessMethod, and TTValue::size().

+ Here is the call graph for this function:

TTErr TTMixer::setMidiGain ( const TTValue newValue,
TTValue  
)
protected

Set the gain as midi value for one inlet to one outlet.

Parameters
newValueAn array of three values is expected:
  1. The audio inlet.
  2. The audio outlet.
  3. New gain value as MIDI value for this inlet-outlet pair
Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 189 of file TTMixer.cpp.

References checkMatrixSize(), kTTErrNone, kTTErrWrongNumValues, mGainMatrix, mInterpolated, processAudioInterpolated(), TTMatrix::set2d(), setProcessMethod, TTValue::size(), and TTMidiToLinearGain().

+ Here is the call graph for this function:

TTErr TTMixer::setNumInputs ( const TTValue newValue)
protected

Set the number of audio input channels to the mixer.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 65 of file TTMixer.cpp.

References clear(), TTMatrixBase::copy(), TTMatrix::instance(), kTTErrNone, mGainMatrix, mNumInputs, mNumOutputs, oldGainMatrix, restoreMatrix(), TTObject::set(), and tempGainMatrix.

Referenced by checkMatrixSize().

+ Here is the call graph for this function:

TTErr TTMixer::setNumOutputs ( const TTValue newValue)
protected

Set the number of audio output channels from the mixer.

Returns
TTErr error code if the method fails to execute, else kTTErrNone.

Definition at line 82 of file TTMixer.cpp.

References clear(), TTMatrixBase::copy(), TTMatrix::instance(), kTTErrNone, mGainMatrix, mNumInputs, mNumOutputs, oldGainMatrix, restoreMatrix(), TTObject::set(), and tempGainMatrix.

Referenced by checkMatrixSize().

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: