diff options
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/detection.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 41 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 3 | ||||
-rw-r--r-- | engines/scumm/sound.cpp | 14 | ||||
-rw-r--r-- | engines/scumm/sound.h | 3 | ||||
-rw-r--r-- | engines/scumm/vars.cpp | 5 |
6 files changed, 37 insertions, 31 deletions
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 38b758b8fa..037c12bdbf 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -33,6 +33,8 @@ #include "common/savefile.h" #include "common/system.h" +#include "audio/mididrv.h" + #include "scumm/detection.h" #include "scumm/detection_tables.h" #include "scumm/he/intern_he.h" diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index d546f039fe..54c99144c8 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -299,7 +299,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _haveActorSpeechMsg = false; _useTalkAnims = false; _defaultTalkDelay = 0; - _musicType = MDT_NONE; _saveSound = 0; memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags)); memset(_scaleSlots, 0, sizeof(_scaleSlots)); @@ -1746,36 +1745,36 @@ void ScummEngine::setupMusic(int midi) { switch (MidiDriver::getMusicType(dev)) { case MT_NULL: - _musicType = MDT_NONE; + _sound->_musicType = MDT_NONE; break; case MT_PCSPK: - _musicType = MDT_PCSPK; + _sound->_musicType = MDT_PCSPK; break; case MT_PCJR: - _musicType = MDT_PCJR; + _sound->_musicType = MDT_PCJR; break; case MT_CMS: _musicType = MDT_CMS; break; case MT_TOWNS: - _musicType = MDT_TOWNS; + _sound->_musicType = MDT_TOWNS; break; case MT_ADLIB: - _musicType = MDT_ADLIB; + _sound->_musicType = MDT_ADLIB; break; case MT_C64: - _musicType = MDT_C64; + _sound->_musicType = MDT_C64; break; case MT_APPLEIIGS: - _musicType = MDT_APPLEIIGS; + _sound->_musicType = MDT_APPLEIIGS; break; default: - _musicType = MDT_MIDI; + _sound->_musicType = MDT_MIDI; break; } if ((_game.id == GID_MONKEY_EGA || (_game.id == GID_LOOM && _game.version == 3)) - && (_game.platform == Common::kPlatformPC) && _musicType == MDT_MIDI) { + && (_game.platform == Common::kPlatformPC) && _sound->_musicType == MDT_MIDI) { Common::String fileName; bool missingFile = false; if (_game.id == GID_LOOM) { @@ -1805,7 +1804,7 @@ void ScummEngine::setupMusic(int midi) { "but %s is missing. Using AdLib instead."), fileName.c_str()), _("OK")); dialog.runModal(); - _musicType = MDT_ADLIB; + _sound->_musicType = MDT_ADLIB; } } @@ -1819,9 +1818,9 @@ void ScummEngine::setupMusic(int midi) { * automatically when samples need to be generated */ if (!_mixer->isReady()) { warning("Sound mixer initialization failed"); - if (_musicType == MDT_ADLIB || _musicType == MDT_PCSPK || _musicType == MDT_PCJR || _musicType == MDT_CMS) { + if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR || _sound->_musicType == MDT_CMS) { dev = 0; - _musicType = MDT_NONE; + _sound->_musicType = MDT_NONE; warning("MIDI driver depends on sound mixer, switching to null MIDI driver"); } } @@ -1853,9 +1852,9 @@ void ScummEngine::setupMusic(int midi) { _musicEngine = new Player_V1(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK); } else if (_game.version <= 2) { _musicEngine = new Player_V2(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK); - } else if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR) && (_game.version > 2 && _game.version <= 4)) { + } else if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && (_game.version > 2 && _game.version <= 4)) { _musicEngine = new Player_V2(this, _mixer, MidiDriver::getMusicType(dev) != MT_PCSPK); - } else if (_musicType == MDT_CMS) { + } else if (_sound->_musicType == MDT_CMS) { _musicEngine = new Player_V2CMS(this, _mixer); } else if (_game.platform == Common::kPlatform3DO && _game.heversion <= 62) { // 3DO versions use digital music and sound samples. @@ -1867,15 +1866,15 @@ void ScummEngine::setupMusic(int midi) { MidiDriver *nativeMidiDriver = 0; MidiDriver *adlibMidiDriver = 0; - if (_musicType != MDT_ADLIB && _musicType != MDT_TOWNS && _musicType != MDT_PCSPK) + if (_sound->_musicType != MDT_ADLIB && _sound->_musicType != MDT_TOWNS && _sound->_musicType != MDT_PCSPK) nativeMidiDriver = MidiDriver::createMidi(dev); if (nativeMidiDriver != NULL && _native_mt32) nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); - bool multi_midi = ConfMan.getBool("multi_midi") && _musicType != MDT_NONE && _musicType != MDT_PCSPK && (midi & MDT_ADLIB); - if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS || multi_midi) { - adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_musicType == MDT_TOWNS ? MDT_TOWNS : MDT_ADLIB)); + bool multi_midi = ConfMan.getBool("multi_midi") && _sound->_musicType != MDT_NONE && _sound->_musicType != MDT_PCSPK && (midi & MDT_ADLIB); + if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS || multi_midi) { + adlibMidiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(_sound->_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) { + } else if (_sound->_musicType == MDT_PCSPK) { adlibMidiDriver = new PcSpkDriver(_mixer); } @@ -1905,7 +1904,7 @@ void ScummEngine::setupMusic(int midi) { _imuse->property(IMuse::PROP_LIMIT_PLAYERS, 1); _imuse->property(IMuse::PROP_RECYCLE_PLAYERS, 1); } - if (_musicType == MDT_PCSPK) + if (_sound->_musicType == MDT_PCSPK) _imuse->property(IMuse::PROP_PC_SPEAKER, 1); } } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 4944fbed5a..04a175e732 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -40,8 +40,6 @@ #include "scumm/detection.h" #include "scumm/script.h" -#include "audio/mididrv.h" - #ifdef __DS__ /* This disables the dual layer mode which is used in FM-Towns versions * of SCUMM games and which emulates the behavior of the original code. @@ -1085,7 +1083,6 @@ protected: int _saveSound; bool _native_mt32; bool _enable_gs; - MidiDriverFlags _musicType; bool _copyProtection; public: diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 7fdc710142..823a406a1e 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -84,6 +84,8 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer) memset(_soundQue, 0, sizeof(_soundQue)); memset(_soundQue2, 0, sizeof(_soundQue2)); memset(_mouthSyncTimes, 0, sizeof(_mouthSyncTimes)); + + _musicType = MDT_NONE; } Sound::~Sound() { @@ -1094,7 +1096,7 @@ int ScummEngine::readSoundResource(ResId idx) { switch (basetag) { case MKTAG('M','I','D','I'): case MKTAG('i','M','U','S'): - if (_musicType != MDT_PCSPK && _musicType != MDT_PCJR) { + if (_sound->_musicType != MDT_PCSPK && _sound->_musicType != MDT_PCJR) { _fileHandle->seek(-8, SEEK_CUR); _fileHandle->read(_res->createResource(rtSound, idx, total_size + 8), total_size + 8); return 1; @@ -1118,7 +1120,7 @@ int ScummEngine::readSoundResource(ResId idx) { break; case MKTAG('A','D','L',' '): pri = 1; - if (_musicType == MDT_ADLIB || _musicType == MDT_TOWNS) + if (_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) pri = 10; break; case MKTAG('A','M','I',' '): @@ -1137,7 +1139,7 @@ int ScummEngine::readSoundResource(ResId idx) { break; case MKTAG('S','P','K',' '): pri = -1; - if (_musicType == MDT_PCSPK || _musicType == MDT_PCJR) + if (_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) pri = 11; break; } @@ -1145,7 +1147,7 @@ int ScummEngine::readSoundResource(ResId idx) { // We only allow SPK resources for PC Speaker, PCJr and CMS here // since other resource would sound horribly with their output // drivers. - if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR || _musicType == MDT_CMS) && pri != 11) + if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR || _sound->_musicType == MDT_CMS) && pri != 11) pri = -1; // We only allow ADL resources when AdLib or FM-Towns is used as @@ -1155,7 +1157,7 @@ int ScummEngine::readSoundResource(ResId idx) { // only contains a ROL resource for sound id 60. Formerly we tried // to play that via the AdLib or FM-Towns audio driver resulting // in strange noises. Now we behave like the original did. - if ((_musicType == MDT_ADLIB || _musicType == MDT_TOWNS) && pri != 10) + if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 10) pri = -1; debugC(DEBUG_RESOURCE, " tag: %s, total_size=%d, pri=%d", tag2str(tag), size, pri); @@ -2095,7 +2097,7 @@ int ScummEngine::readSoundResourceSmallHeader(ResId idx) { } } - if ((_musicType == MDT_PCSPK || _musicType == MDT_PCJR) && wa_offs != 0) { + if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && wa_offs != 0) { if (_game.features & GF_OLD_BUNDLE) { _fileHandle->seek(wa_offs, SEEK_SET); _fileHandle->read(_res->createResource(rtSound, idx, wa_size), wa_size); diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h index 03659ceff1..e9a37ac9fa 100644 --- a/engines/scumm/sound.h +++ b/engines/scumm/sound.h @@ -24,6 +24,7 @@ #include "common/scummsys.h" #include "audio/audiostream.h" +#include "audio/mididrv.h" #include "audio/mixer.h" #include "scumm/saveload.h" @@ -90,6 +91,8 @@ public: byte _sfxMode; uint _lastSound; + MidiDriverFlags _musicType; + public: Sound(ScummEngine *parent, Audio::Mixer *mixer); virtual ~Sound(); diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index 4527d7a121..26a6a2f3b1 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -25,9 +25,12 @@ #include "scumm/scumm.h" #include "scumm/scumm_v0.h" #include "scumm/scumm_v8.h" +#include "scumm/sound.h" #include "scumm/he/intern_he.h" #include "scumm/he/logic_he.h" +#include "audio/mididrv.h" + namespace Scumm { void ScummEngine::setupScummVars() { @@ -722,7 +725,7 @@ void ScummEngine::resetScummVars() { // 2 CMS // 3 AdLib // 4 Roland - switch (_musicType) { + switch (_sound->_musicType) { case MDT_NONE: case MDT_PCSPK: VAR(VAR_SOUNDCARD) = 0; |