Krotos Modules 3
Loading...
Searching...
No Matches
krotos::CustomParameter Class Reference

A wrapper around juce::ValueTree designed to store custom plugin state (strings, arrays, etc.). More...

#include <CustomParameter.h>

Inheritance diagram for krotos::CustomParameter:

Public Member Functions

 CustomParameter ()
 
 CustomParameter (const ValueTree &parameterTree, const Identifier &property, UndoManager *undoManager=nullptr)
 
 CustomParameter (const CustomParameter &other)
 
 ~CustomParameter () override
 
CustomParameteroperator= (const CustomParameter &other)
 
bool operator== (const CustomParameter &other) const
 
bool isValid () const
 
const var & getValue () const
 
void setValue (const var &newValue, bool selfUpdate=false)
 
void setUndoManager (UndoManager *um)
 
UndoManager * getUndoManager () const
 
const ValueTree & getParameterTree () const
 
const Identifier & getProperty () const
 

Public Attributes

std::function< void(const var &)> valueChanged {nullptr}
 

Private Member Functions

void valueTreePropertyChanged (ValueTree &tree, const Identifier &property) override
 

Private Attributes

ValueTree m_parameterTree
 
Identifier m_property
 
UndoManager * m_undoManager {nullptr}
 

Detailed Description

A wrapper around juce::ValueTree designed to store custom plugin state (strings, arrays, etc.).

Constructor & Destructor Documentation

◆ CustomParameter() [1/3]

krotos::CustomParameter::CustomParameter ( )

Default constructor. Creates an invalid CustomParameter.

◆ CustomParameter() [2/3]

krotos::CustomParameter::CustomParameter ( const ValueTree & parameterTree,
const Identifier & property,
UndoManager * undoManager = nullptr )

Constructs a CustomParameter from an existing piece of state.

◆ CustomParameter() [3/3]

krotos::CustomParameter::CustomParameter ( const CustomParameter & other)

Copy constructor.

◆ ~CustomParameter()

krotos::CustomParameter::~CustomParameter ( )
override

Destructor.

Member Function Documentation

◆ getParameterTree()

const ValueTree & krotos::CustomParameter::getParameterTree ( ) const
inline

Get a reference to the ValueTree that holds this object's state.

◆ getProperty()

const Identifier & krotos::CustomParameter::getProperty ( ) const
inline

Get the Identifier for this object's parameter value in its ValueTree.

◆ getUndoManager()

UndoManager * krotos::CustomParameter::getUndoManager ( ) const
inline

Get a pointer to the UndoManager used by this object.

◆ getValue()

const var & krotos::CustomParameter::getValue ( ) const

Get the current parameter value.

◆ isValid()

bool krotos::CustomParameter::isValid ( ) const

Returns true if this CustomParameter's ValueTree is valid.

◆ operator=()

CustomParameter & krotos::CustomParameter::operator= ( const CustomParameter & other)

Copy assignment operator.

◆ operator==()

bool krotos::CustomParameter::operator== ( const CustomParameter & other) const

Comparison operator.

Returns
True if the other CustomParameter is controlling the same ValueTree property as this one.

◆ setUndoManager()

void krotos::CustomParameter::setUndoManager ( UndoManager * um)
inline

Set the UndoManager that this object will use for all of its ValueTree interactions.

◆ setValue()

void krotos::CustomParameter::setValue ( const var & newValue,
bool selfUpdate = false )

Set the current parameter value.

Parameters
newValueThe new custom parameter value.
selfUpdateSet this to true if you would like to receive a callback to this object's 'valueChanged' lambda function.

◆ valueTreePropertyChanged()

void krotos::CustomParameter::valueTreePropertyChanged ( ValueTree & tree,
const Identifier & property )
overrideprivate

Member Data Documentation

◆ m_parameterTree

ValueTree krotos::CustomParameter::m_parameterTree
private

◆ m_property

Identifier krotos::CustomParameter::m_property
private

◆ m_undoManager

UndoManager* krotos::CustomParameter::m_undoManager {nullptr}
private

◆ valueChanged

std::function<void(const var&)> krotos::CustomParameter::valueChanged {nullptr}

Use this function to receive notifications when the parameter value changes.


The documentation for this class was generated from the following files: