View Issue Details

IDProjectCategoryView StatusLast Update
0006202ardourbugspublic2020-04-19 20:17
Reporterchaot Assigned Tox42  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Summary0006202: Duplicating multiple selected regions more than once does not work as expected
DescriptionVersion:
========
3.5.4699 (also reproduced by rgareus with 4765)

Description:
============
Duplicating *multiple* selected regions *more than once* does not work as expected. See screenshots:

1) Initial regions
2) Duplicating... (note the 2.0 in the dialogue)
3) Result
4) What I would expect it to be

Reproduce:
==========
See screenshots 1) - 3).
TagsNo tags attached.

Activities

2015-03-15 12:05

 

2015-03-15 12:05

 

2015-03-15 12:05

 

2015-03-15 12:06

 

2015-09-20 19:51

 

bug6202.patch (2,751 bytes)   
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index d536bf9..2137cb5 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 ();
+	framepos_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 bb211db..37a7ee7 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, framepos_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 8862c63..bb5a61b 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, framepos_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) {
bug6202.patch (2,751 bytes)   

x42

2015-09-20 20:24

administrator   ~0017327

patch applied. Thanks a lot

system

2020-04-19 20:17

developer   ~0023416

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2015-03-15 12:05 chaot New Issue
2015-03-15 12:05 chaot File Added: Screenshot from 2015-03-15 12:43:20.png
2015-03-15 12:05 chaot File Added: Screenshot from 2015-03-15 12:43:30.png
2015-03-15 12:05 chaot File Added: Screenshot from 2015-03-15 12:43:34.png
2015-03-15 12:06 chaot File Added: Screenshot from 2015-03-15 12:43:55.png
2015-09-20 19:51 chaot File Added: bug6202.patch
2015-09-20 20:24 x42 Note Added: 0017327
2015-09-20 21:26 x42 Status new => resolved
2015-09-20 21:26 x42 Resolution open => fixed
2015-09-20 21:26 x42 Assigned To => x42
2020-04-19 20:17 system Note Added: 0023416
2020-04-19 20:17 system Status resolved => closed