Convert Disksteam & Playlists from old 2.x sessions
This commit is contained in:
parent
c144e807ef
commit
848831d844
@ -1817,6 +1817,9 @@ private:
|
||||
/* CURVES and AUTOMATION LISTS */
|
||||
std::map<PBD::ID, AutomationList*> automation_lists;
|
||||
|
||||
/** load 2.X Sessions. Diskstream-ID to playlist-name mapping */
|
||||
std::map<PBD::ID, std::string> _diskstreams_2X;
|
||||
|
||||
/* DEFAULT FADE CURVES */
|
||||
|
||||
float default_fade_steepness;
|
||||
|
@ -75,6 +75,8 @@ private:
|
||||
void track (bool, boost::weak_ptr<Playlist>);
|
||||
void update_tracking ();
|
||||
|
||||
void update_orig_2X (PBD::ID, PBD::ID);
|
||||
|
||||
void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
|
||||
void update_after_tempo_map_change ();
|
||||
void add_state (XMLNode*, bool save_template, bool include_unused);
|
||||
|
@ -2289,8 +2289,9 @@ Playlist::set_state (const XMLNode& node, int version)
|
||||
_set_sort_id ();
|
||||
}
|
||||
|
||||
/* XXX legacy session: fix up later */
|
||||
/* XXX legacy session: fix up later - :: update_orig_2X() */
|
||||
node.get_property (X_("orig-diskstream-id"), _orig_track_id);
|
||||
node.get_property (X_("orig_diskstream_id"), _orig_track_id);
|
||||
|
||||
node.get_property (X_("orig-track-id"), _orig_track_id);
|
||||
node.get_property (X_("frozen"), _frozen);
|
||||
|
@ -244,6 +244,24 @@ SessionPlaylists::unassigned (std::list<boost::shared_ptr<Playlist> > & list)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SessionPlaylists::update_orig_2X (PBD::ID old_orig, PBD::ID new_orig)
|
||||
{
|
||||
Glib::Threads::Mutex::Lock lm (lock);
|
||||
|
||||
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||
if ((*i)->get_orig_track_id() == old_orig) {
|
||||
(*i)->set_orig_track_id (new_orig);
|
||||
}
|
||||
}
|
||||
|
||||
for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
|
||||
if ((*i)->get_orig_track_id() == old_orig) {
|
||||
(*i)->set_orig_track_id (new_orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SessionPlaylists::get (vector<boost::shared_ptr<Playlist> >& s) const
|
||||
{
|
||||
|
@ -1685,6 +1685,20 @@ Session::set_state (const XMLNode& node, int version)
|
||||
_vca_manager->set_state (*child, version);
|
||||
}
|
||||
|
||||
if (version < 3000) {
|
||||
if ((child = find_named_node (node, "DiskStreams"))) {
|
||||
for (XMLNodeList::const_iterator n = child->children ().begin (); n != child->children ().end (); ++n) {
|
||||
if ((*n)->name() == "AudioDiskstream" || (*n)->name() == "DiskStream") {
|
||||
std::string diskstream_id;
|
||||
std::string playlist_name;
|
||||
if ((*n)->get_property ("playlist", playlist_name) && (*n)->get_property ("id", diskstream_id)) {
|
||||
_diskstreams_2X [PBD::ID(diskstream_id)] = playlist_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((child = find_named_node (node, "Routes")) == 0) {
|
||||
error << _("Session: XML state has no routes section") << endmsg;
|
||||
goto out;
|
||||
@ -1695,6 +1709,8 @@ Session::set_state (const XMLNode& node, int version)
|
||||
/* Now that we Tracks have been loaded and playlists are assigned */
|
||||
_playlists->update_tracking ();
|
||||
|
||||
_diskstreams_2X.clear ();
|
||||
|
||||
/* Now that we have Routes and masters loaded, connect them if appropriate */
|
||||
|
||||
Slavable::Assign (_vca_manager); /* EMIT SIGNAL */
|
||||
@ -1941,12 +1957,15 @@ Session::XMLRouteFactory_2X (const XMLNode& node, int version)
|
||||
|
||||
if (ds_prop) {
|
||||
|
||||
/* see comment in current ::set_state() regarding diskstream
|
||||
* state and DiskReader/DiskWRiter.
|
||||
*/
|
||||
PBD::ID ds_id (ds_prop->value ());
|
||||
std::string playlist_name = _diskstreams_2X[ds_id];
|
||||
|
||||
error << _("Could not find diskstream for route") << endmsg;
|
||||
return boost::shared_ptr<Route> ();
|
||||
boost::shared_ptr<Playlist> pl = playlists()->by_name (playlist_name);
|
||||
|
||||
if (playlist_name.empty () || !pl) {
|
||||
error << _("Could not find diskstream for route") << endmsg;
|
||||
return boost::shared_ptr<Route> ();
|
||||
}
|
||||
|
||||
boost::shared_ptr<Track> track;
|
||||
|
||||
@ -1960,10 +1979,15 @@ Session::XMLRouteFactory_2X (const XMLNode& node, int version)
|
||||
return ret;
|
||||
}
|
||||
|
||||
track->use_playlist (DataType::AUDIO, pl);
|
||||
|
||||
if (track->set_state (node, version)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
pl->set_orig_track_id (track->id());
|
||||
playlists()->update_orig_2X (ds_id, track->id());
|
||||
|
||||
BOOST_MARK_TRACK (track);
|
||||
ret = track;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user