diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index ef75f2b3b..a176c5f81 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -115,10 +115,13 @@ void S_MusicStartup(void) { initprintf("Initializing MIDI driver... "); - if (MUSIC_Init(ud.config.MusicDevice) == MUSIC_Ok || MUSIC_Init(0) == MUSIC_Ok || MUSIC_Init(1) == MUSIC_Ok) + if (MUSIC_Init(ud.config.MusicDevice) != MUSIC_Ok && MUSIC_Init(0) != MUSIC_Ok && MUSIC_Init(1) != MUSIC_Ok) { - MUSIC_SetVolume(mus_volume); + initprintf("S_MusicStartup(): failed initializing\n"); + return; + } + MUSIC_SetVolume(mus_volume); auto const fil = kopen4load("d3dtimbr.tmb", 0); if (fil != buildvfs_kfd_invalid) @@ -130,11 +133,6 @@ void S_MusicStartup(void) Xfree(tmb); kclose(fil); } - - return; - } - - initprintf("S_MusicStartup(): failed initializing\n"); } void S_MusicShutdown(void) diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index c22406f71..7c6a5a509 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -1133,17 +1133,16 @@ SoundStartup(void) status = FX_Init(NumVoices, NumChannels, MixRate, initdata); - if (status == FX_Ok) - { - FxInitialized = TRUE; - snd_fxvolume.Callback(); - snd_reversestereo.Callback(); - } if (status != FX_Ok) { buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error)); + return; } + FxInitialized = TRUE; + snd_fxvolume.Callback(); + snd_reversestereo.Callback(); + FX_SetCallBack(SoundCallBack); } @@ -1201,17 +1200,16 @@ void MusicStartup(void) buildprintf("Initializing MIDI driver... "); - if (MUSIC_Init(MusicDevice) == MUSIC_Ok || MUSIC_Init(0) == MUSIC_Ok || MUSIC_Init(1) == MUSIC_Ok) + if (MUSIC_Init(MusicDevice) != MUSIC_Ok && MUSIC_Init(0) != MUSIC_Ok && MUSIC_Init(1) != MUSIC_Ok) { - MusicInitialized = TRUE; - MUSIC_SetVolume(mus_volume); - } - else - { - buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_ErrorCode)); + buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error)); mus_enabled = FALSE; + return; } + MusicInitialized = TRUE; + MUSIC_SetVolume(gs.MusicVolume); + #if 0 if (MusicInitialized) loadtmb(); @@ -1241,7 +1239,7 @@ MusicShutdown(void) status = MUSIC_Shutdown(); if (status != MUSIC_Ok) { - buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_ErrorCode)); + buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error)); } }