From 27cd151daaa920ec4f4db93fbad8b1aaf6984b54 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 8 Feb 2015 07:59:29 +0000 Subject: [PATCH] Allow to save properties when using vst chunks --- source/backend/plugin/CarlaPlugin.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index e41b3603c..d0f8499e5 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -529,6 +529,25 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) pData->stateSave.chunk = CarlaString::asBase64(data, dataSize).dup(); // Don't save anything else if using chunks + // Well, except properties + + for (LinkedList::Itenerator it = pData->custom.begin(); it.valid(); it.next()) + { + const CustomData& cData(it.getValue(kCustomDataFallback)); + CARLA_SAFE_ASSERT_CONTINUE(cData.isValid()); + + if (std::strcmp(cData.type, CUSTOM_DATA_TYPE_PROPERTY) != 0) + continue; + + CarlaStateSave::CustomData* stateCustomData(new CarlaStateSave::CustomData()); + + stateCustomData->type = carla_strdup(cData.type); + stateCustomData->key = carla_strdup(cData.key); + stateCustomData->value = carla_strdup(cData.value); + + pData->stateSave.customData.append(stateCustomData); + } + return pData->stateSave; } }