SynthLab SDK
SynthLab::ModMatrix Class Reference

Very customizable modulation matrix object. More...

#include <modmatrix.h>

Public Member Functions

 ModMatrix (std::shared_ptr< ModMatrixParameters > _parameters)
 Clears out matrix arrays for initial state. More...
 
virtual ~ModMatrix ()
 
void addModSource (uint32_t sourceArrayIndex, double *sourceModPtr)
 Adds a modulation source to the matrix. More...
 
void clearModSource (uint32_t sourceArrayIndex)
 Removes a modulation source to the matrix. More...
 
void addModDestination (uint32_t destArrayIndex, double *destModPtr, uint32_t transform=kNoMMTransform)
 Adds a modulation destination to the matrix. More...
 
void clearModDestination (uint32_t destArrayIndex)
 Removes a modulation destination to the matrix. More...
 
void clearModMatrixArrays ()
 Clears out all source and destination pointers from the array. More...
 
void runModMatrix ()
 Runs the modulation matrix (see Synth book) More...
 
std::shared_ptr< ModMatrixParametersgetParameters ()
 

Protected Attributes

std::shared_ptr< ModMatrixParametersparameters = nullptr
 
double * modSourceData [kNumberModSources]
 
double * modDestinationData [kNumberModDestinations]
 
uint32_t modDestTransform [kNumberModDestinations]
 

Detailed Description

Very customizable modulation matrix object.

  • has no base class
  • implements a modulation matrix using row/column paradigm
  • See the ModMatrixParameters structure also
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included and described in further detail in Designing Software Synthesizer Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2021 / 04 / 26

Constructor & Destructor Documentation

◆ ModMatrix()

SynthLab::ModMatrix::ModMatrix ( std::shared_ptr< ModMatrixParameters _parameters)

Clears out matrix arrays for initial state.

default constructor

Parameters
_parametersshared parameters
Returns
the processed sample

◆ ~ModMatrix()

virtual SynthLab::ModMatrix::~ModMatrix ( )
inlinevirtual

empty destructor

Member Function Documentation

◆ addModDestination()

void SynthLab::ModMatrix::addModDestination ( uint32_t  destArrayIndex,
double *  destModPtr,
uint32_t  transform = kNoMMTransform 
)

Adds a modulation destination to the matrix.

  • each destination is uniquely identified and placed into an array slot
  • a transform is optionally applied during modulation calculation
Parameters
destArrayIndexunique index in the source array
destModPtrpointer to the modulation source value connected to the slot
transformoptional transform, see .h
Returns
the processed sample

◆ addModSource()

void SynthLab::ModMatrix::addModSource ( uint32_t  sourceArrayIndex,
double *  sourceModPtr 
)

Adds a modulation source to the matrix.

  • each source is uniquely identified and placed into an array slot
Parameters
sourceArrayIndexunique index in the source array
sourceModPtrpointer to the modulation source value connected to the slot
Returns
the processed sample

◆ clearModDestination()

void SynthLab::ModMatrix::clearModDestination ( uint32_t  destArrayIndex)

Removes a modulation destination to the matrix.

  • each destination is uniquely identified and placed into an array slot
Parameters
destArrayIndexunique index in the source array
Returns
the processed sample

◆ clearModMatrixArrays()

void SynthLab::ModMatrix::clearModMatrixArrays ( )

Clears out all source and destination pointers from the array.

  • usually only done once during the initialization process
Returns
the processed sample

◆ clearModSource()

void SynthLab::ModMatrix::clearModSource ( uint32_t  sourceArrayIndex)

Removes a modulation source to the matrix.

  • each source is uniquely identified and placed into an array slot
Parameters
sourceArrayIndexunique index in the source array
Returns
the processed sample

◆ getParameters()

std::shared_ptr<ModMatrixParameters> SynthLab::ModMatrix::getParameters ( )
inline

for standalone operation only

◆ runModMatrix()

void SynthLab::ModMatrix::runModMatrix ( )

Runs the modulation matrix (see Synth book)

  • loops over source-destination pairs that are programmed during voice construction or as cores are loaded/unloaded
  • fetches source value and accumulates with destination modulation value
  • may apply a transform if needed
Returns
the processed sample

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