commit 007a457e1e0d18c1cfb39ca6b18b9ab246523d0b
parent c28c8b9e15b3f20dc9c09c1002ac6deb67d4af9a
Author: falkTX <falktx@falktx.com>
Date: Fri, 11 Feb 2022 04:43:23 +0000
Make sure the new `updateState` calls `setState` first
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
@@ -994,8 +994,8 @@ public:
#if DISTRHO_PLUGIN_WANT_STATE
/**
- Notify the host about a state value change.@n
- This function will automatically trigger a state update on the UI side.@n
+ Set state value and notify the host about the change.@n
+ This function will call `setState()` and also trigger an update on the UI side as necessary.@n
It must not be called during run.@n
The state must be host readable.
@note this function does nothing on DSSI plugin format, as DSSI only supports UI->DSP messages.
diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp
@@ -1267,10 +1267,16 @@ private:
// save this key if necessary
if (fPlugin.wantStateKey(key))
- updateState(key, newValue, false);
+ updateInternalState(key, newValue, false);
}
- bool updateState(const char* const key, const char* const newValue, const bool sendToUI)
+ bool updateState(const char* const key, const char* const newValue)
+ {
+ fPlugin.setState(key, newValue);
+ return updateInternalState(key, newValue, true);
+ }
+
+ bool updateInternalState(const char* const key, const char* const newValue, const bool sendToUI)
{
// key must already exist
for (StringToStringMap::iterator it=fStateMap.begin(), ite=fStateMap.end(); it != ite; ++it)
@@ -1343,7 +1349,7 @@ private:
#if DISTRHO_PLUGIN_WANT_STATE
static bool updateStateValueCallback(void* const ptr, const char* const key, const char* const value)
{
- return ((PluginLv2*)ptr)->updateState(key, value, true);
+ return ((PluginLv2*)ptr)->updateState(key, value);
}
#endif