From 51d2bb36ceec7386370f1999952b04bec291f312 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 29 Jan 2020 23:20:37 +0100 Subject: [PATCH] Save/Use state-version with route templates Currently using Ardour-5 route templates (state version "3002") with Ardour6 fails. As opposed to session-templates, Route templates were not versioned. This ensures future compatibility (and may allow to interpret unversioned templates as "3002") --- libs/ardour/route.cc | 4 ++++ libs/ardour/track.cc | 2 ++ 2 files changed, 6 insertions(+) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 0b67528ac9..0b684f560c 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2494,6 +2494,7 @@ Route::state (bool save_template) std::string modified_with = string_compose ("%1 %2", PROGRAM_NAME, revision); child->set_property("modified-with", modified_with); + node->set_property("version", CURRENT_SESSION_FILE_VERSION); } node->set_property (X_("id"), id ()); @@ -2589,6 +2590,9 @@ Route::state (bool save_template) int Route::set_state (const XMLNode& node, int version) { + /* when loading a template, use the version of the Route (if available) */ + node.get_property (X_("version"), version); + if (version < 3000) { return set_state_2X (node, version); } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index a4c26a7ffb..482c17c270 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -177,6 +177,8 @@ Track::set_state (const XMLNode& node, int version) return -1; } + node.get_property (X_("version"), version); + if (version >= 3000 && version < 6000) { if (XMLNode* ds_node = find_named_node (node, "Diskstream")) { std::string name;