diff options
author | Torbjörn Andersson | 2015-06-28 16:02:52 +0200 |
---|---|---|
committer | Torbjörn Andersson | 2015-06-28 16:08:49 +0200 |
commit | a1929c688717beaf3babb73f309b8f32db49f919 (patch) | |
tree | 0590b0a6edc8db4b8b57d0404367a12e58090012 | |
parent | 60903c29083b17441dec000669d11c69c6553e6c (diff) | |
download | scummvm-rg350-a1929c688717beaf3babb73f309b8f32db49f919.tar.gz scummvm-rg350-a1929c688717beaf3babb73f309b8f32db49f919.tar.bz2 scummvm-rg350-a1929c688717beaf3babb73f309b8f32db49f919.zip |
SAGA: Use the new "Miles" drivers for AdLib and MT-32
Note that this breaks the IHNM demo, as provided on the ScummVM web
page, since it doesn't have the sample.ad and sample.opl files
needed, but I have a feeling that this is a packaging error on
our part.
I don't have the original release of ITE, so I can't test that.
-rw-r--r-- | engines/saga/music.cpp | 34 | ||||
-rw-r--r-- | engines/saga/music.h | 1 |
2 files changed, 28 insertions, 7 deletions
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index d20882ca26..bc583ed7b0 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,43 @@ 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: + _milesAudioMode = true; + _driver = Audio::MidiDriver_Miles_AdLib_create("SAMPLE.AD", "SAMPLE.OPL"); + 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; diff --git a/engines/saga/music.h b/engines/saga/music.h index 2106fb6fa6..c6664f76ee 100644 --- a/engines/saga/music.h +++ b/engines/saga/music.h @@ -61,6 +61,7 @@ public: protected: MusicType _driverType; bool _isGM; + bool _milesAudioMode; }; class Music { |