force LV2 plugin-state save for templates - #6709
authorRobin Gareus <robin@gareus.org>
Fri, 15 Jan 2016 12:44:17 +0000 (13:44 +0100)
committerRobin Gareus <robin@gareus.org>
Fri, 15 Jan 2016 12:44:17 +0000 (13:44 +0100)
libs/ardour/lv2_plugin.cc

index c39e40c7d5584de1547d7fde753145792baa6649..ef247109bd98f3462ab9bd805fa2b4d1ac1b2ef0 100644 (file)
@@ -1062,7 +1062,9 @@ LV2Plugin::add_state(XMLNode* root) const
                        0,
                        NULL);
 
-               if (!_impl->state || !lilv_state_equals(state, _impl->state)) {
+               if (!_plugin_state_dir.empty()
+                   || !_impl->state
+                   || !lilv_state_equals(state, _impl->state)) {
                        lilv_state_save(_world.world,
                                        _uri_map.urid_map(),
                                        _uri_map.urid_unmap(),
@@ -1071,8 +1073,14 @@ LV2Plugin::add_state(XMLNode* root) const
                                        new_dir.c_str(),
                                        "state.ttl");
 
-                       lilv_state_free(_impl->state);
-                       _impl->state = state;
+                       if (_plugin_state_dir.empty()) {
+                               // normal session save
+                               lilv_state_free(_impl->state);
+                               _impl->state = state;
+                       } else {
+                               // template save (dedicated state-dir)
+                               lilv_state_free(state);
+                       }
                } else {
                        // State is identical, decrement version and nuke directory
                        lilv_state_free(state);