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:
Carl Hetherington 2011-03-07 17:17:11 +00:00
parent 0d40ff55c8
commit e64486acfa
2 changed files with 15 additions and 4 deletions

View file

@ -83,10 +83,7 @@ class MidiStreamView : public StreamView
{ 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(); }