diff options
author | Martin Kiewitz | 2015-07-01 01:30:12 +0200 |
---|---|---|
committer | Martin Kiewitz | 2015-07-01 01:30:12 +0200 |
commit | b6cf04bb0e4e511ffa795ee1cb8a11c70169500d (patch) | |
tree | 20878df175b60e763ec9be8869f1cc02ff03e895 /engines | |
parent | 3bb36663f3d8c8a5220afc5afe7d64005cc01794 (diff) | |
download | scummvm-rg350-b6cf04bb0e4e511ffa795ee1cb8a11c70169500d.tar.gz scummvm-rg350-b6cf04bb0e4e511ffa795ee1cb8a11c70169500d.tar.bz2 scummvm-rg350-b6cf04bb0e4e511ffa795ee1cb8a11c70169500d.zip |
AMAZON: implement proper AdLib support (Miles)
implement proper AdLib support
game uses MIDPAK, which seems to be basically Miles Audio too
instrument data was hidden inside MIDIDRV.AP
thanks to dreammaster for extracting the files
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/sound.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp index da267bdc4c..89fd4fe66e 100644 --- a/engines/access/sound.cpp +++ b/engines/access/sound.cpp @@ -21,9 +21,12 @@ */ #include "common/algorithm.h" +#include "common/config-manager.h" #include "audio/mixer.h" #include "audio/decoders/raw.h" #include "audio/decoders/wave.h" +// Miles Audio +#include "audio/miles.h" #include "access/access.h" #include "access/sound.h" @@ -194,9 +197,41 @@ MusicManager::MusicManager(AccessEngine *vm) : _vm(vm) { _music = nullptr; _tempMusic = nullptr; _isLooping = false; + _driver = nullptr; + MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32); + MusicType musicType = MidiDriver::getMusicType(dev); + + // Amazon Guardians of Eden uses MIDPAK inside MIDIDRV.AP + // Amazon Guardians of Eden possibly used MIDPAK as well + // AdLib patches are inside MIDIDRV.AP too, 2nd resource file + switch (musicType) { + case MT_ADLIB: { + Resource *midiDrvResource = _vm->_files->loadFile(92, 1); + const byte *adLibInstrumentData = midiDrvResource->data(); + uint32 adLibInstrumentDataSize = midiDrvResource->_size; + + _driver = Audio::MidiDriver_Miles_AdLib_create("", "", adLibInstrumentData, adLibInstrumentDataSize); + + delete midiDrvResource; + break; + } + case MT_MT32: + _driver = Audio::MidiDriver_Miles_MT32_create(""); + _nativeMT32 = true; + break; + case MT_GM: + if (ConfMan.getBool("native_mt32")) { + _driver = Audio::MidiDriver_Miles_MT32_create(""); + _nativeMT32 = true; + } + break; + } + +#if 0 MidiPlayer::createDriver(); MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); +#endif int retValue = _driver->open(); if (retValue == 0) { @@ -215,11 +250,15 @@ MusicManager::~MusicManager() { } void MusicManager::send(uint32 b) { + // Pass data directly to driver + _driver->send(b); +#if 0 if ((b & 0xF0) == 0xC0 && !_nativeMT32) { b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8; } Audio::MidiPlayer::send(b); +#endif } void MusicManager::midiPlay() { |