aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-10-10 07:00:31 +0000
committerTorbjörn Andersson2005-10-10 07:00:31 +0000
commit5b92d1e9fa2af8d371144a18c319215bc92b6bdf (patch)
treee484e21bad9ed1181fa02f32b06edf53aee0ac2c
parent836ed9c9e069b479f34e7977cdbc9c140246baef (diff)
downloadscummvm-rg350-5b92d1e9fa2af8d371144a18c319215bc92b6bdf.tar.gz
scummvm-rg350-5b92d1e9fa2af8d371144a18c319215bc92b6bdf.tar.bz2
scummvm-rg350-5b92d1e9fa2af8d371144a18c319215bc92b6bdf.zip
I noticed yesterday that if you change music in IHNM at the "right" moment,
the music will be horribly out of tune because the pitch wheel setting from the old music will still apply. I hope allNotesOff() is the correct place to ensure that the pitch wheel is centered. svn-id: r18998
-rw-r--r--sound/midiparser.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/midiparser.cpp b/sound/midiparser.cpp
index 547a43bd1b..43fd7091ae 100644
--- a/sound/midiparser.cpp
+++ b/sound/midiparser.cpp
@@ -256,9 +256,17 @@ void MidiParser::allNotesOff() {
}
_hanging_notes_count = 0;
- // To be sure, send an "All Note Off" event (but not all MIDI devices support this...)
- for (i = 0; i < 16; ++i)
- _driver->send(0x007BB0 | i);
+ // To be sure, send an "All Note Off" event (but not all MIDI devices
+ // support this...). We also reset all controllers and, but in case
+ // that isn't supported either we manually center the pitch wheel. This
+ // should ensure that the next piece of music isn't played off-key.
+
+ for (i = 0; i < 16; ++i) {
+ _driver->send(0x007BB0 | i); // All notes off
+ _driver->send(0x0079B0 | i); // All controllers off
+ _driver->send(0x4000E0 | i); // Center the pitch wheel
+ }
+
memset(_active_notes, 0, sizeof(_active_notes));
}