View Issue Details

IDProjectCategoryView StatusLast Update
0001601ardourbugspublic2020-04-19 20:12
Reporterlincoln Assigned Totimbyr  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Summary0001601: Wrong duplicate region behaviour with multiple regions selected
DescriptionIf you have 2 regions a,b one after the other and you select both regions and press key d to duplicate the regions the end result is a,ab,b (ie, region a is duplicated but overlaps region b).

I was expecting the duplicate command to give me a,b,a,b since a and b formed part of a selection group.
TagsNo tags attached.

Relationships

related to 0002925 new Duplicate Range gives unexpected results 

Activities

2007-06-02 23:41

 

patch_editor_ops.patch (1,350 bytes)   
Index: gtk2_ardour/editor_ops.cc
===================================================================
--- gtk2_ardour/editor_ops.cc	(revision 1932)
+++ gtk2_ardour/editor_ops.cc	(working copy)
@@ -3005,13 +3005,17 @@
 void
 Editor::duplicate_some_regions (RegionSelection& regions, float times)
 {
+	
 	boost::shared_ptr<Playlist> playlist; 
 	RegionSelection sel = regions; // clear (below) will clear the argument list
-		
+
+	nframes_t start_frame = regions.start();
+	nframes_t end_frame = regions.end_frame();
+
 	begin_reversible_command (_("duplicate region"));
-
+	
 	selection->clear_regions ();
-
+	
 	for (RegionSelection::iterator i = sel.begin(); i != sel.end(); ++i) {
 
 		boost::shared_ptr<Region> r ((*i)->region());
@@ -3022,9 +3026,10 @@
 		
  		playlist = (*i)->region()->playlist();
                 XMLNode &before = playlist->get_state();
-		playlist->duplicate (r, r->last_frame(), times);
+		
+		playlist->duplicate (r, end_frame + (r->first_frame() - start_frame) + 1, times);
 		session->add_command(new MementoCommand<Playlist>(*playlist, &before, &playlist->get_state()));
-
+		
 		c.disconnect ();
 
 		if (latest_regionview) {
@@ -3043,6 +3048,7 @@
 		return;
 	}
 
+
 	boost::shared_ptr<Playlist> playlist; 
 	vector<boost::shared_ptr<AudioRegion> > new_regions;
 	vector<boost::shared_ptr<AudioRegion> >::iterator ri;
patch_editor_ops.patch (1,350 bytes)   

lincoln

2007-06-02 23:46

reporter   ~0004054

I attached a patch against 2.0.2 for editor_ops.cc. Please note that I offset the framce position by 1 when calling playlist->duplicate. I am not sure if there was an off by one error or not here.

I have tested this and duplicates of multiple regions work more as expected.

nowhiskey

2007-06-03 12:51

reporter   ~0004055

hi, i don't understand what you mean with "offset the framce position ...", but the patch works here good and as you say, the duplicate function works much more as expected.

cheers,
doc

cth103

2009-12-01 23:57

administrator   ~0007215

Applied to A3 SVN revision 6262. Thanks!

system

2020-04-19 20:12

developer   ~0021511

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
2007-04-09 00:02 lincoln New Issue
2007-06-02 23:41 lincoln File Added: patch_editor_ops.patch
2007-06-02 23:46 lincoln Note Added: 0004054
2007-06-03 12:51 nowhiskey Note Added: 0004055
2007-09-19 11:19 timbyr Status new => assigned
2007-09-19 11:19 timbyr Assigned To => timbyr
2009-11-26 03:04 cth103 Relationship added related to 0002925
2009-12-01 23:57 cth103 cost => 0.00
2009-12-01 23:57 cth103 Note Added: 0007215
2009-12-01 23:57 cth103 Status assigned => resolved
2009-12-01 23:57 cth103 Resolution open => fixed
2020-04-19 20:12 system Note Added: 0021511
2020-04-19 20:12 system Status resolved => closed