diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 583c45790f..aae1b2b443 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -185,6 +185,9 @@ Playlist::Playlist (std::shared_ptr other, string namestr, bool ThawList thawlist; other->copy_regions (tmp); + RegionSortByLayer cmp; + tmp.sort (cmp); + in_set_state++; for (list >::iterator x = tmp.begin(); x != tmp.end(); ++x) { @@ -273,10 +276,10 @@ Playlist::Playlist (std::shared_ptr other, timepos_t const & sta new_region = RegionFactory::create (region, offset, plist, true, &rlock.thawlist); add_region_internal (new_region, position, rlock.thawlist); + set_layer (new_region, region->layer ()); } } - /* keep track of any dead space at end (for pasting into Ripple or * RippleAll mode) at the end of construction, any length of cnt beyond * the extents of the regions is end_space @@ -286,6 +289,8 @@ Playlist::Playlist (std::shared_ptr other, timepos_t const & sta in_set_state--; first_set_state = false; + + relayer (); } void @@ -1321,7 +1326,8 @@ Playlist::paste (std::shared_ptr other, timepos_t const & position, fl */ add_region_internal (copy_of_region, r->position() + pos, rl1.thawlist); - set_layer (copy_of_region, copy_of_region->layer() + top); + copy_of_region->set_layer (r->layer() + top); + set_layer (copy_of_region, copy_of_region->layer()); } pos += shift; }