Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
Processor Class Referenceabstract

The base class for all HISE modules in the signal path. More...

Inheritance diagram for Processor:
SafeChangeBroadcaster RestorableObject ControlledObject Dispatchable EffectProcessor EffectProcessorChain MidiProcessor Modulator ModulatorSynth MasterEffectProcessor VoiceEffectProcessor MidiDelay SampleRaster ScriptBaseMidiProcessor Transposer EnvelopeModulator TimeVariantModulator VoiceStartModulator AudioLooper GlobalModulatorContainer ModulatorSampler ModulatorSynthChain ModulatorSynthGroup NoiseSynth SineSynth WaveSynth WavetableSynth

Classes

class  Iterator
 A iterator over all child processors. More...
 

Public Types

enum  InternalChains
 Overwrite this enum and list all internal chains. More...
 
enum  SpecialParameters
 Overwrite this enum and add new parameters. More...
 

Public Member Functions

virtual ProcessorEditorBodycreateEditor (ProcessorEditor *parentEditor)=0
 Creates a ProcessorEditor for this Processor and returns the pointer. More...
 
void enableConsoleOutput (bool shouldBeEnabled)
 Enables the Processor to output messages to the Console. More...
 
virtual ValueTree exportAsValueTree () const override
 This saves the Processor. More...
 
virtual float getAttribute (int parameterIndex) const =0
 returns the attribute with the specified index (use a enum in the derived class). More...
 
virtual ProcessorgetChildProcessor (int processorIndex)=0
 This must be overriden by every Processor and return the Chain with the Chain index. More...
 
virtual Colour getColour () const
 Overwrite this method if you want a special colour. More...
 
virtual float getDefaultValue (int) const
 Overwrite this and return the default value. More...
 
bool getEditorState (int state) const
 Restores the state of the Processor's editor. More...
 
const String & getId () const
 Returns the unique id of the Processor instance (!= the Processor name). More...
 
virtual Identifier getIdentifierForParameterIndex (int parameterIndex) const
 This returns a Identifier with the name of the parameter. More...
 
float getInputValue () const
 This can be used to display the Processors input value. More...
 
int getLargestBlockSize () const
 Returns the block size. More...
 
virtual const String getName () const
 Overwrite this and return a pretty name. More...
 
virtual int getNumChildProcessors () const =0
 This must return the number of Child processors. More...
 
virtual int getNumInternalChains () const
 If your processor uses internal chains, you can return the number here. More...
 
int getNumParameters () const
 This returns the number of (named) parameters. More...
 
float getOutputValue () const
 This can be used to display the Processors output value. More...
 
double getSampleRate () const
 Returns the sample rate. More...
 
const Path getSymbol () const
 Returns the symbol of the Processor. More...
 
virtual const Identifier getType () const =0
 Overwrite this method to specify the name. More...
 
int getVoiceAmount () const noexcept
 getNumVoices() is occupied by the Synthesiser class, d'oh!
 
bool isBypassed () const noexcept
 Returns true if the processor is bypassed. More...
 
virtual void prepareToPlay (double sampleRate_, int samplesPerBlock_)
 Sets the sample rate and the block size. More...
 
 Processor (MainController *m, const String &id_, int numVoices)
 Creates a new Processor with the given Identifier. More...
 
void restoreCompleteEditorState (const XmlElement *storedState)
 Restores the EditorState from a BigInteger that was retrieved using getCompleteEditorState. More...
 
virtual void restoreFromValueTree (const ValueTree &previouslyExportedProcessorState) override
 Restores a previously saved ValueTree. More...
 
void setAttribute (int parameterIndex, float newValue, juce::NotificationType notifyEditor)
 Changes a Processor parameter. More...
 
virtual void setBypassed (bool shouldBeBypassed, NotificationType notifyChangeHandler=dontSendNotification) noexcept
 This bypasses the processor. More...
 
void setEditorState (int state, bool isOn, NotificationType notifyView=sendNotification)
 Saves the state of the Processor's editor. More...
 
