Region groups: do not group multiple takes on a single track
This commit is contained in:
parent
bcfa591ed2
commit
66ad0ebb03
|
@ -178,6 +178,7 @@ public:
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (_operation_rgroup_mutex);
|
Glib::Threads::Mutex::Lock lm (_operation_rgroup_mutex);
|
||||||
if (_retained_group_id == 0) {
|
if (_retained_group_id == 0) {
|
||||||
|
_retained_take_cnt = 0;
|
||||||
++_next_group_id;
|
++_next_group_id;
|
||||||
_operation_rgroup_map.clear (); // this is used for split & paste operations that honor the region's prior grouping
|
_operation_rgroup_map.clear (); // this is used for split & paste operations that honor the region's prior grouping
|
||||||
_retained_group_id = _next_group_id << 4; // this is used for newly created regions via recording or importing
|
_retained_group_id = _next_group_id << 4; // this is used for newly created regions via recording or importing
|
||||||
|
@ -191,6 +192,7 @@ public:
|
||||||
if (_clear_on_destruction) {
|
if (_clear_on_destruction) {
|
||||||
Glib::Threads::Mutex::Lock lm (_operation_rgroup_mutex);
|
Glib::Threads::Mutex::Lock lm (_operation_rgroup_mutex);
|
||||||
_retained_group_id = 0;
|
_retained_group_id = 0;
|
||||||
|
_next_group_id += _retained_take_cnt;
|
||||||
_operation_rgroup_map.clear();
|
_operation_rgroup_map.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,9 +202,14 @@ public:
|
||||||
static uint64_t next_group_id () { return _next_group_id; }
|
static uint64_t next_group_id () { return _next_group_id; }
|
||||||
static void set_next_group_id (uint64_t ngid) { _next_group_id = ngid; }
|
static void set_next_group_id (uint64_t ngid) { _next_group_id = ngid; }
|
||||||
|
|
||||||
/* access the retained group-id for actions like Recording, Import */
|
/* access the retained group-id for actions like Recording, Import.
|
||||||
static uint64_t get_retained_group_id () {
|
*
|
||||||
return _retained_group_id;
|
* Note When a single take creates multiple layered regions (e.g. loop recording)
|
||||||
|
* then the group id need to be bumped for each take
|
||||||
|
*/
|
||||||
|
static uint64_t get_retained_group_id (uint64_t take = 0) {
|
||||||
|
_retained_take_cnt = std::max (_retained_take_cnt, take);
|
||||||
|
return _retained_group_id + (take << 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* access the group-id for an operation on a region, honoring the existing region's group status */
|
/* access the group-id for an operation on a region, honoring the existing region's group status */
|
||||||
|
@ -617,6 +624,7 @@ private:
|
||||||
Explicit = 0x1, // the user has explicitly grouped or ungrouped this region. explicitly grouped regions can cross track-group boundaries
|
Explicit = 0x1, // the user has explicitly grouped or ungrouped this region. explicitly grouped regions can cross track-group boundaries
|
||||||
};
|
};
|
||||||
static uint64_t _retained_group_id;
|
static uint64_t _retained_group_id;
|
||||||
|
static uint64_t _retained_take_cnt;
|
||||||
static uint64_t _next_group_id;
|
static uint64_t _next_group_id;
|
||||||
|
|
||||||
static Glib::Threads::Mutex _operation_rgroup_mutex;
|
static Glib::Threads::Mutex _operation_rgroup_mutex;
|
||||||
|
|
|
@ -93,6 +93,7 @@ PBD::Signal2<void,std::shared_ptr<ARDOUR::RegionList>,const PropertyChange&> Reg
|
||||||
|
|
||||||
/* these static values are used by Region Groups to assign a group-id across the scope of an operation that might span many function calls */
|
/* these static values are used by Region Groups to assign a group-id across the scope of an operation that might span many function calls */
|
||||||
uint64_t Region::_retained_group_id = 0;
|
uint64_t Region::_retained_group_id = 0;
|
||||||
|
uint64_t Region::_retained_take_cnt = 0;
|
||||||
uint64_t Region::_next_group_id = 0;
|
uint64_t Region::_next_group_id = 0;
|
||||||
|
|
||||||
std::map<uint64_t, uint64_t> Region::_operation_rgroup_map;
|
std::map<uint64_t, uint64_t> Region::_operation_rgroup_map;
|
||||||
|
|
|
@ -1051,7 +1051,8 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture
|
||||||
const samplepos_t preroll_off = _session.preroll_record_trim_len ();
|
const samplepos_t preroll_off = _session.preroll_record_trim_len ();
|
||||||
const timepos_t cstart (timepos_t (capture_info.front()->start).beats());
|
const timepos_t cstart (timepos_t (capture_info.front()->start).beats());
|
||||||
|
|
||||||
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
|
int cnt = 0;
|
||||||
|
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci, ++cnt) {
|
||||||
|
|
||||||
string region_name;
|
string region_name;
|
||||||
|
|
||||||
|
@ -1089,7 +1090,7 @@ Track::use_captured_midi_sources (SourceList& srcs, CaptureInfos const & capture
|
||||||
plist.add (Properties::length, l);
|
plist.add (Properties::length, l);
|
||||||
plist.add (Properties::opaque, rmode != RecSoundOnSound);
|
plist.add (Properties::opaque, rmode != RecSoundOnSound);
|
||||||
plist.add (Properties::name, region_name);
|
plist.add (Properties::name, region_name);
|
||||||
plist.add (Properties::reg_group, Region::get_retained_group_id());
|
plist.add (Properties::reg_group, Region::get_retained_group_id (cnt));
|
||||||
|
|
||||||
std::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
|
std::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
|
||||||
midi_region = std::dynamic_pointer_cast<MidiRegion> (rx);
|
midi_region = std::dynamic_pointer_cast<MidiRegion> (rx);
|
||||||
|
@ -1177,7 +1178,8 @@ Track::use_captured_audio_sources (SourceList& srcs, CaptureInfos const & captur
|
||||||
samplecnt_t buffer_position = afs->last_capture_start_sample ();
|
samplecnt_t buffer_position = afs->last_capture_start_sample ();
|
||||||
CaptureInfos::const_iterator ci;
|
CaptureInfos::const_iterator ci;
|
||||||
|
|
||||||
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
|
int cnt = 0;
|
||||||
|
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci, ++cnt) {
|
||||||
|
|
||||||
string region_name;
|
string region_name;
|
||||||
|
|
||||||
|
@ -1194,7 +1196,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::length, timecnt_t ((*ci)->samples, timepos_t::zero (false)));
|
||||||
plist.add (Properties::name, region_name);
|
plist.add (Properties::name, region_name);
|
||||||
plist.add (Properties::opaque, rmode != RecSoundOnSound);
|
plist.add (Properties::opaque, rmode != RecSoundOnSound);
|
||||||
plist.add (Properties::reg_group, Region::get_retained_group_id());
|
plist.add (Properties::reg_group, Region::get_retained_group_id (cnt));
|
||||||
|
|
||||||
std::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
|
std::shared_ptr<Region> rx (RegionFactory::create (srcs, plist));
|
||||||
region = std::dynamic_pointer_cast<AudioRegion> (rx);
|
region = std::dynamic_pointer_cast<AudioRegion> (rx);
|
||||||
|
|
Loading…
Reference in New Issue