![]() |
fsh::stk
fantastic spatial holophonic synthesis toolkit
|
Base class for storing plugin state. More...
#include <StateManager.h>
Public Member Functions | |
StateManager (juce::AudioProcessor &parent, Params &¶ms) | |
Construct a PluginStateBase object. | |
auto | getState () -> juce::XmlElement |
Called by the PluginBase class to save the plugin state. | |
void | setState (const juce::XmlElement &xml) |
Called by the PluginBase class to restore the plugin state. | |
auto | getReferenceToBaseClass () -> juce::AudioProcessorValueTreeState & |
Can be used by GUI objects, e.g. | |
Protected Member Functions | |
template<typename T > | |
auto | getParameter (const juce::ParameterID &id) const -> T |
Get a parameter by its ID string. | |
Base class for storing plugin state.
This class is a wrapper around juce::AudioProcessorValueTreeState. Every plugin should implement its own PluginState class that inherits from this class. This PluginState class is responsible for storing, saving, recalling, and communicating state to/from the DAW. You can then add parameters to the PluginState class by passing in an initializer list of fsh::FloatParam and fsh::ChoiceParam objects. Preferably these can be returned from a helper function inside an anonymous namespace, in the PluginState class's .cpp file.
StateManager::StateManager | ( | juce::AudioProcessor & | parent, |
Params && | params ) |
Construct a PluginStateBase object.
parent | The plugin that owns this PluginStateBase object. |
params | A list of plugin parameters |
|
inlineprotected |
Get a parameter by its ID string.
This is a wrapper around juce::AudioProcessorValueTreeState::getRawParameterValue(), but with a nullptr check. If you try to get a parameter that doesn't exist, this function will fail gracefully by returning 0.0f and logging an error.
auto StateManager::getReferenceToBaseClass | ( | ) | -> juce::AudioProcessorValueTreeState& |
Can be used by GUI objects, e.g.
to create SliderAttachments. See the Knob class, or the JUCE documentation for more info. This should be used sparingly. In most cases you probably want to use getRawParamSafely() from within your derived class.