From 7f595594b41e2fd0c46e9d75b980a769ec421182 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 12 Jul 2020 23:51:50 +0100 Subject: [PATCH] Only load default state on LV2 plugins that request such feature Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginLV2.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 5a4abe46f..f2e3b8f00 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -577,6 +577,7 @@ public: fCvInBuffers(nullptr), fCvOutBuffers(nullptr), fParamBuffers(nullptr), + fHasLoadDefaultState(false), fHasThreadSafeRestore(false), fNeedsFixedBuffers(false), fNeedsUiClose(false), @@ -3235,10 +3236,11 @@ public: { setMidiProgram(0, false, false, false, true); } - else + else if (fHasLoadDefaultState) { // load default state - if (LilvState* const state = Lv2WorldClass::getInstance().getStateFromURI(fDescriptor->URI, (const LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data)) + if (LilvState* const state = Lv2WorldClass::getInstance().getStateFromURI(fDescriptor->URI, + (const LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data)) { lilv_state_restore(state, fExt.state, fHandle, carla_lilv_set_port_value, this, 0, fFeatures); @@ -6084,6 +6086,10 @@ public: { fStrictBounds = feature.Required ? 1 : 0; } + else if (std::strcmp(feature.URI, LV2_STATE__loadDefaultState) == 0) + { + fHasLoadDefaultState = true; + } else if (std::strcmp(feature.URI, LV2_STATE__threadSafeRestore) == 0) { fHasThreadSafeRestore = true; @@ -6944,6 +6950,7 @@ private: float** fCvOutBuffers; float* fParamBuffers; + bool fHasLoadDefaultState : 1; bool fHasThreadSafeRestore : 1; bool fNeedsFixedBuffers : 1; bool fNeedsUiClose : 1;