Ensure midi region start trim always sets _start_beats.
authornick_m <mainsbridge@gmail.com>
Sun, 9 Oct 2016 12:40:54 +0000 (23:40 +1100)
committernick_m <mainsbridge@gmail.com>
Sun, 9 Oct 2016 12:40:54 +0000 (23:40 +1100)
- Property::set() requires that new_val != current for a change
  to occur, but Beats::operator!= has tick resolution.
  i think this is pretty good evidence that _start/_length_beats
  should actually be double rather than Evoral::Beats
  (adjusting a region by increments of less than a tick
  is desirable).

libs/ardour/midi_region.cc

index fee10e292cfebcd3772946790c284ea465811d7c..d4cf35e82a273df082c2f63bed16f8dee716d0ec 100644 (file)
@@ -637,8 +637,8 @@ MidiRegion::trim_to_internal (framepos_t position, framecnt_t length, const int3
                        return;
                }
 
-               /* at small deltas, (high zooms) the property will not change without this. tick rounding?*/
-               _start_beats = Evoral::Beats();
+               /* at small deltas, (high zooms) the property will not change without this (tick resolution of Beats::operator!=)*/
+               _start_beats += Evoral::Beats (new_start_qn) + start_beats().tick() * 2.0;
                _start_beats = Evoral::Beats (new_start_qn);
                what_changed.add (Properties::start_beats);