From 53a0199a06f2256af4f8f9995ee676fa844df102 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 2 Dec 2018 01:36:32 +0100 Subject: Restore actual plugin-preset on session-load This checks if the preset is actually available on the given system and also sets the user-flag correctly. --- libs/ardour/plugin.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index f3d66971b8..fceb87ee80 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -475,9 +475,18 @@ Plugin::parameter_changed_externally (uint32_t which, float /* value */) int Plugin::set_state (const XMLNode& node, int /*version*/) { - node.get_property (X_("last-preset-uri"), _last_preset.uri); - node.get_property (X_("last-preset-label"), _last_preset.label); - node.get_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset); + std::string preset_uri; + const Plugin::PresetRecord* r = 0; + if (node.get_property (X_("last-preset-uri"), preset_uri)) { + r = preset_by_uri (preset_uri); + } + if (r) { + _last_preset = *r; + node.get_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset); // XXX + } else { + _last_preset.uri = ""; + _last_preset.valid = false; + } return 0; } -- cgit v1.2.3