summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor_ops.cc4
-rw-r--r--libs/ardour/ardour/playlist.h1
-rw-r--r--libs/ardour/playlist.cc9
3 files changed, 12 insertions, 2 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 572cbe3981..cc67e02ee8 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -4792,6 +4792,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
framepos_t const start_frame = regions.start ();
framepos_t const end_frame = regions.end_frame ();
+ framecnt_t const gap = end_frame - start_frame;
begin_reversible_command (Operations::duplicate_region);
@@ -4806,9 +4807,10 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
latest_regionviews.clear ();
sigc::connection c = rtv->view()->RegionViewAdded.connect (sigc::mem_fun(*this, &Editor::collect_new_region_view));
+ framepos_t const position = end_frame + (r->first_frame() - start_frame);
playlist = (*i)->region()->playlist();
playlist->clear_changes ();
- playlist->duplicate (r, end_frame + (r->first_frame() - start_frame), times);
+ playlist->duplicate (r, position, gap, times);
_session->add_command(new StatefulDiffCommand (playlist));
c.disconnect ();
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index bb211dbe58..eadd237143 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -140,6 +140,7 @@ public:
void shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue);
void partition (framepos_t start, framepos_t end, bool cut = false);
void duplicate (boost::shared_ptr<Region>, framepos_t position, float times);
+ void duplicate (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, float times);
void nudge_after (framepos_t start, framecnt_t distance, bool forwards);
boost::shared_ptr<Region> combine (const RegionList&);
void uncombine (boost::shared_ptr<Region>);
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 8862c633ab..868be8da19 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -1245,6 +1245,13 @@ Playlist::flush_notifications (bool from_undo)
void
Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, float times)
{
+ duplicate(region, position, region->length(), times);
+ }
+
+/** @param gap from the beginning of the region to the next beginning */
+ void
+ Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, framecnt_t gap, float times)
+ {
times = fabs (times);
RegionWriteLock rl (this);
@@ -1255,7 +1262,7 @@ Playlist::flush_notifications (bool from_undo)
boost::shared_ptr<Region> copy = RegionFactory::create (region, true);
add_region_internal (copy, pos);
set_layer (copy, DBL_MAX);
- pos += region->length();
+ pos += gap;
}
if (floor (times) != times) {