All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Classes | Public Member Functions | List of all members
Inheritance diagram for ModulatorChain:
Chain EnvelopeModulator Modulator VoiceModulation TimeModulation Processor Modulation Modulation SafeChangeBroadcaster RestorableObject ControlledObject

Classes

class  ModulatorChainHandler
 

Public Member Functions

 ModulatorChain (MainController *mc, const String &id, int numVoices, Modulation::Mode m, Processor *p)
 
Chain::HandlergetHandler () override
 
void prepareToPlay (double sampleRate, int samplesPerBlock) override
 
bool shouldBeProcessed (bool checkPolyphonicModulators) const
 
int getNumChildProcessors () const override
 
ProcessorgetChildProcessor (int processorIndex) override
 
const ProcessorgetChildProcessor (int processorIndex) const override
 
void reset (int voiceIndex) override
 
void handleHiseEvent (const HiseEvent &m) override
 
bool isPlaying (int voiceIndex) const override
 
void startVoice (int voiceIndex) override
 
float getConstantVoiceValue (int voiceIndex) const
 
void stopVoice (int voiceIndex) override
 
void renderVoice (int voiceIndex, int startSample, int numSamples)
 
float * getVoiceValues (int voiceIndex) noexcept
 
const float * getVoiceValues (int voiceIndex) const noexcept
 
void renderNextBlock (AudioSampleBuffer &buffer, int startSample, int numSamples) override
 
void calculateBlock (int, int) override
 
float calculateNewValue ()
 
void setIsVoiceStartChain (bool isVoiceStartChain_)
 
void renderAllModulatorsAsMonophonic (AudioSampleBuffer &buffer, int startSample, int numSamples)
 
- Public Member Functions inherited from Chain
bool restoreChain (const ValueTree &v)
 
- Public Member Functions inherited from Modulator
 Modulator (MainController *m, const String &id)
 
virtual void setColour (Colour c)
 
void setPlotter (Plotter *targetPlotter)
 
void addValueToPlotter (float v) const
 
- Public Member Functions inherited from Processor
 Processor (MainController *m, const String &id_)
 
virtual ~Processor ()
 
virtual const Identifier getType () const =0
 
const Path getSymbol () const
 
void setSymbol (Path newSymbol)
 
void setAttribute (int parameterIndex, float newValue, juce::NotificationType notifyEditor)
 
virtual int getNumInternalChains () const
 
void enableConsoleOutput (bool shouldBeEnabled)
 
const String & getId () const
 
virtual const String getName () const
 
virtual void setBypassed (bool shouldBeBypassed, NotificationType notifyChangeHandler=dontSendNotification) noexcept
 
bool isBypassed () const noexcept
 
double getSampleRate () const
 
int getBlockSize () const
 
float getOutputValue () const
 
float getInputValue () const
 
void setEditorState (int state, bool isOn, NotificationType notifyView=sendNotification)
 
bool getEditorState (int state) const
 
void restoreCompleteEditorState (const XmlElement *storedState)
 
const Identifier getIdentifierForParameterIndex (int parameterIndex) const
 
int getNumParameters () const
 
void setIsOnAir (bool isBeingProcessedInAudioThread)
 
const CriticalSection & getDummyLockWhenNotOnAir () const
 
- Public Member Functions inherited from SafeChangeBroadcaster
void sendSynchronousChangeMessage ()
 
void addChangeListener (SafeChangeListener *listener)
 
void removeChangeListener (SafeChangeListener *listener)
 
void removeAllChangeListeners ()
 
void sendChangeMessage (const String &=String())
 
void sendAllocationFreeChangeMessage ()
 
- Public Member Functions inherited from ControlledObject
 ControlledObject (MainController *m)
 
const MainControllergetMainController () const noexcept
 
MainControllergetMainController () noexcept
 
- Public Member Functions inherited from Modulation
Mode getMode () const noexcept
 
float calcIntensityValue (float calculatedModulationValue) const noexcept
 
void applyModulationValue (float calculatedModulationValue, float &destinationValue) const noexcept
 
void setIntensity (float newIntensity) noexcept
 
void setIntensityFromSlider (float sliderValue) noexcept
 
virtual float getIntensity () const noexcept
 
float getDisplayIntensity () const noexcept
 
- Public Member Functions inherited from TimeModulation
virtual void applyTimeModulation (AudioSampleBuffer &buffer, int startIndex, int samplesToCopy)
 
virtual const float * getCalculatedValues (int)
 

Additional Inherited Members

- Public Types inherited from Processor
enum  SpecialParameters
 
enum  InternalChains
 
- Public Types inherited from Modulation
enum  Mode { GainMode = 0, PitchMode }
 
- Protected Member Functions inherited from Processor
void setOutputValue (float newValue)
 
void setInputValue (float newValue, NotificationType notify=sendNotification)
 
- Protected Member Functions inherited from TimeModulation
virtual void prepareToModulate (double, int samplesPerBlock)
 
virtual bool isInitialized ()
 
void applyGainModulation (float *calculatedModulationValues, float *destinationValues, float fixedIntensity, int numValues) const noexcept
 
void applyGainModulation (float *calculatedModulationValues, float *destinationValues, float fixedIntensity, float *intensityValues, int numValues) const noexcept
 
