diff options
author | Johannes Schickel | 2011-07-10 05:21:25 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-07-10 05:21:25 +0200 |
commit | abbd29b16ab8f4c893415c630bb529b0e4c194ab (patch) | |
tree | e6909f45f3a19fbb7ab369c0ff0463a4aead63ca | |
parent | 0a94fc5b7bed22f846f2d28797107496454b0ecb (diff) | |
download | scummvm-rg350-abbd29b16ab8f4c893415c630bb529b0e4c194ab.tar.gz scummvm-rg350-abbd29b16ab8f4c893415c630bb529b0e4c194ab.tar.bz2 scummvm-rg350-abbd29b16ab8f4c893415c630bb529b0e4c194ab.zip |
SCUMM: Limit iMuse default instrument load to PC Speaker output.
Albeit the code is marked as a hack inside the source, the original behaved
exaclty the same. If the code is removed the PC Speaker output will miss notes,
since unlike the original we only output to parts, which have an instrument set
up.
-rw-r--r-- | engines/scumm/imuse/imuse.cpp | 15 | ||||
-rw-r--r-- | engines/scumm/imuse/imuse.h | 3 | ||||
-rw-r--r-- | engines/scumm/imuse/imuse_internal.h | 5 | ||||
-rw-r--r-- | engines/scumm/imuse/imuse_part.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/imuse/sysex_scumm.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 3 |
6 files changed, 20 insertions, 12 deletions
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 961d0690d0..912ab71420 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -64,7 +64,8 @@ _queue_cleared(0), _master_volume(0), _music_volume(0), _trigger_count(0), -_snm_trigger_index(0) { +_snm_trigger_index(0), +_pcSpeaker(false) { memset(_channel_volume,0,sizeof(_channel_volume)); memset(_channel_volume_eff,0,sizeof(_channel_volume_eff)); memset(_volchan_table,0,sizeof(_volchan_table)); @@ -467,6 +468,10 @@ uint32 IMuseInternal::property(int prop, uint32 value) { case IMuse::PROP_GAME_ID: _game_id = value; break; + + case IMuse::PROP_PC_SPEAKER: + _pcSpeaker = (value != 0); + break; } return 0; @@ -1670,20 +1675,20 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) { void IMuseInternal::setGlobalAdLibInstrument(byte slot, byte *data) { if (slot < 32) { - _global_adlib_instruments[slot].adlib(data); + _global_instruments[slot].adlib(data); } } void IMuseInternal::setGlobalPcSpkInstrument(byte slot, byte *data) { if (slot < 32) { - _global_adlib_instruments[slot].pcspk(data); + _global_instruments[slot].pcspk(data); } } -void IMuseInternal::copyGlobalAdLibInstrument(byte slot, Instrument *dest) { +void IMuseInternal::copyGlobalInstrument(byte slot, Instrument *dest) { if (slot >= 32) return; - _global_adlib_instruments[slot].copy_to(dest); + _global_instruments[slot].copy_to(dest); } diff --git a/engines/scumm/imuse/imuse.h b/engines/scumm/imuse/imuse.h index 8014b13409..73f0bb9a90 100644 --- a/engines/scumm/imuse/imuse.h +++ b/engines/scumm/imuse/imuse.h @@ -55,7 +55,8 @@ public: PROP_GS, PROP_LIMIT_PLAYERS, PROP_RECYCLE_PLAYERS, - PROP_GAME_ID + PROP_GAME_ID, + PROP_PC_SPEAKER }; public: diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h index 76a8c76683..8ac9e77535 100644 --- a/engines/scumm/imuse/imuse_internal.h +++ b/engines/scumm/imuse/imuse_internal.h @@ -434,7 +434,8 @@ protected: Player _players[8]; Part _parts[32]; - Instrument _global_adlib_instruments[32]; + bool _pcSpeaker; + Instrument _global_instruments[32]; CommandQueue _cmd_queue[64]; DeferredCommand _deferredCommands[4]; @@ -501,7 +502,7 @@ protected: void reallocateMidiChannels(MidiDriver *midi); void setGlobalAdLibInstrument(byte slot, byte *data); void setGlobalPcSpkInstrument(byte slot, byte *data); - void copyGlobalAdLibInstrument(byte slot, Instrument *dest); + void copyGlobalInstrument(byte slot, Instrument *dest); bool isNativeMT32() { return _native_mt32; } protected: diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp index 82ad9b70d2..630dd35442 100644 --- a/engines/scumm/imuse/imuse_part.cpp +++ b/engines/scumm/imuse/imuse_part.cpp @@ -206,7 +206,7 @@ void Part::set_instrument_pcspk(byte *data) { } void Part::load_global_instrument(byte slot) { - _player->_se->copyGlobalAdLibInstrument(slot, &_instrument); + _player->_se->copyGlobalInstrument(slot, &_instrument); if (clearToTransmit()) _instrument.send(_mc); } diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp index 160cdf500a..035953f140 100644 --- a/engines/scumm/imuse/sysex_scumm.cpp +++ b/engines/scumm/imuse/sysex_scumm.cpp @@ -93,9 +93,9 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) { // anyway. if (player->_isMIDI) { part->_instrument.program((p[15] & 0x0F) << 4 |(p[16] & 0x0F), player->_isMT32); - } else { + } else if (se->_pcSpeaker) { // FIXME/HACK: This is only needed here, since when we use the following line: - // se->copyGlobalAdLibInstrument((p[15] & 0x0F) << 4 |(p[16] & 0x0F), &part->_instrument); + // se->copyGlobalInstrument((p[15] & 0x0F) << 4 |(p[16] & 0x0F), &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}; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index ed1c90145d..22b02e8e03 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1867,7 +1867,6 @@ void ScummEngine::setupMusic(int midi) { adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB)); adlibMidiDriver->property(MidiDriver::PROP_OLD_ADLIB, (_game.features & GF_SMALL_HEADER) ? 1 : 0); } else if (_musicType == MDT_PCSPK) { - // HACK adlibMidiDriver = new PcSpkDriver(_mixer); } @@ -1897,6 +1896,8 @@ void ScummEngine::setupMusic(int midi) { _imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1); _imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1); } + if (_musicType == MDT_PCSPK) + _imuse->property(IMuse::PROP_PC_SPEAKER, 1); } } } |