diff options
author | Robin Gareus <robin@gareus.org> | 2020-01-30 01:08:57 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-01-30 01:08:57 +0100 |
commit | 6452f62d64cfc473a4fce9a027d31ed56368d8cb (patch) | |
tree | 56054730502666d0ba9ac8f2324342adb8911244 /libs/ardour/session.cc | |
parent | 51d2bb36ceec7386370f1999952b04bec291f312 (diff) |
Cont'd work on loading old route templates
This builds on top of 51d2bb:
* v6 routes templates/states have a version per <Route>
* older route-states are assumed to be from ardour-5
Stateful::loading_state_version 3002,
unless specified otherwise
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index c88d85cd77..82b0e14073 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2948,7 +2948,23 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i */ node_copy.remove_node_and_delete (X_("Controllable"), X_("name"), X_("solo")); - boost::shared_ptr<Route> route (XMLRouteFactory (node_copy, Stateful::loading_state_version)); + /* New v6 templates do have a version in the Route-Template, + * we assume that all older, unversioned templates are + * from Ardour 5.x + * when Stateful::loading_state_version was 3002 + */ + int version = 3002; + node.get_property (X_("version"), version); + + boost::shared_ptr<Route> route; + + if (version < 3000) { + route = XMLRouteFactory_2X (node_copy, version); + } else if (version < 5000) { + route = XMLRouteFactory_3X (node_copy, version); + } else { + route = XMLRouteFactory (node_copy, version); + } if (route == 0) { error << _("Session: cannot create track/bus from template description") << endmsg; |