+
+
+ if (route_group() && route_group()->is_active()) {
+ //PBD::stacktrace(cerr, 20);
+ std::string group_string = "."+route_group()->name()+".";
+
+ std::string take_name = apl->name();
+ std::string::size_type idx = take_name.find(group_string);
+
+ if (idx == std::string::npos)
+ return;
+
+ take_name = take_name.substr(idx + group_string.length()); // find the bit containing the take number / name
+
+ boost::shared_ptr<RouteList> rl (route_group()->route_list());
+
+ for (RouteList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
+ if ( (*i) == this->route()) {
+ continue;
+ }
+
+ std::string playlist_name = (*i)->name()+group_string+take_name;
+
+ boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track>(*i);
+ if (!track) {
+ std::cerr << "route " << (*i)->name() << " is not a Track" << std::endl;
+ continue;
+ }
+
+ boost::shared_ptr<Playlist> ipl = session()->playlists->by_name(playlist_name);
+ if (!ipl) {
+ // No playlist for this track for this take yet, make it
+ track->diskstream()->use_new_playlist();
+ track->diskstream()->playlist()->set_name(playlist_name);
+ } else {
+ track->diskstream()->use_playlist(ipl);
+ }
+ }
+ }