[Scummvm-cvs-logs] scummvm master -> f814dc971ca9f6526b4f6049642b79d6371dcfb8
lordhoto
lordhoto at gmail.com
Thu Jul 14 00:51:35 CEST 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9565af1ae4 SCUMM: Implement iMuse alloc part command closer to the original.
f814dc971c SCUMM: Handle default instrument set up in iMuse like the original.
Commit: 9565af1ae42674b67fd1ed744ae4855991ba8473
https://github.com/scummvm/scummvm/commit/9565af1ae42674b67fd1ed744ae4855991ba8473
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-07-13T15:49:32-07:00
Commit Message:
SCUMM: Implement iMuse alloc part command closer to the original.
Changed paths:
engines/scumm/imuse/sysex_scumm.cpp
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index ec64800..9f79513 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -49,38 +49,32 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
switch (code = *p++) {
case 0:
// Allocate new part.
- // There are 17 bytes of useful information here.
+ // There are 8 bytes (after decoding!) of useful information here.
// Here is what we know about them so far:
- // BYTE 00: Channel #
- // BYTE 02: BIT 01(0x01): Part on?(1 = yes)
+ // BYTE 0: Channel #
+ // BYTE 1: BIT 01(0x01): Part on?(1 = yes)
// BIT 02(0x02): Reverb? (1 = yes) [bug #1088045]
- // BYTE 03: Priority adjustment(upper 4 bits)
- // BYTE 04: Priority adjustment(lower 4 bits)
- // BYTE 05: Volume(upper 4 bits) [guessing]
- // BYTE 06: Volume(lower 4 bits) [guessing]
- // BYTE 07: Pan(upper 4 bits) [bug #1088045]
- // BYTE 08: Pan(lower 4 bits) [bug #1088045]
- // BYTE 09: BIT 04(0x08): Percussion?(1 = yes)
- // BYTE 13: Pitchbend range(upper 4 bits) [bug #1088045]
- // BYTE 14: Pitchbend range(lower 4 bits) [bug #1088045]
- // BYTE 15: Program(upper 4 bits)
- // BYTE 16: Program(lower 4 bits)
-
- // athrxx (05-21-2011):
- // BYTE 9, 10: Transpose (if set to 0x80, this means that part->_transpose_eff will be 0 (also ignoring player->_transpose)
- // BYTE 11, 12: Detune
+ // BYTE 2: Priority adjustment
+ // BYTE 3: Volume [guessing]
+ // BYTE 4: Pan [bug #1088045]
+ // BYTE 5: BIT 8(0x80): Percussion?(1 = yes) [guessed?]
+ // BYTE 5: Transpose, if set to 0x80(=-1) it means no transpose
+ // BYTE 6: Detune
+ // BYTE 7: Pitchbend factor [bug #1088045]
+ // BYTE 8: Program
part = player->getPart(p[0] & 0x0F);
+ player->decode_sysex_bytes(p + 1, buf + 1, len - 1);
if (part) {
- part->set_onoff(p[2] & 0x01);
- part->effectLevel((p[2] & 0x02) ? 127 : 0);
- part->set_pri((p[3] << 4) | p[4]);
- part->volume((p[5] & 0x0F) << 4 | (p[6] & 0x0F));
- part->set_pan((p[7] & 0x0F) << 4 | (p[8] & 0x0F));
- part->_percussion = player->_isMIDI ? ((p[9] & 0x08) > 0) : false;
- part->set_transpose((p[9] & 0x0F) << 4 | (p[10] & 0x0F));
- part->set_detune((p[11] & 0x0F) << 4 | (p[12] & 0x0F));
- part->pitchBendFactor((p[13] & 0x0F) << 4 | (p[14] & 0x0F));
+ part->set_onoff(buf[1] & 0x01);
+ part->effectLevel((buf[1] & 0x02) ? 127 : 0);
+ part->set_pri(buf[2]);
+ part->volume(buf[3]);
+ part->set_pan(buf[4]);
+ part->_percussion = player->_isMIDI ? ((buf[5] & 0x80) > 0) : false;
+ part->set_transpose(buf[5]);
+ part->set_detune(buf[6]);
+ part->pitchBendFactor(buf[7]);
if (part->_percussion) {
if (part->_mc) {
part->off();
@@ -93,10 +87,10 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
// cases, a regular program change message always seems to follow
// anyway.
if (player->_isMIDI) {
- part->_instrument.program((p[15] & 0x0F) << 4 | (p[16] & 0x0F), player->_isMT32);
+ part->_instrument.program(buf[8], player->_isMT32);
} else if (se->_pcSpeaker) {
// FIXME/HACK: This is only needed here, since when we use the following line:
- // se->copyGlobalInstrument((p[15] & 0x0F) << 4 |(p[16] & 0x0F), &part->_instrument);
+ // se->copyGlobalInstrument(buf[8], &part->_instrument);
// We would not get any instrument for PC Speaker. Because we don't default to an
// "empty" instrument in case the global instrument specified is not set up.
byte empty[23] = {0};
Commit: f814dc971ca9f6526b4f6049642b79d6371dcfb8
https://github.com/scummvm/scummvm/commit/f814dc971ca9f6526b4f6049642b79d6371dcfb8
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-07-13T15:49:32-07:00
Commit Message:
SCUMM: Handle default instrument set up in iMuse like the original.
Changed paths:
engines/scumm/imuse/imuse.cpp
engines/scumm/imuse/sysex_scumm.cpp
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 451721c..5ad4798 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -1682,7 +1682,21 @@ void IMuseInternal::setGlobalInstrument(byte slot, byte *data) {
void IMuseInternal::copyGlobalInstrument(byte slot, Instrument *dest) {
if (slot >= 32)
return;
- _global_instruments[slot].copy_to(dest);
+
+ // Both the AdLib code and the PC Speaker code use an all zero instrument
+ // as default in the original, thus we do the same.
+ // PC Speaker instrument size is 23, while AdLib instrument size is 30.
+ // Thus we just use a 30 byte instrument data array as default.
+ const byte defaultInstr[30] = { 0 };
+
+ if (_global_instruments[slot].isValid()) {
+ // In case we have an valid instrument set up, copy it to the part.
+ _global_instruments[slot].copy_to(dest);
+ } else if (_pcSpeaker) {
+ dest->pcspk(defaultInstr);
+ } else {
+ dest->adlib(defaultInstr);
+ }
}
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index 9f79513..85ffc86 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -81,20 +81,19 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
se->reallocateMidiChannels(player->_midi);
}
} else {
- // Even in cases where a program does not seem to be specified,
- // i.e. bytes 15 and 16 are 0, we send a program change because
- // 0 is a valid program number. MI2 tests show that in such
- // cases, a regular program change message always seems to follow
- // anyway.
if (player->_isMIDI) {
+ // Even in cases where a program does not seem to be specified,
+ // i.e. bytes 15 and 16 are 0, we send a program change because
+ // 0 is a valid program number. MI2 tests show that in such
+ // cases, a regular program change message always seems to follow
+ // anyway.
part->_instrument.program(buf[8], player->_isMT32);
- } else if (se->_pcSpeaker) {
- // FIXME/HACK: This is only needed here, since when we use the following line:
- // se->copyGlobalInstrument(buf[8], &part->_instrument);
- // We would not get any instrument for PC Speaker. Because we don't default to an
- // "empty" instrument in case the global instrument specified is not set up.
- byte empty[23] = {0};
- part->_instrument.pcspk(empty);
+ } else {
+ // Like the original we set up the instrument data of the
+ // specified program here too. In case the global
+ // instrument data is not loaded already, this will take
+ // care of setting a default instrument too.
+ se->copyGlobalInstrument(buf[8], &part->_instrument);
}
part->sendAll();
}
More information about the Scummvm-git-logs
mailing list