diff options
-rw-r--r-- | simon/midi.cpp | 6 | ||||
-rw-r--r-- | simon/midi.h | 2 | ||||
-rw-r--r-- | simon/simon.cpp | 20 | ||||
-rw-r--r-- | simon/simon.h | 1 |
4 files changed, 22 insertions, 7 deletions
diff --git a/simon/midi.cpp b/simon/midi.cpp index 10b4ae7312..d812ee0099 100644 --- a/simon/midi.cpp +++ b/simon/midi.cpp @@ -59,6 +59,7 @@ MidiPlayer::MidiPlayer(OSystem *system) { _mutex = system->createMutex(); _driver = 0; _map_mt32_to_gm = false; + _passThrough = false; _enable_sfx = true; _current = 0; @@ -106,6 +107,11 @@ void MidiPlayer::send(uint32 b) { if (!_current) return; + if (_passThrough) { + _driver->send(b); + return; + } + byte channel = (byte) (b & 0x0F); if ((b & 0xFFF0) == 0x07B0) { // Adjust volume changes by master volume. diff --git a/simon/midi.h b/simon/midi.h index 81bf9bddc7..0181271b26 100644 --- a/simon/midi.h +++ b/simon/midi.h @@ -55,6 +55,7 @@ protected: OSystem::MutexRef _mutex; MidiDriver *_driver; bool _map_mt32_to_gm; + bool _passThrough; MusicInfo _music; MusicInfo _sfx; @@ -108,6 +109,7 @@ public: void send(uint32 b); void metaEvent (byte type, byte *data, uint16 length); + void setPassThrough(bool b) { _passThrough = b; } // Timing functions - MidiDriver now operates timers void setTimerCallback (void *timer_param, void (*timer_proc) (void *)) { } diff --git a/simon/simon.cpp b/simon/simon.cpp index 488e838f95..8e3a905501 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -675,18 +675,26 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) "Features of the game that depend on sound synchronization will most likely break"); set_volume(ConfMan.getInt("sfx_volume")); + _system->initSize(320, 200); + // Setup midi driver MidiDriver *driver = 0; + _midiDriver = MD_NULL; if (_game == GAME_SIMON1AMIGA || _game == GAME_SIMON1CD32) driver = GameDetector::createMidi(MD_NULL); // Create fake MIDI driver for Simon1Amiga and Simon2CD32 for now - else - driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_ADLIB | MDT_NATIVE)); + else { + _midiDriver = GameDetector::detectMusicDriver(MDT_ADLIB | MDT_NATIVE); + driver = GameDetector::createMidi(_midiDriver); + } if (!driver) driver = MidiDriver_ADLIB_create(_mixer); - else if (ConfMan.getBool("native_mt32")) + else if (ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32)) driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); - midi.mapMT32toGM (!(_game & GF_SIMON2) && !ConfMan.getBool("native_mt32")); + midi.mapMT32toGM (!(_game & GF_SIMON2) && !(ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32))); + if (_midiDriver == MD_MT32) + midi.setPassThrough(true); + midi.set_driver(driver); int ret = midi.open(); if (ret) @@ -717,8 +725,6 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) if (ConfMan.hasKey("slow_down") && ConfMan.getInt("slow_down") >= 1) _speed = ConfMan.getInt("slow_down"); - _system->initSize(320, 200); - // FIXME Use auto dirty rects cleanup code to reduce CPU usage g_system->setFeatureState(OSystem::kFeatureAutoComputeDirtyRects, true); } @@ -5119,7 +5125,7 @@ void SimonEngine::loadMusic (uint music) { if (_game & GF_SIMON2) { // Simon 2 music midi.stop(); _game_file->seek(_game_offsets_ptr[MUSIC_INDEX_BASE + music - 1], SEEK_SET); - if (_game & GF_WIN && !ConfMan.getBool("native_mt32")) { + if (_game & GF_WIN && !(ConfMan.getBool("native_mt32") || (_midiDriver == MD_MT32))) { midi.loadMultipleSMF (_game_file); } else { midi.loadXMIDI (_game_file); diff --git a/simon/simon.h b/simon/simon.h index e3505f2666..f2cc99910a 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -337,6 +337,7 @@ protected: byte _letters_to_print_buf[80]; MidiPlayer midi; + int _midiDriver; int _num_screen_updates; int _vga_tick_counter; |