diff options
-rw-r--r-- | saga/music.cpp | 5 | ||||
-rw-r--r-- | saga/music.h | 3 | ||||
-rw-r--r-- | saga/saga.cpp | 26 |
3 files changed, 23 insertions, 11 deletions
diff --git a/saga/music.cpp b/saga/music.cpp index c839717f46..463dc79919 100644 --- a/saga/music.cpp +++ b/saga/music.cpp @@ -230,6 +230,11 @@ void MusicPlayer::close() { } void MusicPlayer::send(uint32 b) { + if (_passThrough) { + _driver->send(b); + return; + } + byte channel = (byte)(b & 0x0F); if ((b & 0xFFF0) == 0x07B0) { // Adjust volume changes by master volume diff --git a/saga/music.h b/saga/music.h index e5ba862667..e7b0cd1783 100644 --- a/saga/music.h +++ b/saga/music.h @@ -59,6 +59,7 @@ public: void playMusic(); void stopMusic(); void setLoop(bool loop) { _looping = loop; } + void setPassThrough(bool b) { _passThrough = b; } void setGM(bool isGM) { _isGM = isGM; } @@ -87,6 +88,7 @@ protected: byte _channelVolume[16]; bool _nativeMT32; bool _isGM; + bool _passThrough; bool _isPlaying; bool _looping; @@ -104,6 +106,7 @@ public: Music(SoundMixer *mixer, MidiDriver *driver, int enabled); ~Music(void); void hasNativeMT32(bool b) { _player->hasNativeMT32(b); } + void setPassThrough(bool b) { _player->setPassThrough(b); } int play(uint32 music_rn, uint16 flags = R_MUSIC_DEFAULT); int pause(void); diff --git a/saga/saga.cpp b/saga/saga.cpp index 057762ca43..e25c8dd1d5 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -161,27 +161,31 @@ void SagaEngine::go() { _previousTicks = _system->getMillis(); - // On some platforms, graphics initialization also initializes sound - // ( Win32 DirectX )... Music must be initialized before sound for - // native midi support - MidiDriver *driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE)); + // Initialize graphics + R_GAME_DISPLAYINFO disp_info; + GAME_GetDisplayInfo(&disp_info); + _gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h); + + // Graphics should be initialized before music + int midiDriver = GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE); + bool native_mt32 = (ConfMan.getBool("native_mt32") || (midiDriver == MD_MT32)); + + MidiDriver *driver = GameDetector::createMidi(midiDriver); if (!driver) driver = MidiDriver_ADLIB_create(_mixer); - else if (ConfMan.getBool("native_mt32")) + else if (native_mt32) driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); _music = new Music(_mixer, driver, _musicEnabled); - _music->hasNativeMT32(ConfMan.getBool("native_mt32")); + _music->hasNativeMT32(native_mt32); + + if (midiDriver == MD_MT32) + _music->setPassThrough(true); if (!_musicEnabled) { debug(0, "Music disabled."); } - // Initialize graphics - R_GAME_DISPLAYINFO disp_info; - GAME_GetDisplayInfo(&disp_info); - _gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h); - _isoMap = new IsoMap(_gfx); _render = new Render(this, _system); |