diff --git a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_PluginState.h b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_PluginState.h index 7f86bdd37..ca4d3a9ac 100644 --- a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_PluginState.h +++ b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_PluginState.h @@ -17,10 +17,11 @@ class PluginState /** Initialises the plugin state with a given set of parameters. */ void initialise (ParamHolder& parameters, - juce::AudioProcessor* processor = nullptr, + juce::AudioProcessor* proc = nullptr, juce::UndoManager* um = nullptr) { params = ¶meters; + processor = proc; undoManager = um; listeners.emplace (parameters); if (processor != nullptr) @@ -80,6 +81,7 @@ class PluginState mainThreadAction.call (std::forward (func), couldBeAudioThread); } + juce::AudioProcessor* processor = nullptr; juce::UndoManager* undoManager = nullptr; private: diff --git a/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.cpp b/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.cpp index bb0fc650d..10f80a2ef 100644 --- a/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.cpp +++ b/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.cpp @@ -4,10 +4,11 @@ namespace chowdsp { template ParameterAttachment::ParameterAttachment (Param& parameter, - PluginState& pluginState, + PluginState& plugState, Callback&& callback) - : ParameterAttachment (parameter, pluginState.getParameterListeners(), std::forward (callback)) + : ParameterAttachment (parameter, plugState.getParameterListeners(), std::forward (callback)) { + pluginState = &plugState; } template @@ -28,14 +29,14 @@ ParameterAttachment::ParameterAttachment (Param& parameter, template void ParameterAttachment::beginGesture() { - if (param != nullptr) + if (param != nullptr && pluginState != nullptr && pluginState->processor != nullptr) param->beginChangeGesture(); } template void ParameterAttachment::endGesture() { - if (param != nullptr) + if (param != nullptr && pluginState != nullptr && pluginState->processor != nullptr) param->endChangeGesture(); } diff --git a/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.h b/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.h index 70a78197d..951502e1b 100644 --- a/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.h +++ b/modules/plugin/chowdsp_plugin_state/Frontend/chowdsp_ParameterAttachment.h @@ -52,6 +52,7 @@ class ParameterAttachment void setValueAsPartOfGesture (ParamElementType newValue); ParamType* param = nullptr; + PluginState* pluginState = nullptr; private: template