| @@ -262,18 +262,6 @@ public: | |||||
| */ | */ | ||||
| const CustomData& getCustomData(const uint32_t index) const noexcept; | const CustomData& getCustomData(const uint32_t index) const noexcept; | ||||
| /*! | |||||
| * Give the plugin a change to update its custom data sets. | |||||
| * | |||||
| * @see getCustomDataCount() and getCustomData() | |||||
| */ | |||||
| virtual void updateCustomData() noexcept; | |||||
| /*! | |||||
| * Helper function for LV2 plugins, internal use only! | |||||
| */ | |||||
| virtual void restoreLV2State() noexcept; | |||||
| /*! | /*! | ||||
| * Get the complete plugin chunk data into @a dataPtr. | * Get the complete plugin chunk data into @a dataPtr. | ||||
| * | * | ||||
| @@ -952,6 +940,19 @@ protected: | |||||
| struct ProtectedData; | struct ProtectedData; | ||||
| ProtectedData* const pData; | ProtectedData* const pData; | ||||
| // ------------------------------------------------------------------- | |||||
| // Internal helper functions | |||||
| /*! | |||||
| * Call LV2 restore. | |||||
| */ | |||||
| virtual void restoreLV2State() noexcept; | |||||
| /*! | |||||
| * Give plugin bridges a change to update their custom data sets. | |||||
| */ | |||||
| virtual void waitForBridgeSaveSignal() noexcept; | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Helper classes | // Helper classes | ||||
| @@ -269,14 +269,6 @@ const CustomData& CarlaPlugin::getCustomData(const uint32_t index) const noexcep | |||||
| return pData->custom.getAt(index, kCustomDataFallback); | return pData->custom.getAt(index, kCustomDataFallback); | ||||
| } | } | ||||
| void CarlaPlugin::updateCustomData() noexcept | |||||
| { | |||||
| } | |||||
| void CarlaPlugin::restoreLV2State() noexcept | |||||
| { | |||||
| } | |||||
| std::size_t CarlaPlugin::getChunkData(void** const dataPtr) noexcept | std::size_t CarlaPlugin::getChunkData(void** const dataPtr) noexcept | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); | CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); | ||||
| @@ -502,7 +494,7 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) | |||||
| getLabel(strBuf); | getLabel(strBuf); | ||||
| pData->stateSave.type = carla_strdup(getPluginTypeAsString(getType())); | |||||
| pData->stateSave.type = carla_strdup(getPluginTypeAsString(pluginType)); | |||||
| pData->stateSave.name = carla_strdup(pData->name); | pData->stateSave.name = carla_strdup(pData->name); | ||||
| pData->stateSave.label = carla_strdup(strBuf); | pData->stateSave.label = carla_strdup(strBuf); | ||||
| pData->stateSave.uniqueId = getUniqueId(); | pData->stateSave.uniqueId = getUniqueId(); | ||||
| @@ -611,7 +603,8 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // Custom Data | // Custom Data | ||||
| updateCustomData(); | |||||
| if (pData->hints & PLUGIN_IS_BRIDGE) | |||||
| waitForBridgeSaveSignal(); | |||||
| for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next()) | for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next()) | ||||
| { | { | ||||
| @@ -2468,6 +2461,16 @@ void CarlaPlugin::setPatchbayNodeId(const uint32_t nodeId) noexcept | |||||
| pData->nodeId = nodeId; | pData->nodeId = nodeId; | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| void CarlaPlugin::restoreLV2State() noexcept | |||||
| { | |||||
| } | |||||
| void CarlaPlugin::waitForBridgeSaveSignal() noexcept | |||||
| { | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Scoped Disabler | // Scoped Disabler | ||||
| @@ -477,11 +477,6 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Information (current data) | // Information (current data) | ||||
| void updateCustomData() noexcept override | |||||
| { | |||||
| waitForSaved(); | |||||
| } | |||||
| std::size_t getChunkData(void** const dataPtr) noexcept override | std::size_t getChunkData(void** const dataPtr) noexcept override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS, 0); | CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS, 0); | ||||
| @@ -1737,6 +1732,14 @@ public: | |||||
| fShmNonRtClientControl.commitWrite(); | fShmNonRtClientControl.commitWrite(); | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Internal helper functions | |||||
| void waitForBridgeSaveSignal() noexcept override | |||||
| { | |||||
| waitForSaved(); | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| void handleNonRtData() | void handleNonRtData() | ||||
| @@ -823,53 +823,7 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Information (current data) | // Information (current data) | ||||
| void restoreLV2State() noexcept override | |||||
| { | |||||
| if (fExt.state == nullptr) | |||||
| return; | |||||
| LV2_State_Status status = LV2_STATE_ERR_UNKNOWN; | |||||
| { | |||||
| const ScopedSingleProcessLocker spl(this, true); | |||||
| try { | |||||
| status = fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures); | |||||
| } catch(...) {} | |||||
| if (fHandle2 != nullptr) | |||||
| { | |||||
| try { | |||||
| fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures); | |||||
| } catch(...) {} | |||||
| } | |||||
| } | |||||
| switch (status) | |||||
| { | |||||
| case LV2_STATE_SUCCESS: | |||||
| carla_debug("CarlaPluginLV2::updateLV2State() - success"); | |||||
| break; | |||||
| case LV2_STATE_ERR_UNKNOWN: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - unknown error"); | |||||
| break; | |||||
| case LV2_STATE_ERR_BAD_TYPE: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad type"); | |||||
| break; | |||||
| case LV2_STATE_ERR_BAD_FLAGS: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad flags"); | |||||
| break; | |||||
| case LV2_STATE_ERR_NO_FEATURE: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing feature"); | |||||
| break; | |||||
| case LV2_STATE_ERR_NO_PROPERTY: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing property"); | |||||
| break; | |||||
| case LV2_STATE_ERR_NO_SPACE: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, insufficient space"); | |||||
| break; | |||||
| } | |||||
| } | |||||
| // nothing | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Information (per-plugin data) | // Information (per-plugin data) | ||||
| @@ -4158,6 +4112,57 @@ public: | |||||
| #endif | #endif | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Internal helper functions | |||||
| void restoreLV2State() noexcept override | |||||
| { | |||||
| if (fExt.state == nullptr) | |||||
| return; | |||||
| LV2_State_Status status = LV2_STATE_ERR_UNKNOWN; | |||||
| { | |||||
| const ScopedSingleProcessLocker spl(this, true); | |||||
| try { | |||||
| status = fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures); | |||||
| } catch(...) {} | |||||
| if (fHandle2 != nullptr) | |||||
| { | |||||
| try { | |||||
| fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures); | |||||
| } catch(...) {} | |||||
| } | |||||
| } | |||||
| switch (status) | |||||
| { | |||||
| case LV2_STATE_SUCCESS: | |||||
| carla_debug("CarlaPluginLV2::updateLV2State() - success"); | |||||
| break; | |||||
| case LV2_STATE_ERR_UNKNOWN: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - unknown error"); | |||||
| break; | |||||
| case LV2_STATE_ERR_BAD_TYPE: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad type"); | |||||
| break; | |||||
| case LV2_STATE_ERR_BAD_FLAGS: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad flags"); | |||||
| break; | |||||
| case LV2_STATE_ERR_NO_FEATURE: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing feature"); | |||||
| break; | |||||
| case LV2_STATE_ERR_NO_PROPERTY: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing property"); | |||||
| break; | |||||
| case LV2_STATE_ERR_NO_SPACE: | |||||
| carla_stderr("CarlaPluginLV2::updateLV2State() - error, insufficient space"); | |||||
| break; | |||||
| } | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| bool isRealtimeSafe() const noexcept | bool isRealtimeSafe() const noexcept | ||||