diff options
author | Willem Jan Palenstijn | 2015-07-22 22:37:40 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-07-22 22:43:42 +0200 |
commit | 6ec9c81b575f13b2c4b30aeac592ebf2557b5890 (patch) | |
tree | 503d50902bad2d800165593039d08d5ccf0c98ab /engines/saga/music.cpp | |
parent | 5ec05f6b647c5ea41418be7ed19ad381f97cabd8 (diff) | |
parent | 4e5c8d35f7e133e2e72a846fdbd54900c91eeb73 (diff) | |
download | scummvm-rg350-6ec9c81b575f13b2c4b30aeac592ebf2557b5890.tar.gz scummvm-rg350-6ec9c81b575f13b2c4b30aeac592ebf2557b5890.tar.bz2 scummvm-rg350-6ec9c81b575f13b2c4b30aeac592ebf2557b5890.zip |
Merge branch 'master' into mm
Conflicts:
engines/access/access.cpp
engines/access/asurface.h
engines/access/bubble_box.cpp
engines/access/bubble_box.h
engines/access/martian/martian_game.cpp
engines/access/player.cpp
engines/access/player.h
engines/access/resources.cpp
engines/access/screen.cpp
engines/access/screen.h
engines/access/sound.cpp
engines/access/sound.h
Diffstat (limited to 'engines/saga/music.cpp')
-rw-r--r-- | engines/saga/music.cpp | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index d20882ca26..663f5991d0 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -31,6 +31,7 @@ #include "audio/mididrv.h" #include "audio/midiparser.h" #include "audio/midiparser_qt.h" +#include "audio/miles.h" #include "audio/decoders/raw.h" #include "common/config-manager.h" #include "common/file.h" @@ -42,24 +43,51 @@ namespace Saga { #define MUSIC_SUNSPOT 26 MusicDriver::MusicDriver() : _isGM(false) { - - MidiPlayer::createDriver(); - MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); _driverType = MidiDriver::getMusicType(dev); + switch (_driverType) { + case MT_ADLIB: + if (Common::File::exists("INSTR.AD") && Common::File::exists("INSTR.OPL")) { + _milesAudioMode = true; + _driver = Audio::MidiDriver_Miles_AdLib_create("INSTR.AD", "INSTR.OPL"); + } else if (Common::File::exists("SAMPLE.AD") && Common::File::exists("SAMPLE.OPL")) { + _milesAudioMode = true; + _driver = Audio::MidiDriver_Miles_AdLib_create("SAMPLE.AD", "SAMPLE.OPL"); + } else { + _milesAudioMode = false; + MidiPlayer::createDriver(); + } + break; + case MT_MT32: + _milesAudioMode = true; + _driver = Audio::MidiDriver_Miles_MT32_create(""); + break; + default: + _milesAudioMode = false; + MidiPlayer::createDriver(); + break; + } + int retValue = _driver->open(); if (retValue == 0) { - if (_nativeMT32) - _driver->sendMT32Reset(); - else - _driver->sendGMReset(); + if (_driverType != MT_ADLIB) { + if (_driverType == MT_MT32 || _nativeMT32) + _driver->sendMT32Reset(); + else + _driver->sendGMReset(); + } _driver->setTimerCallback(this, &timerCallback); } } void MusicDriver::send(uint32 b) { + if (_milesAudioMode) { + _driver->send(b); + return; + } + if ((b & 0xF0) == 0xC0 && !_isGM && !_nativeMT32) { // Remap MT32 instruments to General Midi b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8; @@ -249,7 +277,11 @@ void Music::play(uint32 resourceId, MusicFlags flags) { debug(2, "Music::play %d, %d", resourceId, flags); - if (isPlaying() && _trackNumber == resourceId) { + if (isPlaying() && _trackNumber == resourceId) + return; + + if (_vm->getFeatures() & GF_ITE_DOS_DEMO) { + warning("TODO: Music::play %d, %d for ITE DOS demo", resourceId, flags); return; } |