can be put below ghost regions from MIDI underlays
*/
_note_lines = new ArdourCanvas::LineSet (_canvas_group, ArdourCanvas::LineSet::Horizontal);
-
+
_note_lines->Event.connect(
sigc::bind(sigc::mem_fun(_trackview.editor(),
&PublicEditor::canvas_stream_view_event),
double h = y - prev_y;
double mid = y + (h/2.0);
-
+
if (height > 1.0) { // XXX ? should that not be h >= 1 ?
_note_lines->add (mid, h, color);
}
uint8_t
MidiStreamView::y_to_note (double y) const
{
- int const n = ((contents_height() - y - 1) / contents_height() * (double)contents_note_range())
+ int const n = ((contents_height() - y) / contents_height() * (double)contents_note_range())
+ lowest_note();
if (n < 0) {
return 127;
}
- return n;
+ /* min due to rounding and/or off-by-one errors */
+ return min ((uint8_t) n, highest_note());
}
/** Suspend updates to the regions' note ranges and our
MidiStreamView::resume_updates ()
{
_updates_suspended = false;
-
+
draw_note_lines ();
apply_note_range_to_regions ();