All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
Processor Class Referenceabstract
Inheritance diagram for Processor:
SafeChangeBroadcaster RestorableObject ControlledObject EffectProcessor MidiProcessor Modulator ModulatorSynth MasterEffectProcessor MonophonicEffectProcessor VoiceEffectProcessor MidiDelay MidiProcessorChain SampleRaster ScriptBaseMidiProcessor Transposer EnvelopeModulator TimeVariantModulator VoiceStartModulator ModulatorSampler ModulatorSynthChain ModulatorSynthGroup


class  Iterator

Public Types

enum  SpecialParameters
enum  InternalChains

Public Member Functions

 Processor (MainController *m, const String &id_)
virtual ~Processor ()
virtual ProcessorEditorBodycreateEditor (ProcessorEditor *parentEditor)=0
virtual ValueTree exportAsValueTree () const override
virtual void restoreFromValueTree (const ValueTree &previouslyExportedProcessorState) override
virtual const Identifier getType () const =0
const Path getSymbol () const
void setSymbol (Path newSymbol)
void setAttribute (int parameterIndex, float newValue, juce::NotificationType notifyEditor)
virtual float getAttribute (int parameterIndex) const =0
virtual float getDefaultValue (int) const
virtual ProcessorgetChildProcessor (int processorIndex)=0
virtual int getNumChildProcessors () const =0
virtual int getNumInternalChains () const
void enableConsoleOutput (bool shouldBeEnabled)
virtual Colour getColour () const
const String & getId () const
virtual const String getName () const
virtual void setBypassed (bool shouldBeBypassed, NotificationType notifyChangeHandler=dontSendNotification) noexcept
bool isBypassed () const noexcept
virtual void prepareToPlay (double sampleRate_, int samplesPerBlock_)
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

Protected Member Functions

virtual Path getSpecialSymbol () const
void setOutputValue (float newValue)
void setInputValue (float newValue, NotificationType notify=sendNotification)
virtual void setInternalAttribute (int parameterIndex, float newValue)=0

Detailed Description

The base class for all modules.

Every object within HISE that processes audio or MIDI is derived from this base class to share the following features:

The general architecture of a HISE patch is a tree of Processors, with a main processor (which can be obtained using getMainController()->getMainSynthChain()). There is a small helper class ProcessorHelpers, which contains some static methods for searching & checking the type of the Processor.

Normally, you would not derive from this class directly, but use some of its less generic subclasses (MidiProcessor, Modulator, EffectProcessor or ModulatorSynth). There are also some additional interface classes to extend the Processor class with specific features: Processor Interface Classes

Member Enumeration Documentation

Overwrite this enum and list all internal chains. This can be used to access them by index.

Overwrite this enum and add new parameters. This is used by the set- / getAttribute methods.

Constructor & Destructor Documentation

