diff options
author | Robin Gareus <robin@gareus.org> | 2018-12-02 01:36:32 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-12-02 01:36:32 +0100 |
commit | 53a0199a06f2256af4f8f9995ee676fa844df102 (patch) | |
tree | 6cd41e8ca2d377e9539ab9fcf1b6727fe81c884f /libs/ardour/plugin.cc | |
parent | 3c7dea43af9d9e5b2563aee81ac5253fb2ee7858 (diff) |
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.
Diffstat (limited to 'libs/ardour/plugin.cc')
-rw-r--r-- | libs/ardour/plugin.cc | 15 |
1 files changed, 12 insertions, 3 deletions
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; } |