All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
Builder Class Reference

The builder is a low overhead helper class that provides functions to add modules. More...

Public Member Functions

template<class T >
void add (T *processor, Processor *parent, int chainIndex=IDs::Chains::Direct)
 Adds the given module to the parent processor. More...
 
template<class T >
T * create (Processor *parent, int chainIndex=IDs::Chains::Direct)
 Creates a module of the given class and adds it to the parent with the specified chainIndex. More...
 
ProcessorcreateFromBase64State (const String &base64EncodedString, Processor *parent, int chainIndex=IDs::Chains::Direct)
 Creates a module from the given Base64 encoded String and adds it to the parent module with the suppliedChainIndex. More...
 
template<class T >
Reference< T > find (const String &name)
 Finds and creates a reference object to the module with the given ID. More...
 
template<class T >
bool remove (Processor *p)
 Removes a processor and all its child processors from the signal path. More...
 
void setAttributes (Processor *p, const AttributeCollection &collection)
 Sets all the attributes from the given collection. More...
 

Detailed Description

The builder is a low overhead helper class that provides functions to add modules.

Create one of those, supply the MainController instance and call its methods to build up the architecture of your plugin.

// The main controller of this project
auto mc = getMainController();
// The root container of this project
auto masterContainer = mc->getMainSynthChain();
Builder b(mc);
// Adds a sine wave generator
auto sine = b.create<hise::SineSynth>(masterContainer, IDs::Chains::Direct);
sine->setAttribute(hise::SineSynth::OctaveTranspose, 5.0f, sendNotification);
// Adds a reverb to the sine wave generator
auto reverb = b.create<hise::SimpleReverbEffect>(sine, IDs::Chains::FX);
reverb->setAttribute(hise::SimpleReverbEffect::WetLevel, 0.5f, sendNotification);

Important: This class can only be used from the IDs::Threads::Loading thread in a suspended state. If you want to use this class from another thread, wrap it into a lambda and give it to the TaskAfterSuspension class.

Member Function Documentation

void add ( T *  processor,
Processor parent,
int  chainIndex = IDs::Chains::Direct 
)

Adds the given module to the parent processor.

Specify the chainIndex for modulators / effects.

T * create ( Processor parent,
int  chainIndex = IDs::Chains::Direct 
)

Creates a module of the given class and adds it to the parent with the specified chainIndex.

See ChainIndexes.

This only works with HISE modules that are registered at one of the factories, so if you want to add a custom module, use the add() function instead.

Processor * createFromBase64State ( const String &  base64EncodedString,
Processor parent,
int  chainIndex = IDs::Chains::Direct 
)

Creates a module from the given Base64 encoded String and adds it to the parent module with the suppliedChainIndex.

Reference<T> find ( const String &  name)

Finds and creates a reference object to the module with the given ID.

bool remove ( Processor p)

Removes a processor and all its child processors from the signal path.

void setAttributes ( Processor p,
const AttributeCollection collection 
)

Sets all the attributes from the given collection.

You can use std::initialiser_lists for a clean syntax:

{
};
for(auto* envelope: myEnvelopes)
builder.setAttributes(envelope, c);

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