13
0

fix for loading older sessions, where the rest for "is-track" was "has-diskstream", rather than "has-playlist"

This commit is contained in:
Paul Davis 2017-08-17 10:33:38 -04:00
parent de7963941d
commit ac8dc40035
2 changed files with 55 additions and 0 deletions

View File

@ -1747,6 +1747,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<Route> XMLRouteFactory (const XMLNode&, int);
boost::shared_ptr<Route> XMLRouteFactory_2X (const XMLNode&, int);
boost::shared_ptr<Route> XMLRouteFactory_3X (const XMLNode&, int);
void route_processors_changed (RouteProcessorChange);

View File

@ -1711,8 +1711,11 @@ Session::load_routes (const XMLNode& node, int version)
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
boost::shared_ptr<Route> route;
if (version < 3000) {
route = XMLRouteFactory_2X (**niter, version);
} else if (version < 5000) {
route = XMLRouteFactory_3X (**niter, version);
} else {
route = XMLRouteFactory (**niter, version);
}
@ -1779,6 +1782,57 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
BOOST_MARK_TRACK (track);
ret = track;
} else {
PresentationInfo::Flag flags = PresentationInfo::get_flags (node);
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));
if (r->init () == 0 && r->set_state (node, version) == 0) {
BOOST_MARK_ROUTE (r);
ret = r;
}
}
return ret;
}
boost::shared_ptr<Route>
Session::XMLRouteFactory_3X (const XMLNode& node, int version)
{
boost::shared_ptr<Route> ret;
if (node.name() != "Route") {
return ret;
}
XMLNode* ds_child = find_named_node (node, X_("Diskstream"));
DataType type = DataType::AUDIO;
node.get_property("default-type", type);
assert (type != DataType::NIL);
if (ds_child) {
boost::shared_ptr<Track> track;
if (type == DataType::AUDIO) {
track.reset (new AudioTrack (*this, X_("toBeResetFroXML")));
} else {
track.reset (new MidiTrack (*this, X_("toBeResetFroXML")));
}
if (track->init()) {
return ret;
}
if (track->set_state (node, version)) {
return ret;
}
BOOST_MARK_TRACK (track);
ret = track;
} else {
PresentationInfo::Flag flags = PresentationInfo::get_flags (node);
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));