void set_comment (std::string str, void *src);
bool set_name (const std::string& str);
- static void set_name_in_state (XMLNode &, const std::string &);
+ static void set_name_in_state (XMLNode &, const std::string &, bool rename_playlist = true);
uint32_t order_key () const;
bool has_order_key () const;
std::string new_audio_source_path_for_embedded (const std::string& existing_path);
std::string new_audio_source_path (const std::string&, uint32_t nchans, uint32_t chan, bool destructive, bool take_required);
std::string new_midi_source_path (const std::string&);
- RouteList new_route_from_template (uint32_t how_many, const std::string& template_path, const std::string& name);
+ RouteList new_route_from_template (uint32_t how_many, const std::string& template_path, const std::string& name, PlaylistDisposition pd = NewPlaylist);
+ RouteList new_route_from_template (uint32_t how_many, XMLNode&, const std::string& name, PlaylistDisposition pd = NewPlaylist);
std::vector<std::string> get_paths_for_new_sources (bool allow_replacing, const std::string& import_file_path, uint32_t channels);
int bring_all_sources_into_session (boost::function<void(uint32_t,uint32_t,std::string)> callback);
* @param name New name.
*/
void
-Route::set_name_in_state (XMLNode& node, string const & name)
+Route::set_name_in_state (XMLNode& node, string const & name, bool rename_playlist)
{
node.add_property (X_("name"), name);
} else if ((*i)->name() == X_("Diskstream")) {
- (*i)->add_property (X_("playlist"), string_compose ("%1.1", name).c_str());
+ if (rename_playlist) {
+ (*i)->add_property (X_("playlist"), string_compose ("%1.1", name).c_str());
+ }
(*i)->add_property (X_("name"), name);
}
, current_block_size (0)
, _worst_output_latency (0)
, _worst_input_latency (0)
- , _worst_track_latency (0)
+ , _worst_track_latency (0)
, _have_captured (false)
, _non_soloed_outs_muted (false)
, _listen_cnt (0)
}
RouteList
-Session::new_route_from_template (uint32_t how_many, const std::string& template_path, const std::string& name_base)
+Session::new_route_from_template (uint32_t how_many, const std::string& template_path, const std::string& name_base, PlaylistDisposition pd)
{
- RouteList ret;
- uint32_t control_id;
XMLTree tree;
- uint32_t number = 0;
- const uint32_t being_added = how_many;
if (!tree.read (template_path.c_str())) {
- return ret;
+ return RouteList();
}
- XMLNode* node = tree.root();
+ return new_route_from_template (how_many, *tree.root(), name_base, pd);
+}
+RouteList
+Session::new_route_from_template (uint32_t how_many, XMLNode& node, const std::string& name_base, PlaylistDisposition pd)
+{
+ RouteList ret;
+ uint32_t control_id;
+ uint32_t number = 0;
+ const uint32_t being_added = how_many;
+ /* This will prevent the use of any existing XML-provided PBD::ID
+ values by Stateful.
+ */
+ Stateful::ForceIDRegeneration force_ids;
IO::disable_connecting ();
control_id = next_control_id ();
while (how_many) {
- XMLNode node_copy (*node);
+ /* We're going to modify the node contents a bit so take a
+ * copy. The node may be re-used when duplicating more than once.
+ */
- /* Remove IDs of everything so that new ones are used */
- node_copy.remove_property_recursively (X_("id"));
+ XMLNode node_copy (node);
try {
string name;
}
/* set this name in the XML description that we are about to use */
- Route::set_name_in_state (node_copy, name);
+
+ bool rename_playlist;
+ switch (pd) {
+ case NewPlaylist:
+ case CopyPlaylist:
+ rename_playlist = true;
+ break;
+ case SharePlaylist:
+ rename_playlist = false;
+ }
+
+ Route::set_name_in_state (node_copy, name, rename_playlist);
/* trim bitslots from listen sends so that new ones are used */
XMLNodeList children = node_copy.children ();