commit 4444810108b262e23ee55fe09fd8bd88341a64e3
parent d0a26d6d205ce51c450806d615c8edd3e48e7a90
Author: falkTX <falktx@gmail.com>
Date: Sun, 29 Nov 2015 19:54:11 +0100
Implement full state on lv2 and vst
Diffstat:
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp
@@ -743,6 +743,15 @@ public:
if (fPortControls[i] != nullptr)
*fPortControls[i] = fLastControlValues[i];
}
+
+# if DISTRHO_PLUGIN_WANT_FULL_STATE
+ // Update state
+ for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
+ {
+ const String& key = cit->first;
+ fStateMap[key] = fPlugin.getState(key);
+ }
+# endif
}
#endif
@@ -751,6 +760,15 @@ public:
#if DISTRHO_PLUGIN_WANT_STATE
LV2_State_Status lv2_save(const LV2_State_Store_Function store, const LV2_State_Handle handle)
{
+# if DISTRHO_PLUGIN_WANT_FULL_STATE
+ // Update current state
+ for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
+ {
+ const String& key = cit->first;
+ fStateMap[key] = fPlugin.getState(key);
+ }
+# endif
+
for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
{
const String& key = cit->first;
diff --git a/distrho/src/DistrhoPluginVST.cpp b/distrho/src/DistrhoPluginVST.cpp
@@ -454,7 +454,17 @@ public:
fVstUI = new UIVst(fAudioMaster, fEffect, this, &fPlugin, (intptr_t)ptr);
+# if DISTRHO_PLUGIN_WANT_FULL_STATE
+ // Update current state from plugin side
+ for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
+ {
+ const String& key = cit->first;
+ fStateMap[key] = fPlugin.getState(key);
+ }
+# endif
+
# if DISTRHO_PLUGIN_WANT_STATE
+ // Set state
for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
{
const String& key = cit->first;
@@ -506,6 +516,15 @@ public:
}
else
{
+# if DISTRHO_PLUGIN_WANT_FULL_STATE
+ // Update current state
+ for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
+ {
+ const String& key = cit->first;
+ fStateMap[key] = fPlugin.getState(key);
+ }
+# endif
+
String chunkStr;
for (StringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)