void applyPitchModulation (float *calculatedModulationValues, float *destinationValues, float fixedIntensity, float *intensityValues, int numValues) const noexcept
 
void applyPitchModulation (float *calculatedModulationValues, float *destinationValues, float fixedIntensity, int numValues) const noexcept
 
- Protected Attributes inherited from EnvelopeModulator
OwnedArray< ModulatorStatestates
 

Detailed Description

A chain of Modulators that can be processed serially.

A ModulatorChain can hold three different types of Modulators:

In order to make a ModulatorChain work, you have to

In your code you have to call all these methods at the appropriate time / place:

You might want to use the functions shouldBeProcessed(), isPlaying(), getVoiceValues()

For an example usage of an polyphonic ModulatorChain, take a look at the WavetableSynth class. For an example usage of an monophonic ModulatorChain, the LfoModulator class is your friend.

Constructor & Destructor Documentation

ModulatorChain ( MainController mc,
const String &  id,
int  numVoices,
Modulation::Mode  m,
Processor p 
)

Creates a new modulator chain. You have to specify the voice amount and the Modulation::Mode

Member Function Documentation

void calculateBlock ( int  ,
int   
)
inlineoverridevirtual

Does nothing (the complete renderNextBlock method is overwritten.

Implements TimeModulation.

float calculateNewValue ( )

Call this function if you want to process each sample at one time. This is useful for internal ModulatorChains.

You have to set the voiceIndex with polyMangager.setCurrentVoice() and clear it afterwards!

Processor* getChildProcessor ( int  processorIndex)
inlineoverridevirtual

Wraps the handlers method.

Implements Processor.

const Processor* getChildProcessor ( int  processorIndex) const
inlineoverridevirtual

Wraps the handlers method.

Implements Processor.

float getConstantVoiceValue ( int  voiceIndex) const

Iterates all voice start modulators and returns the value either between 0.0 and 1.0 (GainMode) or -1.0 ... 1.0 (Pitch Mode).

Chain::Handler * getHandler ( )
overridevirtual

Returns the handler that is used to add / delete Modulators in the chain. Use this if you want to change the modulator.

Implements Chain.

int getNumChildProcessors ( ) const
inlineoverridevirtual

Wraps the handlers method.

Reimplemented from Modulator.

float* getVoiceValues ( int  voiceIndex)
inlinenoexcept

Returns a read pointer to the calculated voice values. The array size is supposed to be the size of the internal buffer.

const float* getVoiceValues ( int  voiceIndex) const
inlinenoexcept

Returns a write pointer to the calculated voice values. You can change them and the array size should be known.

void handleHiseEvent ( const HiseEvent m)
overridevirtual

Sends the midi message all modulators.

You can't use the voice index here, since it is not guaranteed if the message starts a note.

Reimplemented from EnvelopeModulator.

bool isPlaying ( int  voiceIndex) const
overridevirtual

Checks if any of the EnvelopeModulators wants to keep the voice from being killed.

If no envelopes are active, it checks if the voice was recently started or stopped using an internal array.

Implements EnvelopeModulator.

void prepareToPlay ( double  sampleRate,
int  samplesPerBlock 
)
overridevirtual

Sets the sample rate for all modulators in the chain and initialized the UpdateMerger.

Reimplemented from EnvelopeModulator.

void renderAllModulatorsAsMonophonic ( AudioSampleBuffer &  buffer,
int  startSample,
int  numSamples 
)

This renders all modulators as they were monophonic. This is useful for ModulatorChains that are not interested in polyphony (eg internal chains of non-polyphonic Modulators, but want to process polyphonic modulators.

The best thing is to use this method after / or before all voices are rendered.

void renderNextBlock ( AudioSampleBuffer &  buffer,
int  startSample,
int  numSamples 
)
overridevirtual

This ocverrides the TimeVariant::renderNextBlock method and only calculates the TimeVariant modulators.

It assumes that the other modulators are calculated before with renderVoice().

Parameters
bufferthe buffer that will be filled with the values of the timevariant modulation result.

Reimplemented from TimeModulation.

void renderVoice ( int  voiceIndex,
int  startSample,
int  numSamples 
)

Iterates all VoiceStartModulators and EnvelopeModulators and stores their values in the internal voice buffer.

You can use getVoiceValues() to retrieve these values at a later time.

void reset ( int  voiceIndex)
overridevirtual

Resets all envelopes. This can be used for envelopes that do not control the main gain value and therefore do not switch back to IDLE if the note stops playing before the envelope is finished.

Also their display is updated to clear remaining tails (that aren't cleared because of a missing update call to UpdateMerger.

Reimplemented from EnvelopeModulator.

void setIsVoiceStartChain ( bool  isVoiceStartChain_)

If you want the chain to only process voice start modulators, set this to true.

bool shouldBeProcessed ( bool  checkPolyphonicModulators) const

Checks if the chain is bypassed or contains no modulators.

Parameters
checkPolyphonicModulatorsif true, it searches the voice start modulators and envelopes.
void startVoice ( int  voiceIndex)
overridevirtual

Calls the start voice function for all voice start modulators and envelope modulators and sends a display message.

Reimplemented from EnvelopeModulator.

void stopVoice ( int  voiceIndex)
overridevirtual

Calls the stopVoice function for all envelope modulators.

Reimplemented from EnvelopeModulator.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.