Processor ( MainController m,
const String &  id_ 

Creates a new Processor with the given Identifier.

virtual ~Processor ( )

Overwrite this if you need custom destruction behaviour.

Member Function Documentation

virtual ProcessorEditorBody* createEditor ( ProcessorEditor *  parentEditor)
pure virtual

Creates a ProcessorEditor for this Processor and returns the pointer.

If you subclass this, just allocate a ProcessorEditor of the desired type on the heap and return it. Remember to pass the Processor as parameter to allow asynchronous GUI notification. The concept between Processor and ProcessorEditor is the same as AudioProcessor and AudioProcessorEditor.

Implemented in AudioFileEnvelope, LfoModulator, MidiProcessor, PitchwheelModulator, and MacroModulator.

void enableConsoleOutput ( bool  shouldBeEnabled)

Enables the Processor to output messages to the Console.

This method itself does nothing, but you can use this to make a button or something else.

virtual ValueTree exportAsValueTree ( ) const

This saves the Processor.

It saves the ID, the bypassed state and the fold state. It also saves all child processors. You can overwrite this function and add more properties and their child processors but make sure you call the base class method.

For primitive values, you can use the macro saveAttribute(name, nameAsString):

You don't need to save the editor states, as the first 32 bits of EditorState is saved.

ValueTree exportAsValueTree() const override
// must be named 'v' for the macros
ValueTree v = BaseClass::exportAsValueTree();
saveAttribute(attributeName, "AttributeName");
// ...
if(useTable) saveTable(tableVariableName, "TableVariableNameData");
return v;
See also

Implements RestorableObject.

virtual float getAttribute ( int  parameterIndex) const
pure virtual

returns the attribute with the specified index (use a enum in the derived class).

Implemented in ArrayModulator, and ConstantModulator.

int getBlockSize ( ) const

Returns the block size.

virtual Processor* getChildProcessor ( int  processorIndex)
pure virtual

This must be overriden by every Processor and return the Chain with the Chain index.

You can either:

  • return nullptr, if the Processor uses no internal chains
  • one of the internal chains (it's recommended to use the InternalChains enum for this case)
  • return the Processor at the index if the Processor is a Chain. You can use it's handler's getProcessor() method.

Implemented in ModulatorSynthGroup, VoiceStartModulator, MidiProcessorChain, ModulatorChain, and MidiProcessor.

virtual Colour getColour ( ) const

Overwrite this method if you want a special colour.

This colour will be used in the debug console and in the editor.

virtual float getDefaultValue ( int  ) const

Overwrite this and return the default value.

const CriticalSection& getDummyLockWhenNotOnAir ( ) const

Call this method to get either the given lock or a dummy lock when the processor isn't on air yet.

bool getEditorState ( int  state) const

Restores the state of the Processor's editor. It must be saved within the Processor, because the Editor can be deleted.

const String& getId ( ) const

Returns the unique id of the Processor instance (!= the Processor name).

It must be a valid Identifier (so no whitespace and weird characters).

const Identifier getIdentifierForParameterIndex ( int  parameterIndex) const

This returns a Identifier with the name of the parameter.

If you want to use this feature (this lets you access Parameters with the script, you should add the parameter name for each parameter in your subtype constructor.

float getInputValue ( ) const

This can be used to display the Processors input value.

virtual const String getName ( void  ) const

Overwrite this and return a pretty name. If you don't overwrite it, the getType() method is used.

virtual int getNumChildProcessors ( ) const
pure virtual

This must return the number of Child processors.

If this Processor is a Chain, you can use it's getHandler()->getNumProcessor() method.

Implemented in ModulatorSynthGroup, Modulator, ModulatorSynthChain, MidiProcessorChain, ModulatorChain, and MidiProcessor.

virtual int getNumInternalChains ( ) const

If your processor uses internal chains, you can return the number here.

This is used by the ProcessorEditor to make the chain button bar.

int getNumParameters ( ) const

This returns the number of (named) parameters.

float getOutputValue ( ) const

This can be used to display the Processors output value.

double getSampleRate ( ) const

Returns the sample rate.

virtual Path getSpecialSymbol ( ) const

Overwrite this method if you want to supply a custom symbol for the Processor.

By default, it creates an empty Path, so you either have to set a custom Symbol using setSymbol(), or overwrite the getSpecialSymbol() method in a subclass.

const Path getSymbol ( ) const

Returns the symbol of the Processor.

It either checks if a special symbol is set for this particular Processor, or returns the default one defined in getSpecialSymbol()

virtual const Identifier getType ( ) const
pure virtual

Overwrite this method to specify the name.

Use non-whitespace Strings (best practice is CamelCase). In most cases, this will be enough:

const String getType() const { return "ProcessorName";}; 
bool isBypassed ( ) const

Returns true if the processor is bypassed.

virtual void prepareToPlay ( double  sampleRate_,
int  samplesPerBlock_ 
void restoreCompleteEditorState ( const XmlElement *  storedState)

Restores the EditorState from a BigInteger that was retrieved using getCompleteEditorState.

void restoreFromValueTree ( const ValueTree &  previouslyExportedProcessorState)

Restores a previously saved ValueTree.

The value tree must be created with exportAsValueTree or it will be unpredictable. The child processors are created automatically (both for chains and processors with fixed internal chains, but you should overwrite this method if your Processor uses parameters.

There is a handy macro saveAttribute(name, nameAsString) for this purpose.

restoreFromValueTree(const ValueTree &v) override // parameter must be named 'v' for the macros
// replace BaseClass with the class name of the immediate base class
loadAttribute(attributeName, "AttributeName");
// ...
// If your Processor uses tables:
if(useTable) loadTable(tableVariableName, "TableVariableData");
See also

Implements RestorableObject.

Reimplemented in ModulatorSynthChain.

void setAttribute ( int  parameterIndex,
float  newValue,
juce::NotificationType  notifyEditor 

Changes a Processor parameter.

This can be used in the audio thread eg. by other Processors. Overwrite the method setInternalAttribute() to store the parameters in private member variables. If the Processor is polyphonic, the attributes must stay the same for different voices. In this case store a multiplicator for the attribute in a ProcessorState.

parameterIndexthe parameter index (use a enum from the derived class)
newValuethe new value between 0.0 and 1.0
notifyEditorif sendNotification, then a asynchronous message is sent.
virtual void setBypassed ( bool  shouldBeBypassed,
NotificationType  notifyChangeHandler = dontSendNotification 

This bypasses the processor. You don't have to check in the processors logic itself, normally the chain should do that for you.

void setEditorState ( int  state,
bool  isOn,
NotificationType  notifyView = sendNotification 

Saves the state of the Processor's editor. It must be saved within the Processor, because the Editor can be deleted.

You can add more states in your subclass (they should be expressable as bool). Best use a enum:

enum EditorState
    newState = Processor::numEditorStates,
void setInputValue ( float  newValue,
NotificationType  notify = sendNotification 

Call this from the baseclass whenever you want its editor to display a input value change.

For most stuff a 0.0 ... 1.0 range is assumed.

virtual void setInternalAttribute ( int  parameterIndex,
float  newValue 
protectedpure virtual

Changes a Processor parameter.

Overwrite this method to do your handling. Call the overloaded method with the notification type parameter for external changes.

parameterIndexthe parameter index (use a enum from the derived class)
newValuethe new value between 0.0 and 1.0

Implemented in TableEnvelope, ArrayModulator, and ConstantModulator.

void setIsOnAir ( bool  isBeingProcessedInAudioThread)

Call this method after inserting the processor in the signal chain.

If you call prepareToPlay before calling this method, it won't lock which makes inserting new processors nicer.

void setOutputValue ( float  newValue)

Call this from the baseclass whenever you want its editor to display a value change.

void setSymbol ( Path  newSymbol)

Sets a special symbol for the Processor.

If this method is used, the getSymbol() method will return this Path instead of the default one defined in getSpecialSymbol();

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