mrv->extend_active_notes ();
}
+uint8_t
+MidiStreamView::y_to_note (double y) const
+{
+ int const n = ((contents_height() - y - 1) / contents_height() * (double)contents_note_range())
+ + lowest_note();
+
+ if (n < 0) {
+ return 0;
+ } else if (n > 127) {
+ return 127;
+ }
+
+ return n;
+}
{ return contents_height()
- (note + 1 - lowest_note()) * note_height() + 1; }
- inline uint8_t y_to_note(double y) const
- { return (uint8_t)((contents_height() - y - 1)
- / contents_height() * (double)contents_note_range())
- + lowest_note(); }
+ uint8_t y_to_note(double y) const;
inline double note_height() const
{ return contents_height() / (double)contents_note_range(); }