void setIsOnAir (bool isBeingProcessedInAudioThread)
 Call this method after inserting the processor in the signal chain. More...
 
void setSymbol (Path newSymbol)
 Sets a special symbol for the Processor. More...
 
virtual ~Processor ()
 Overwrite this if you need custom destruction behaviour. More...
 
- Public Member Functions inherited from SafeChangeBroadcaster
void addChangeListener (SafeChangeListener *listener)
 Registers a listener to receive change callbacks from this broadcaster. More...
 
void removeAllChangeListeners ()
 Removes all listeners from the list. More...
 
void removeChangeListener (SafeChangeListener *listener)
 Unregisters a listener from the list. More...
 
void sendAllocationFreeChangeMessage ()
 This will send a message without allocating a message slot. More...
 
void sendChangeMessage (const String &=String())
 Causes an asynchronous change message to be sent to all the registered listeners. More...
 
void sendSynchronousChangeMessage ()
 Sends a synchronous change message to all the registered listeners. More...
 
- Public Member Functions inherited from ControlledObject
 ControlledObject (MainController *m)
 Creates a new ControlledObject. More...
 
const MainControllergetMainController () const noexcept
 Provides read-only access to the main controller. More...
 
MainControllergetMainController () noexcept
 Provides write access to the main controller. More...
 

Protected Member Functions

virtual Path getSpecialSymbol () const
 Overwrite this method if you want to supply a custom symbol for the Processor. More...
 
void setInputValue (float newValue, NotificationType notify=sendNotification)
 Call this from the baseclass whenever you want its editor to display a input value change. More...
 
virtual void setInternalAttribute (int parameterIndex, float newValue)=0
 Changes a Processor parameter. More...
 
void setOutputValue (float newValue)
 Call this from the baseclass whenever you want its editor to display a value change. More...
 

Detailed Description

The base class for all HISE modules in the signal path.

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 Processor objects, all residing in a main container of the type ModulatorSynthChain (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_,
int  numVoices 
)

Creates a new Processor with the given Identifier.

~Processor ( )
virtual

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, PitchwheelModulator, MidiProcessor, and MacroModulator.

void enableConsoleOutput ( bool  shouldBeEnabled)
inline

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.

juce::ValueTree exportAsValueTree ( ) const
overridevirtual

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
restoreFromValueTree()

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.

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 VoiceStartModulator, ModulatorChain, ModulatorSynthGroup, and MidiProcessor.

virtual Colour getColour ( ) const
inlinevirtual

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
inlinevirtual

Overwrite this and return the default value.

bool getEditorState ( int  state) const
inline

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
inline

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

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

Identifier getIdentifierForParameterIndex ( int  parameterIndex) const
virtual

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
inline

This can be used to display the Processors input value.

int getLargestBlockSize ( ) const
inline

Returns the block size.

virtual const String getName ( void  ) const
inlinevirtual

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 ModulatorChain, Modulator, ModulatorSynthGroup, ModulatorSynthChain, and MidiProcessor.

virtual int getNumInternalChains ( ) const
inlinevirtual

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
inline

This can be used to display the Processors output value.

double getSampleRate ( ) const
inline

Returns the sample rate.

virtual Path getSpecialSymbol ( ) const
inlineprotectedvirtual

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
inline

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
inlinenoexcept

Returns true if the processor is bypassed.

For checking the bypass state of ModulatorSynths, better use isSoftBypassed().

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

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

void restoreFromValueTree ( const ValueTree &  previouslyExportedProcessorState)
overridevirtual

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
BaseClass::restoreFromValueTree(v);
loadAttribute(attributeName, "AttributeName");
// ...
// If your Processor uses tables:
if(useTable) loadTable(tableVariableName, "TableVariableData");
}
See also
exportAsValueTree()

Implements RestorableObject.

Reimplemented in ModulatorSynthChain.

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

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.

Parameters
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 
)
inlinevirtualnoexcept

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 
)
inline

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 
)
inlineprotected

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.

Parameters
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)
inlineprotected

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

void setSymbol ( Path  newSymbol)
inline

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.