[Scummvm-git-logs] scummvm master -> 6f575e580c318d3573027903fdd5f25e17bee206
mduggan
mgithub at guarana.org
Sat Jun 13 14:33:35 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6f575e580c MIDI: Fix XMIDI hanging notes
Commit: 6f575e580c318d3573027903fdd5f25e17bee206
https://github.com/scummvm/scummvm/commit/6f575e580c318d3573027903fdd5f25e17bee206
Author: NMIError (crampen at gmail.com)
Date: 2020-06-13T23:33:31+09:00
Commit Message:
MIDI: Fix XMIDI hanging notes
XMIDI uses Note On events with a length which specifies when a corresponding
Note Off event should be generated. Some XMIDI data contains notes with length
0, which are played very briefly by AIL. However, the ScummVM MidiParser will
treat Note On events with length 0 as "active notes", meaning it will wait for
a Note Off event before turning off the note. The Note Off will never come and
the note will hang.
This is particularly noticable in Ultima 8 (first section of the track that
plays at the beginning of the game, at the shore) and The 7th Guest (the track
that plays while solving the cake puzzle).
I've fixed this by changing the length from 0 to 1. This will cause the notes
to be active for the minimum length.
Changed paths:
audio/midiparser_xmidi.cpp
diff --git a/audio/midiparser_xmidi.cpp b/audio/midiparser_xmidi.cpp
index 2782919fcf..ad4ced3769 100644
--- a/audio/midiparser_xmidi.cpp
+++ b/audio/midiparser_xmidi.cpp
@@ -180,6 +180,14 @@ void MidiParser_XMIDI::parseNextEvent(EventInfo &info) {
info.basic.param1 = *(_position._playPos++);
info.basic.param2 = *(_position._playPos++);
info.length = readVLQ(_position._playPos);
+ if (info.length == 0) {
+ // Notes with length 0 are played with a very short duration by the AIL driver.
+ // However, the MidiParser will treat notes with length 0 as "active notes"; i.e.
+ // they will only get turned off when a corresponding Note Off event is encountered.
+ // Because XMIDI does not contain Note Off events, this will cause the note to hang.
+ // Set length to 1 to prevent this from happening.
+ info.length = 1;
+ }
if (info.basic.param2 == 0) {
info.event = info.channel() | 0x80;
info.length = 0;
More information about the Scummvm-git-logs
mailing list