Krotos Modules 3
Loading...
Searching...
No Matches
krotos::Modulator Class Reference

Holds a list of modulation destinations and sends events to them when the modulator output is updated. More...

#include <ModulationSource.h>

Classes

struct  Listener
 

Public Member Functions

 Modulator (bool isFast=true)
 
virtual ~Modulator ()=default
 
void addListener (Listener *l)
 
void removeListener (Listener *l)
 
void setValues (const float *values, int numValues)
 
bool isFast () const
 
const float * getValues () const
 
int getNumValues () const
 
void callListeners ()
 

Public Attributes

float(* mappingFunctionPtr )(const float *parameterValuesVector, const float depth) = nullptr
 

Private Attributes

const bool m_isFast
 
const float * m_values
 
int m_numValues
 
ListenerList< Listenerm_listeners
 
std::map< Listener *, float > m_amounts
 

Detailed Description

Holds a list of modulation destinations and sends events to them when the modulator output is updated.

This class is used by modulators to store and send out modulation signals to any destination parameter.

Generally, the process of creating and sending a modulation signal looks like this:

  • At the beginning of processing for a particular block, modulator Kwidgets are processed first
  • Modulator Kwidgets write their modulation signals into a Modulator object
  • The Modulator sends a signal to all of its destination parameters, letting them know that their values are being modulated during the next block
  • This signal is received by the corresponding KAttachment, which then provides the parameter values to its KwidgetProcessor for the next block

Constructor & Destructor Documentation

◆ Modulator()

krotos::Modulator::Modulator ( bool isFast = true)

◆ ~Modulator()

virtual krotos::Modulator::~Modulator ( )
virtualdefault

Member Function Documentation

◆ addListener()

void krotos::Modulator::addListener ( Listener * l)

◆ callListeners()

void krotos::Modulator::callListeners ( )

◆ getNumValues()

int krotos::Modulator::getNumValues ( ) const
inline

◆ getValues()

const float * krotos::Modulator::getValues ( ) const
inline

◆ isFast()

bool krotos::Modulator::isFast ( ) const
inline

◆ removeListener()

void krotos::Modulator::removeListener ( Listener * l)

◆ setValues()

void krotos::Modulator::setValues ( const float * values,
int numValues )
inline

Member Data Documentation

◆ m_amounts

std::map<Listener*, float> krotos::Modulator::m_amounts
private

◆ m_isFast

const bool krotos::Modulator::m_isFast
private

◆ m_listeners

ListenerList<Listener> krotos::Modulator::m_listeners
private

◆ m_numValues

int krotos::Modulator::m_numValues
private

◆ m_values

const float* krotos::Modulator::m_values
private

◆ mappingFunctionPtr

float(* krotos::Modulator::mappingFunctionPtr) (const float *parameterValuesVector, const float depth) = nullptr

Function pointer to set mapping functions. Set from the respective KwidgetProcessor who is adding the modulator. To make this generic as possible, the mapping function needs to be declared static!! It is then in the responsibility of the function to retrieve as many values as it needs, iterating through the vector of parameter values.

Parameters
parameterValuesVectorThis points to a vector storing the parameterValues, whose changes this modulator picks up and updates his values.(example posX and posY of a XYPad).
depthThe depth input value. To keep the system generic as possible it is in the responsibility of the mapping function to interpret this value (can be offset, gain multiplier or anything else).

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