Public Types | Public Member Functions | List of all members
Reference< ProcessorType > Class Template Reference

A lightweight wrapper around a Processor in the HISE signal path. More...

Inheritance diagram for Reference< ProcessorType >:
ControlledObject SafeChangeListener

Public Types

using ParameterCallback = std::function< void(float newValue)>
 A lambda that will be executed when the parameter changes. More...
 

Public Member Functions

void addParameterToWatch (int parameterIndex, const ParameterCallback &callbackFunction)
 Adds a lambda callback to a dedicated parameter that will be fired on changes. More...
 
ProcessorType * getProcessor () const noexcept
 Returns a raw pointer to the connected Processor. More...
 
 Reference (MainController *mc, const String &id=String(), bool addAsListener=false)
 Creates a reference to the processor with the given ID. 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...
 

Detailed Description

template<class ProcessorType>
class hise::raw::Reference< ProcessorType >

A lightweight wrapper around a Processor in the HISE signal path.

This object can be used as a wrapper around one of the Processor modules in your HISE project. Upon creation, it will search for the given ID (or use the first module that matches the type if the ID is not supplied).

If desired, it will also be notified about changes to a parameter which can be used to update the UI.

Reference<hise::PolyFilterEffect> polyFilter(mc, "MyFunkyFilter", true);
ParameterCallback update = [this](float newValue)
{
this->frequencySlider->setValue(newValue, dontSendNotification);
};
polyFilter.addParameterToWatch(hise::MonoFilterEffect::Frequency, update);

If you want a bidirectional connection between UI and the processor, take a look at the UIConnection classes, which offer ready made listeners / updaters for some of the basic JUCE widgets (Slider, ComboBox, Button)

Member Typedef Documentation

using ParameterCallback = std::function<void(float newValue)>

A lambda that will be executed when the parameter changes.

The newValue argument will contain the current value.

Constructor & Destructor Documentation

Reference ( MainController mc,
const String &  id = String(),
bool  addAsListener = false 
)

Creates a reference to the processor with the given ID.

If the ID is empty, it just looks for the first processor of the specified type.

Member Function Documentation

void addParameterToWatch ( int  parameterIndex,
const ParameterCallback callbackFunction 
)

Adds a lambda callback to a dedicated parameter that will be fired on changes.

ProcessorType * getProcessor ( ) const
noexcept

Returns a raw pointer to the connected Processor.

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