From 5a1e994d02c9e47ba15f327248f410d88a90d841 Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Sat, 17 May 2003 03:06:16 +0000 Subject: Added command line options for native MT-32 support and combination Adilb/native MIDI drivers. svn-id: r7594 --- scumm/imuse.cpp | 18 ++++++++++-------- scumm/imuse.h | 4 +++- scumm/instrument.cpp | 16 ++++++++++------ scumm/instrument.h | 1 + scumm/scummvm.cpp | 2 ++ 5 files changed, 26 insertions(+), 15 deletions(-) (limited to 'scumm') diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 83b434cc56..4b57e3e7a1 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -31,10 +31,6 @@ // the most common iMuse diagnostic messages. // #define IMUSE_DEBUG -// Unremark this statement to support simultaneous -// use of Adlib and native MIDI drivers. -// #define ADLIB_TOO - // // Some constants // @@ -290,6 +286,7 @@ class IMuseInternal { friend struct Player; private: + bool _enable_multi_midi; MidiDriver *_midi_adlib; MidiDriver *_midi_native; @@ -631,10 +628,7 @@ MidiDriver *IMuseInternal::getBestMidiDriver (int sound) { } #if !defined(__PALM_OS__) // Adlib not supported on PalmOS } else { - if (!_midi_adlib) { -#if !defined(ADLIB_TOO) - if (_midi_native) return NULL; -#endif + if (!_midi_adlib && (_enable_multi_midi || !_midi_native)) { _midi_adlib = MidiDriver_ADLIB_create(); initMidiDriver (_midi_adlib); } @@ -1652,6 +1646,14 @@ uint32 IMuseInternal::property(int prop, uint32 value) { if (value >= 50 && value <= 200) _tempoFactor = value; break; + + case IMuse::PROP_NATIVE_MT32: + Instrument::nativeMT32 (value > 0); + break; + + case IMuse::PROP_MULTI_MIDI: + _enable_multi_midi = (value > 0); + break; } return 0; } diff --git a/scumm/imuse.h b/scumm/imuse.h index 7f6bc12f52..5006d50f33 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -44,7 +44,9 @@ public: ~IMuse(); enum { - PROP_TEMPO_BASE = 1 + PROP_TEMPO_BASE = 1, + PROP_NATIVE_MT32 = 2, + PROP_MULTI_MIDI = 3 }; void on_timer (MidiDriver *midi); diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp index 8ea8e8474d..266165f770 100644 --- a/scumm/instrument.cpp +++ b/scumm/instrument.cpp @@ -25,7 +25,7 @@ #include "scumm/instrument.h" #include "sound/mididrv.h" -#define NATIVE_MT32 false +static bool _native_mt32 = false; static const byte mt32_to_gm[128] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F @@ -239,7 +239,7 @@ public: void saveOrLoad (Serializer *s); void send (MidiChannel *mc); void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); } - bool is_valid() { return (NATIVE_MT32 ? true : (_instrument_name[0] != '\0')); } + bool is_valid() { return (_native_mt32 ? true : (_instrument_name[0] != '\0')); } }; //////////////////////////////////////// @@ -248,6 +248,10 @@ public: // //////////////////////////////////////// +void Instrument::nativeMT32 (bool native) { + _native_mt32 = native; +} + void Instrument::clear() { if (_instrument) delete _instrument; @@ -339,7 +343,7 @@ void Instrument_Program::send (MidiChannel *mc) { if (_program > 127) return; - if (NATIVE_MT32) // if (mc->device()->mt32device()) + if (_native_mt32) // if (mc->device()->mt32device()) mc->programChange (_mt32 ? _program : _program /*gm_to_mt32 [_program]*/); else mc->programChange (_mt32 ? mt32_to_gm [_program] : _program); @@ -383,7 +387,7 @@ Instrument_Roland::Instrument_Roland (byte *data) { memcpy (&_instrument, data, sizeof (_instrument)); memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name)); _instrument_name[10] = '\0'; - if (!NATIVE_MT32 && getEquivalentGM() >= 128) { + if (!_native_mt32 && getEquivalentGM() >= 128) { warning ("MT-32 instrument \"%s\" not supported yet", _instrument_name); _instrument_name[0] = '\0'; } @@ -404,7 +408,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s) { s->loadBytes (&_instrument, sizeof (_instrument)); memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name)); _instrument_name[10] = '\0'; - if (!NATIVE_MT32 && getEquivalentGM() >= 128) { + if (!_native_mt32 && getEquivalentGM() >= 128) { debug (2, "MT-32 custom instrument \"%s\" not supported", _instrument_name); _instrument_name[0] = '\0'; } @@ -412,7 +416,7 @@ void Instrument_Roland::saveOrLoad (Serializer *s) { } void Instrument_Roland::send (MidiChannel *mc) { - if (NATIVE_MT32) { // if (mc->device()->mt32device()) { + if (_native_mt32) { // if (mc->device()->mt32device()) { _instrument.device_id = mc->getNumber(); mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument)); } else { diff --git a/scumm/instrument.h b/scumm/instrument.h index c9dea601be..84b45771d7 100644 --- a/scumm/instrument.h +++ b/scumm/instrument.h @@ -52,6 +52,7 @@ public: }; Instrument() : _type (0), _instrument (0) { } + static void nativeMT32 (bool native); void clear(); void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); } diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 2de0097222..465fb1c612 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -604,6 +604,8 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) if (_imuse) { if (detector->_gameTempo != 0) _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); + _imuse->property (IMuse::PROP_MULTI_MIDI, detector->_multi_midi); + _imuse->property (IMuse::PROP_NATIVE_MT32, detector->_native_mt32); _imuse->set_music_volume(_sound->_sound_volume_music); } } -- cgit v1.2.3