Browse Source

Make sure the new `updateState` calls `setState` first

Signed-off-by: falkTX <falktx@falktx.com>
pull/375/head
parent
commit
007a457e1e
2 changed files with 11 additions and 5 deletions
  1. +2
    -2
      distrho/DistrhoPlugin.hpp
  2. +9
    -3
      distrho/src/DistrhoPluginLV2.cpp

+ 2
- 2
distrho/DistrhoPlugin.hpp View File

@@ -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.


+ 9
- 3
distrho/src/DistrhoPluginLV2.cpp View File

@@ -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



Loading…
Cancel
Save