Midi regions recalculate their length in frames when moved/copied.
authornick_m <mainsbridge@gmail.com>
Sun, 5 Jun 2016 17:54:23 +0000 (03:54 +1000)
committernick_m <mainsbridge@gmail.com>
Sun, 5 Jun 2016 17:54:23 +0000 (03:54 +1000)
- should fix 6793

libs/ardour/midi_region.cc

index 7bb5bc7c0607ff543d4b971f3a5ad96d34a1c81f..bdf24f5e086a5071159bff142825176d142fff87 100644 (file)
@@ -192,6 +192,10 @@ void
 MidiRegion::set_length_internal (framecnt_t len)
 {
        Region::set_length_internal (len);
+       /* XX this seems wrong. we asked to set the length in 
+          frames without requesting a new beat.
+          may cause beat drift due to frame rounding.
+       */
        update_length_beats ();
 }
 
@@ -223,16 +227,13 @@ void
 MidiRegion::set_position_internal (framepos_t pos, bool allow_bbt_recompute)
 {
        Region::set_position_internal (pos, allow_bbt_recompute);
-       /* zero length regions don't exist - so if _length_beats is zero, this object
-          is under construction.
+
+       /* leave _length_beats alone, and change _length to reflect the state of things
+          at the new position (tempo map may dictate a different number of frames
        */
-       if (_length_beats.val() == Evoral::Beats()) {
-               /* leave _length_beats alone, and change _length to reflect the state of things
-                  at the new position (tempo map may dictate a different number of frames
-               */
-               BeatsFramesConverter converter (_session.tempo_map(), _position);
-               Region::set_length_internal (converter.to (_length_beats));
-       }
+       BeatsFramesConverter converter (_session.tempo_map(), _position);
+       Region::set_length_internal (converter.to (_length_beats));
+       send_change (Properties::length);
 }
 
 framecnt_t