Use double comparison in MidiRegionView::note_in_region_range().
authornick_m <mainsbridge@gmail.com>
Sat, 8 Oct 2016 16:24:14 +0000 (03:24 +1100)
committernick_m <mainsbridge@gmail.com>
Sat, 8 Oct 2016 16:24:14 +0000 (03:24 +1100)
gtk2_ardour/midi_region_view.cc

index a2aa46f3ff607c354ba200dc2672d3535cd8916f..f1404c936c5b240526a3ccad6744df306a502b49 100644 (file)
@@ -1671,8 +1671,10 @@ bool
 MidiRegionView::note_in_region_range (const boost::shared_ptr<NoteType> note, bool& visible) const
 {
        const boost::shared_ptr<ARDOUR::MidiRegion> midi_reg = midi_region();
-       const bool outside = (note->time() < midi_reg->start_beats() ||
-                             note->time() > midi_reg->start_beats() + midi_reg->length_beats());
+
+       /* must compare double explicitly as Beats::operator< rounds to ppqn */
+       const bool outside = (note->time().to_double() < midi_reg->start_beats().to_double() ||
+                             note->time().to_double() > (midi_reg->start_beats() + midi_reg->length_beats()).to_double());
 
        visible = (note->note() >= midi_stream_view()->lowest_note()) &&
                (note->note() <= midi_stream_view()->highest_note());