[Scummvm-cvs-logs] CVS: scummvm/sound midiparser.cpp,1.28,1.29
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Mon Oct 10 00:01:28 CEST 2005
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17406
Modified Files:
midiparser.cpp
Log Message:
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.
Index: midiparser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/midiparser.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- midiparser.cpp 24 Jun 2005 16:16:46 -0000 1.28
+++ midiparser.cpp 10 Oct 2005 07:00:31 -0000 1.29
@@ -256,9 +256,17 @@
}
_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));
}
More information about the Scummvm-git-logs
mailing list