Fix reverse MIDI playback

upper_bound() returns the first element that is **greater** than
the given value. So during reverse playback we need the value
before that.

Likewise for forward playback, lower_bound() returns an iterator
pointing to the element before the one that need to be played.
This commit is contained in:
Robin Gareus 2020-05-25 17:19:44 +02:00
parent 59c914e2db
commit 0d4ea1e61f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -302,8 +302,16 @@ RTMidiBuffer::read (MidiBuffer& dst, samplepos_t start, samplepos_t end, MidiSta
*/
if (reverse) {
if (evtime > start) {
--item;
continue;
}
evtime = start - evtime;
} else {
if (evtime < start) {
++item;
continue;
}
evtime -= start;
}