13
0

region groups: some operations should implicitly group new regions

* imported regions
* newly-recorded regions
* regions that result from a Split or Separate
* pasted regions
This commit is contained in:
Ben Loftis 2023-08-07 09:09:59 -05:00 committed by Robin Gareus
parent d1ee95e886
commit fd5dfe27c5
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -233,6 +233,7 @@ MidiPlaylist::_split_region (std::shared_ptr<Region> 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);

View File

@ -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<Playlist> other, timepos_t const & position, fl
for (auto const & r : other->regions) {
std::shared_ptr<Region> 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> 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);

View File

@ -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<Track> tr = std::dynamic_pointer_cast<Track> (i);
if (tr) {

View File

@ -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<Region> rx (RegionFactory::create (srcs, plist));
midi_region = std::dynamic_pointer_cast<MidiRegion> (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<Region> rx (RegionFactory::create (srcs, plist));
region = std::dynamic_pointer_cast<AudioRegion> (rx);