[Scummvm-cvs-logs] SF.net SVN: scummvm:[49673] scummvm/trunk/engines/sci/sound
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue Jun 15 00:35:49 CEST 2010
Revision: 49673
http://scummvm.svn.sourceforge.net/scummvm/?rev=49673&view=rev
Author: thebluegr
Date: 2010-06-14 22:35:49 +0000 (Mon, 14 Jun 2010)
Log Message:
-----------
SCI: Added a version of allNotesOff() which sends messages only to the channels used by the associated song instead of all channels
Modified Paths:
--------------
scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
scummvm/trunk/engines/sci/sound/midiparser_sci.h
Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp 2010-06-14 22:31:38 UTC (rev 49672)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp 2010-06-14 22:35:49 UTC (rev 49673)
@@ -325,7 +325,41 @@
}// switch (info.command())
}
+void MidiParser_SCI::allNotesOff() {
+ if (!_driver)
+ return;
+ int i, j;
+
+ // Turn off all active notes
+ for (i = 0; i < 128; ++i) {
+ for (j = 0; j < 16; ++j) {
+ if ((_active_notes[i] & (1 << j)) && isChannelUsed(j)){
+ _driver->send(0x80 | j, i, 0);
+ }
+ }
+ }
+
+ // Turn off all hanging notes
+ for (i = 0; i < ARRAYSIZE(_hanging_notes); i++) {
+ if (_hanging_notes[i].time_left) {
+ _driver->send(0x80 | _hanging_notes[i].channel, _hanging_notes[i].note, 0);
+ _hanging_notes[i].time_left = 0;
+ }
+ }
+ _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) {
+ if (isChannelUsed(i))
+ _driver->send(0xB0 | i, 0x7b, 0); // All notes off
+ }
+
+ memset(_active_notes, 0, sizeof(_active_notes));
+}
+
byte MidiParser_SCI::midiGetNextChannel(long ticker) {
byte curr = 0xFF;
long closest = ticker + 1000000, next = 0;
Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.h
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.h 2010-06-14 22:31:38 UTC (rev 49672)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.h 2010-06-14 22:35:49 UTC (rev 49673)
@@ -71,6 +71,8 @@
jumpToTick(0);
}
+ void allNotesOff();
+
void remapChannel(byte channel, byte newChannel) {
assert(channel < 0xF); // don't touch special SCI channel 15
assert(newChannel < 0xF); // don't touch special SCI channel 15
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list