summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-11-28 12:30:38 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-11-28 12:38:58 +1000
commite9eea8de9d13b43ad236e5f1623c1139311f5f1b (patch)
tree4160b657fff5afcbdbe81a37198ba55186ba4e9a /libs/ardour
parent8ddeca133bb6decbb1f2f46ec7b50c1bb622f731 (diff)
Fix Duplicate Track with Copy Playlist option selected
Previously two new empty playlists were created. Related to and mentioned in issue #7141
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/session.cc35
1 files changed, 12 insertions, 23 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 127367483b..06d19672b9 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -81,6 +81,7 @@
#include "ardour/midi_ui.h"
#include "ardour/operations.h"
#include "ardour/playlist.h"
+#include "ardour/playlist_factory.h"
#include "ardour/plugin.h"
#include "ardour/plugin_insert.h"
#include "ardour/process_thread.h"
@@ -3240,17 +3241,19 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
/* set this name in the XML description that we are about to use */
- bool rename_playlist;
- switch (pd) {
- case NewPlaylist:
- case CopyPlaylist:
- rename_playlist = true;
- break;
- default:
- case SharePlaylist:
- rename_playlist = false;
+ if (pd == CopyPlaylist) {
+ XMLNode* ds_node = find_named_node (node_copy, "Diskstream");
+ if (ds_node) {
+ const std::string playlist_name = ds_node->property (X_("playlist"))->value ();
+ boost::shared_ptr<Playlist> playlist = playlists->by_name (playlist_name);
+ // Use same name as Route::set_name_in_state so playlist copy
+ // is picked up when creating the Route in XMLRouteFactory below
+ PlaylistFactory::create (playlist, string_compose ("%1.1", name));
+ }
}
+ bool rename_playlist = (pd == CopyPlaylist || pd == NewPlaylist);
+
Route::set_name_in_state (node_copy, name, rename_playlist);
/* trim bitslots from listen sends so that new ones are used */
@@ -3328,20 +3331,6 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i
route->output()->changed (change, this);
}
- boost::shared_ptr<Track> track;
-
- if ((track = boost::dynamic_pointer_cast<Track> (route))) {
- switch (pd) {
- case NewPlaylist:
- break;
- case CopyPlaylist:
- track->use_copy_playlist ();
- break;
- case SharePlaylist:
- break;
- }
- };
-
ret.push_back (route);
}