mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Clamp output of y_to_note so that it doesn't return out-of-range values. Should fix #3823.
git-svn-id: svn://localhost/ardour2/branches/3.0@9096 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0d40ff55c8
commit
e64486acfa
2 changed files with 15 additions and 4 deletions
|
|
@ -628,3 +628,17 @@ MidiStreamView::update_rec_box ()
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue