From 8a02687b5f49201e69fa2b59e95180691dcfd6fa Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 16 Jun 2017 12:41:22 -0700 Subject: [PATCH] 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. --- src/AudioIO.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index d5fc90a1a..7eeffcad4 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -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"