Hanging notes in KQ4 SCI with MT-32 (patch inside)
|Reported by:||SF/sven3000||Owned by:||bluegr|
|Game:||King's Quest 4|
In King's Quest 4 SCI, if the music played when the unicorn is interrupted prematurely some notes can hang. This was observed with a real Roland MT-32 connected via USB MIDI cable, and with the built-in MT-32 emulator.
This is caused because a MIDI sustain controller message is sent on the channel in question (in this case channel 4; the MIDI data is B4 40 7F) to turn the sustain on full. The sustain message is not cancelled when the music is interrupted; only an "all notes off" message (Bn 7B 00; where n in the channel) is sent on all channels.
The issue could occur in any SCI game with a music track containing sustain messages, and probably also with other MIDI devices than the MT-32. I have only observed it in this specific scenario so far, however.
Since this issue did not occur with DOSBox, I captured the MIDI data it sent to the MT-32 by DOSBox. I observed that it paired a sustain off (Bn 40 00) message with each all notes off message.
Attached is a patch that modifies the MidiParser_SCI::allNotesOff function to send a sustain off message on all channels. This appears to fix the issue, but further testing may be needed to see if this doesn't have any side-effects.
This issue was observed on ScummVM 1.2 and 1.3svn54422 on Windows 7 x64, with game versions 1.000.111 and 1.006.004.
Ticket imported from: #3116608. Ticket imported from: bugs/5524.