diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 86ee99e79f..befd043c71 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -1180,6 +1180,9 @@ DiskWriter::transport_stopped_wallclock (struct tm& when, time_t twhen, bool abo uint32_t n = 0; bool mark_write_completed = false; + /* finishing a capture will potentially create a lot of regions; we want them all assigned to the same region-group */ + Region::RegionGroupRetainer rgr; + finish_capture (c); /* butler is already stopped, but there may be work to do diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index f16e357c01..0fd984a9cd 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -233,6 +233,7 @@ MidiPlaylist::_split_region (std::shared_ptr region, timepos_t const & p plist.add (Properties::length, after); plist.add (Properties::name, after_name); plist.add (Properties::right_of_split, true); + plist.add (Properties::reg_group, Region::get_retained_group_id()); /* same note as above */ right = RegionFactory::create (region, before, plist, true, &thawlist); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index d29461a657..81a8b6efa3 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1063,6 +1063,7 @@ Playlist::partition_internal (timepos_t const & start, timepos_t const & end, bo plist.add (Properties::automatic, true); plist.add (Properties::left_of_split, true); plist.add (Properties::right_of_split, true); + plist.add (Properties::reg_group, Region::get_retained_group_id(true)); /* see note in ::_split_region() */ @@ -1082,6 +1083,7 @@ Playlist::partition_internal (timepos_t const & start, timepos_t const & end, bo plist.add (Properties::name, new_name); plist.add (Properties::automatic, true); plist.add (Properties::right_of_split, true); + plist.add (Properties::reg_group, Region::get_retained_group_id()); region = RegionFactory::create (current, pos1.distance (pos3), plist, true, &thawlist ); @@ -1159,6 +1161,7 @@ Playlist::partition_internal (timepos_t const & start, timepos_t const & end, bo plist.add (Properties::name, new_name); plist.add (Properties::automatic, true); plist.add (Properties::right_of_split, true); + plist.add (Properties::reg_group, Region::get_retained_group_id()); region = RegionFactory::create (current, plist, true, &thawlist); @@ -1310,6 +1313,9 @@ Playlist::paste (std::shared_ptr other, timepos_t const & position, fl for (auto const & r : other->regions) { std::shared_ptr copy_of_region = RegionFactory::create (r, true, false, &rl1.thawlist); + /* we want newly-pasted regions to share one (implicit) group-id */ + copy_of_region->set_region_group(false); + /* put these new regions on top of all existing ones, but preserve the ordering they had in the original playlist. */ @@ -1533,6 +1539,7 @@ Playlist::_split_region (std::shared_ptr region, timepos_t const & play plist.add (Properties::length, after); plist.add (Properties::name, after_name); plist.add (Properties::right_of_split, true); + plist.add (Properties::reg_group, Region::get_retained_group_id()); /* same note as above */ right = RegionFactory::create (region, before, plist, true, &thawlist); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 2a2c6408a5..580bfccaa4 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1395,6 +1395,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished, bool will_ _state_of_the_state = StateOfTheState (_state_of_the_state | InCleanup); } + /* finishing a capture will potentially create a lot of regions; we want them all assigned to the same region-group */ + Region::RegionGroupRetainer rgr; + for (auto const& i : *rl) { std::shared_ptr tr = std::dynamic_pointer_cast (i); if (tr) { diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 06b9e58a3d..fcf7a2221b 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -962,6 +962,9 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture return; } + /* all regions created from a recording pass should share the same group-id */ + Region::RegionGroupRetainer rgr; + RecordMode rmode = _session.config.get_record_mode (); samplecnt_t total_capture = 0; @@ -1059,6 +1062,7 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture plist.add (Properties::length, l); plist.add (Properties::opaque, rmode != RecSoundOnSound); plist.add (Properties::name, region_name); + plist.add (Properties::reg_group, Region::get_retained_group_id()); std::shared_ptr rx (RegionFactory::create (srcs, plist)); midi_region = std::dynamic_pointer_cast (rx); @@ -1163,6 +1167,7 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur plist.add (Properties::length, timecnt_t ((*ci)->samples, timepos_t::zero (false))); plist.add (Properties::name, region_name); plist.add (Properties::opaque, rmode != RecSoundOnSound); + plist.add (Properties::reg_group, Region::get_retained_group_id()); std::shared_ptr rx (RegionFactory::create (srcs, plist)); region = std::dynamic_pointer_cast (rx);