All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Public Types | Public Member Functions | List of all members
ModulatorSynth Class Reference
Inheritance diagram for ModulatorSynth:
Processor RoutableProcessor SafeChangeBroadcaster RestorableObject ControlledObject ModulatorSampler ModulatorSynthChain ModulatorSynthGroup

Public Types

enum  InternalChains
- Public Types inherited from Processor
enum  SpecialParameters
enum  InternalChains

Public Member Functions

virtual void renderNextBlockWithModulators (AudioSampleBuffer &outputAudio, const HiseEventBuffer &inputMidi)
virtual void preVoiceRendering (int startSample, int numThisTime)
void renderVoice (int startSample, int numThisTime)
virtual void postVoiceRendering (int startSample, int numThisTime)
void handleHiseEvent (const HiseEvent &e)
virtual void prepareToPlay (double sampleRate, int samplesPerBlock)
void killAllVoicesWithNoteNumber (int noteNumber)
void killLastVoice ()
virtual bool soundCanBePlayed (ModulatorSynthSound *sound, int midiChannel, int midiNoteNumber, float velocity)
void noteOn (const HiseEvent &m)
int getVoiceIndex (const SynthesiserVoice *v) const
virtual void addProcessorsWhenEmpty ()
virtual void initRenderCallback ()
void setGain (float newGain)
void setBalance (float newBalance)
float getBalance (bool getRightChannelGain) const
float getGain () const
void setGroup (ModulatorSynthGroup *parent)
ModulatorSynthGroupgetGroup () const
bool isInGroup () const
int getIndexInGroup () const
void setClockSpeed (ClockSpeed newClockSpeed)
const float * getConstantPitchValues () const
const CriticalSection & getSynthLock () const
virtual void handleRetriggeredNote (ModulatorSynthVoice *voice)
const float * calculateGainValuesForVoice (int voiceIndex, float scriptGainValue, int startSample, int numSamples)
void calculatePitchValuesForVoice (int voiceIndex, float scriptPitchValue, int startSample, int numSamples)
const float * getPitchValuesForVoice (int voiceIndex) const
float * getPitchValuesForVoice (int voiceIndex)
- 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)
void enableConsoleOutput (bool shouldBeEnabled)
const String & getId () const
virtual const String getName () const
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 RoutableProcessor
void editRouting (Component *childComponent)
int getLeftSourceChannel () const
int getRightSourceChannel () const
int getLeftDestinationChannel () const
int getRightDestinationChannel () const

Additional Inherited Members

- Protected Member Functions inherited from Processor
virtual Path getSpecialSymbol () const
void setOutputValue (float newValue)
void setInputValue (float newValue, NotificationType notify=sendNotification)

Detailed Description

A ModulatorSynth is a synthesiser with a ModulatorChain for volume and pitch that allows modulation of these parameters.

Instead of renderNextBlock(), simply call renderNextBlockWithModulators() and it processes the chains. Also you have to subclass the used voice type from ModulatorSynthVoice and make sure it uses the voice modulation values in its renderNextBlock().

Member Enumeration Documentation

These are the three Chains that the ModulatorSynth uses.

Member Function Documentation

void addProcessorsWhenEmpty ( )

Adds a SimpleEnvelope to a empty ModulatorSynth to prevent clicks.

