diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 84faa1298..b427070d8 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "common_game.h" #include "build.h" #include "cache1d.h" +#include "sndcards.h" #include "hash.h" #include "scriplib.h" #include "renderlayer.h" diff --git a/source/blood/src/menu.cpp b/source/blood/src/menu.cpp index 6ef3e0df3..b8357f143 100644 --- a/source/blood/src/menu.cpp +++ b/source/blood/src/menu.cpp @@ -573,9 +573,18 @@ int nSoundRateValues[] = { 48000 }; +int nMusicDeviceValues[] = { + ASS_OPL3, +#ifdef _WIN32 + ASS_WinMM, +#endif +}; + const char *pzMusicDeviceStrings[] = { + "OPL3(SB/ADLIB)", +#ifdef _WIN32 "SYSTEM MIDI", - "OPL3(SB/ADLIB)" +#endif }; CGameMenuItemTitle itemOptionsSoundTitle("SOUND SETUP", 1, 160, 20, 2038); @@ -1826,7 +1835,7 @@ void SetSound(CGameMenuItemChain *pItem) UNREFERENCED_PARAMETER(pItem); snd_mixrate = nSoundRateValues[itemOptionsSoundSampleRate.m_nFocus]; snd_numvoices = itemOptionsSoundNumVoices.nValue; - //MusicDevice = itemOptionsSoundMusicDevice.m_nFocus; + MusicDevice = nMusicDeviceValues[itemOptionsSoundMusicDevice.m_nFocus]; sfxTerm(); sndTerm(); @@ -1859,7 +1868,15 @@ void SetupOptionsSound(CGameMenuItemChain *pItem) } } itemOptionsSoundNumVoices.nValue = snd_numvoices; - itemOptionsSoundMusicDevice.m_nFocus = 1;// MusicDevice; + itemOptionsSoundMusicDevice.m_nFocus = 0; + for (int i = 0; i < 2; i++) + { + if (nMusicDeviceValues[i] == MusicDevice) + { + itemOptionsSoundMusicDevice.m_nFocus = i; + break; + } + } } void UpdatePlayerName(CGameMenuItemZEdit *pItem, CGameMenuEvent *pEvent) diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index fcbb9bfee..8c8121745 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "osd.h" #include "compat.h" #include "mmulti.h" +#include "sndcards.h" #include "common_game.h" #include "config.h" #include "blood.h" diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index ab8349956..d5f05875c 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -437,8 +437,13 @@ void DeinitSoundDevice(void) void InitMusicDevice(void) { - int nStatus = MUSIC_Init(MusicDevice); - if (nStatus != 0) + int nStatus; + if ((nStatus = MUSIC_Init(MusicDevice)) == MUSIC_Ok) + { + if (MusicDevice == ASS_AutoDetect) + MusicDevice = MIDI_GetDevice(); + } + else if ((nStatus = MUSIC_Init(ASS_AutoDetect)) == MUSIC_Ok) { initprintf("InitMusicDevice: %s\n", MUSIC_ErrorString(nStatus)); return;