- pos1 = current->position();
- pos2 = start;
- pos3 = end;
- pos4 = current->last_frame();
-
- if (overlap == Evoral::OverlapInternal) {
- /* split: we need 3 new regions, the front, middle and end.
- cut: we need 2 regions, the front and end.
- */
-
- /*
- start end
- ---------------*************************------------
- P1 P2 P3 P4
- SPLIT:
- ---------------*****++++++++++++++++====------------
- CUT
- ---------------*****----------------====------------
-
- */
-
- if (!cutting) {
- /* "middle" ++++++ */
-
- RegionFactory::region_name (new_name, current->name(), false);
-
- PropertyList plist;
-
- plist.add (Properties::start, current->start() + (pos2 - pos1));
- plist.add (Properties::length, pos3 - pos2);
- plist.add (Properties::name, new_name);
- plist.add (Properties::layer, current->layer ());
- plist.add (Properties::layering_index, current->layering_index ());
- plist.add (Properties::automatic, true);
- plist.add (Properties::left_of_split, true);
- plist.add (Properties::right_of_split, true);
-
- region = RegionFactory::create (current, plist);
- add_region_internal (region, start);
- new_regions.push_back (region);
- }
+ pos1 = current->position();
+ pos2 = start;
+ pos3 = end;
+ pos4 = current->last_frame();
+
+ if (overlap == Evoral::OverlapInternal) {
+ /* split: we need 3 new regions, the front, middle and end.
+ cut: we need 2 regions, the front and end.
+ */
+
+ /*
+ start end
+ ---------------*************************------------
+ P1 P2 P3 P4
+ SPLIT:
+ ---------------*****++++++++++++++++====------------
+ CUT
+ ---------------*****----------------====------------
+
+ */
+
+ if (!cutting) {
+ /* "middle" ++++++ */
+
+ RegionFactory::region_name (new_name, current->name(), false);
+
+ PropertyList plist;
+
+ plist.add (Properties::start, current->start() + (pos2 - pos1));
+ plist.add (Properties::length, pos3 - pos2);
+ plist.add (Properties::name, new_name);
+ plist.add (Properties::layer, current->layer ());
+ plist.add (Properties::layering_index, current->layering_index ());
+ plist.add (Properties::automatic, true);
+ plist.add (Properties::left_of_split, true);
+ plist.add (Properties::right_of_split, true);
+ maybe_add_start_beats (_session.tempo_map(), plist, current, current->start(), current->start() + (pos2 - pos1));
+
+ /* see note in :_split_region()
+ * for MusicFrame is needed to offset region-gain
+ */
+ region = RegionFactory::create (current, MusicFrame (pos2 - pos1, 0), plist);
+ add_region_internal (region, start);
+ new_regions.push_back (region);
+ }