diff options
Diffstat (limited to 'engines/groovie')
-rw-r--r-- | engines/groovie/music.cpp | 57 | ||||
-rw-r--r-- | engines/groovie/music.h | 2 |
2 files changed, 56 insertions, 3 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 2c164e020c..c00290b155 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -36,6 +36,7 @@ #include "common/textconsole.h" #include "audio/audiostream.h" #include "audio/midiparser.h" +#include "audio/miles.h" namespace Groovie { @@ -379,14 +380,56 @@ bool MusicPlayerMidi::loadParser(Common::SeekableReadStream *stream, bool loop) MusicPlayerXMI::MusicPlayerXMI(GroovieEngine *vm, const Common::String >lName) : MusicPlayerMidi(vm) { - // Create the parser - _midiParser = MidiParser::createParser_XMIDI(); // Create the driver MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); - _driver = MidiDriver::createMidi(dev); + MusicType musicType = MidiDriver::getMusicType(dev); + _driver = NULL; + + // new Miles Audio support, to disable set milesAudioEnabled to false + _milesAudioMode = false; + bool milesAudioEnabled = true; + MidiParser::XMidiNewTimbreListProc newTimbreListProc = NULL; + + if (milesAudioEnabled) { + // 7th Guest uses FAT.AD/FAT.OPL/FAT.MT + // 11th Hour uses SAMPLE.AD/SAMPLE.OPL/SAMPLE.MT + switch (musicType) { + case MT_ADLIB: + _driver = Audio::MidiDriver_Miles_AdLib_create(gtlName + ".AD", gtlName + ".OPL"); + break; + case MT_MT32: + _driver = Audio::MidiDriver_Miles_MT32_create(gtlName + ".MT"); + break; + case MT_GM: + if (ConfMan.getBool("native_mt32")) { + _driver = Audio::MidiDriver_Miles_MT32_create(gtlName + ".MT"); + musicType = MT_MT32; + } + break; + default: + break; + } + + if (musicType == MT_MT32) { + newTimbreListProc = Audio::MidiDriver_Miles_MT32_processXMIDITimbreChunk; + } + } + + if (_driver) { + _milesAudioMode = true; + } + + if (!_driver) { + // No driver yet? create a generic one + _driver = MidiDriver::createMidi(dev); + } + assert(_driver); + // Create the parser + _midiParser = MidiParser::createParser_XMIDI(NULL, NULL, newTimbreListProc, _driver); + _driver->open(); // TODO: Handle return value != 0 (indicating an error) // Set the parser's driver @@ -400,6 +443,9 @@ MusicPlayerXMI::MusicPlayerXMI(GroovieEngine *vm, const Common::String >lName) _chanBanks[i] = 0; } + if (_milesAudioMode) + return; + // Load the Global Timbre Library if (MidiDriver::getMusicType(dev) == MT_ADLIB) { // MIDI through AdLib @@ -433,6 +479,11 @@ MusicPlayerXMI::~MusicPlayerXMI() { } void MusicPlayerXMI::send(uint32 b) { + if (_milesAudioMode) { + MusicPlayerMidi::send(b); + return; + } + if ((b & 0xFFF0) == 0x72B0) { // XMIDI Patch Bank Select 114 // From AIL2's documentation: XMIDI Patch Bank Select controller (114) // selects a bank to be used when searching the next patches diff --git a/engines/groovie/music.h b/engines/groovie/music.h index 4853840673..dcb91d42a8 100644 --- a/engines/groovie/music.h +++ b/engines/groovie/music.h @@ -134,6 +134,8 @@ private: // Output music type uint8 _musicType; + bool _milesAudioMode; + // Timbres class Timbre { public: |