Fix velocity offset edge case

If the velocity of a note was, for instance, 30, and the velocity slider was at -30, then you'd get a data2 of 0, which wouldn't be clamped (and would produce a note off).  However, if the note were 29 or 31, you'd get a velocity of 1.  This makes it so that note ons always have a velocity of at least 1, even in that edge case.
This commit is contained in:
Pokechu22 2017-06-16 12:41:22 -07:00 committed by Paul Licameli
parent 896d5d682b
commit 8a02687b5f
1 changed files with 1 additions and 1 deletions

View File

@ -3910,7 +3910,7 @@ void AudioIO::OutputEvent()
int offset = mNextEventTrack->GetVelocity();
data2 += offset; // offset comes from per-track slider
// clip velocity to insure a legal note-on value
data2 = (data2 < 0 ? 1 : (data2 > 127 ? 127 : data2));
data2 = (data2 < 1 ? 1 : (data2 > 127 ? 127 : data2));
// since we are going to play this note, we need to get a note_off
mIterator->request_note_off();
} else data2 = 0; // 0 velocity means "note off"