Browse Source

Don't save lv2 keys not registered by the plugin

gh-pages
falkTX 11 years ago
parent
commit
f30d19f3b9
2 changed files with 16 additions and 1 deletions
  1. +11
    -0
      distrho/src/DistrhoPluginInternal.hpp
  2. +5
    -1
      distrho/src/DistrhoPluginLV2.cpp

+ 11
- 0
distrho/src/DistrhoPluginInternal.hpp View File

@@ -258,6 +258,17 @@ public:
#endif

#if DISTRHO_PLUGIN_WANT_STATE
bool wantsStateKey(const char* const key) const noexcept
{
for (uint32_t i=0; i < fData->stateCount; ++i)
{
if (fData->stateKeys[i] == key)
return true;
}

return false;
}

uint32_t getStateCount() const noexcept
{
return fData != nullptr ? fData->stateCount : 0;


+ 5
- 1
distrho/src/DistrhoPluginLV2.cpp View File

@@ -644,6 +644,10 @@ private:
{
fPlugin.setState(key, newValue);

// check if we want to save this key
if (! fPlugin.wantsStateKey(key))
return;

// check if key already exists
for (auto it = fStateMap.begin(), end = fStateMap.end(); it != end; ++it)
{
@@ -656,7 +660,7 @@ private:
}
}

// add a new one then
// nope, add a new one then
d_string d_key(key);
fStateMap[d_key] = newValue;
}


Loading…
Cancel
Save