[Scummvm-cvs-logs] SF.net SVN: scummvm:[49414] scummvm/trunk/engines/sci/sound
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Jun 3 23:57:50 CEST 2010
Revision: 49414
http://scummvm.svn.sourceforge.net/scummvm/?rev=49414&view=rev
Author: thebluegr
Date: 2010-06-03 21:57:49 +0000 (Thu, 03 Jun 2010)
Log Message:
-----------
Added channel remapping to MidiParser_SCI (currently unused)
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-03 21:52:21 UTC (rev 49413)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp 2010-06-03 21:57:49 UTC (rev 49414)
@@ -60,6 +60,9 @@
_dataincToAdd = 0;
_resetOnPause = false;
_channelsUsed = 0;
+
+ for (int i = 0; i < 16; i++)
+ _channelRemap[i] = i;
}
MidiParser_SCI::~MidiParser_SCI() {
@@ -120,17 +123,26 @@
// Center the pitch wheels and hold pedal in preparation for the next piece of music
if (_driver) {
for (int i = 0; i < 16; ++i) {
- if (_channelsUsed & (1 << i)) {
+ if (isChannelUsed(i)) {
_driver->send(0xE0 | i, 0, 0x40); // Reset pitch wheel
_driver->send(0xB0 | i, 0x40, 0); // Reset hold pedal
}
}
}
+
+ for (int i = 0; i < 16; i++)
+ _channelRemap[i] = i;
}
void MidiParser_SCI::parseNextEvent(EventInfo &info) {
+ byte remappedChannel = _channelRemap[info.channel()];
+
+ // Remap channel. Keep the upper 4 bits (command code) and change
+ // the lower 4 bits (channel)
+ info.event = (info.event & 0xF0) | (remappedChannel & 0xF);
+
// Monitor which channels are used by this song
- _channelsUsed |= (1 << info.channel());
+ setChannelUsed(info.channel());
// Set signal AFTER waiting for delta, otherwise we would set signal too soon resulting in all sorts of bugs
if (_dataincAdd) {
Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.h
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.h 2010-06-03 21:52:21 UTC (rev 49413)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.h 2010-06-03 21:57:49 UTC (rev 49414)
@@ -71,7 +71,16 @@
jumpToTick(0);
}
+ 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
+ _channelRemap[channel] = newChannel;
+ }
+
protected:
+ bool isChannelUsed(byte channel) { return _channelsUsed & (1 << channel); }
+ void setChannelUsed(byte channel) { _channelsUsed |= (1 << channel); }
+
void parseNextEvent(EventInfo &info);
byte *midiMixChannels();
byte *midiFilterChannels(int channelMask);
@@ -93,6 +102,8 @@
// A 16-bit mask, containing the channels used
// by the currently parsed song
uint16 _channelsUsed;
+
+ byte _channelRemap[16];
};
} // End of namespace Sci
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