const float* calculateGainValuesForVoice ( int  voiceIndex,
float  scriptGainValue,
int  startSample,
int  numSamples 

Calculates the voice values with the GainModulationChain and returns a read pointer to the values.

void calculatePitchValuesForVoice ( int  voiceIndex,
float  scriptPitchValue,
int  startSample,
int  numSamples 

calculates the voice pitch values. You can get the values with getPitchValues for voice.

float getBalance ( bool  getRightChannelGain) const

Returns the calculated (equal power) pan value for either the left or the right channel.

const float* getConstantPitchValues ( ) const

Returns the pointer to the calculated pitch buffers for the ModulatorSynthVoice's render callback.

float getGain ( ) const

Returns the gain of the ModulatorSynth from 0.0 to 1.0.

ModulatorSynthGroup* getGroup ( ) const

Returns the ModulatorSynthGroup that this ModulatorSynth belongs to.

int getIndexInGroup ( ) const

Returns the index of the child synth if it resides in a group and -1 if not.

const float* getPitchValuesForVoice ( int  voiceIndex) const

Returns a read pointer to the calculated pitch values.

float* getPitchValuesForVoice ( int  voiceIndex)

Returns a read pointer to the calculated pitch values. Used by Synthgroups to render their pitch values on the voice value.

const CriticalSection& getSynthLock ( ) const

returns the lock the synth is using.

int getVoiceIndex ( const SynthesiserVoice *  v) const

Returns the voice index for the voice (the index in the internal voice array). This is needed for the ModulatorChains to know which voice is started.

void handleHiseEvent ( const HiseEvent e)

Same functionality as Synthesiser::handleMidiEvent(), but sends the midi event to all Modulators in the chains.

void handleRetriggeredNote ( ModulatorSynthVoice voice)

specifies the behaviour when a note is started that is already ringing. By default, it is killed, but you can overwrite it to make something else.

virtual void initRenderCallback ( )

Clears the internal buffer. This must be called by subclasses for every renderNextBlockWithModulators.

Reimplemented in ModulatorSynthGroup.

bool isInGroup ( ) const

Checks if the Synth was added to a group.

void killAllVoicesWithNoteNumber ( int  noteNumber)

Kills the note with the specified note number.

This stops the note with a small fade out (instead of noteoff which can result in very long release times if the envelope says so

void killLastVoice ( )

Kills the voice that is playing for the longest time.

void noteOn ( const HiseEvent m)

Same functionality as Synthesiser::noteOn(), but calls calculateVoiceStartValue() if a new voice is started.

void postVoiceRendering ( int  startSample,
int  numThisTime 

This method is called to handle all modulatorchains after the voice rendering and handles the GUI metering. It assumes stereo mode.

The rendered buffer is supplied as reference to be able to apply changes here after all voices are rendered (eg. gain).

void prepareToPlay ( double  sampleRate,
int  samplesPerBlock 

This sets up the synth and the ModulatorChains.

Call this instead of Synthesiser::setCurrentPlaybackSampleRate(). It also sets the ModulatorChain's voice amount, so be sure you add all SynthesiserVoices before you call this function.

Reimplemented from Processor.

Reimplemented in ModulatorSynthGroup, and ModulatorSynthChain.

void preVoiceRendering ( int  startSample,
int  numThisTime 

This method is called to handle all modulatorchains just before the voice rendering.

void renderNextBlockWithModulators ( AudioSampleBuffer &  outputAudio,
const HiseEventBuffer &  inputMidi 

Call this instead of Synthesiser::renderNextBlock to let the ModulatorChains to their work.

This only renders the TimeVariantModulators (like a master effect) and calculates the voice modulation, so make sure you actually apply the voice modulation in the subclassed ModulatorSynthVoice callback.

Reimplemented in ModulatorSynthChain.

void renderVoice ( int  startSample,
int  numThisTime 

This method is called to actually render all voices. It operates on the internal buffer of the ModulatorSynth.

void setBalance ( float  newBalance)

sets the balance from -1.0 (left) to 1.0 (right) and applies a equal power pan rule.

void setClockSpeed ( ClockSpeed  newClockSpeed)

Sets the interval for the internal clock callback.

void setGain ( float  newGain)

sets the gain of the ModulatorSynth from 0.0 to 1.0.

void setGroup ( ModulatorSynthGroup parent)

Sets the parent group. This can only be called once, since synths are not supposed to change their parents.

bool soundCanBePlayed ( ModulatorSynthSound *  sound,
int  midiChannel,
int  midiNoteNumber,
float  velocity 

Checks if the message fits the sound, but can be overriden to implement other group start logic.

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