From 7650cbe592d7afe61c93f554aab214a3fda6b88b Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 24 Oct 2019 05:47:24 +0000 Subject: [PATCH] Fix calls to FX_ErrorString and MUSIC_ErrorString git-svn-id: https://svn.eduke32.com/eduke32@8260 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/duke3d/src/sounds.cpp # source/duke3d/src/sounds_mapster32.cpp # source/sw/src/sounds.cpp --- source/duke3d/src/sounds.cpp | 20 ++++++++++++-------- source/sw/src/sounds.cpp | 23 +++++++++-------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index a176c5f81..b3c96ed88 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -67,9 +67,10 @@ void S_SoundStartup(void) initprintf("Initializing sound... "); - if (FX_Init(snd_numvoices, snd_numchannels, snd_mixrate, initdata) != FX_Ok) + int status = FX_Init(ud.config.NumVoices, ud.config.NumChannels, ud.config.MixRate, initdata); + if (status != FX_Ok) { - initprintf("failed! %s\n", FX_ErrorString(FX_Error)); + initprintf("failed! %s\n", FX_ErrorString(status)); return; } @@ -104,9 +105,10 @@ void S_SoundShutdown(void) if (MusicVoice >= 0) S_MusicShutdown(); - if (FX_Shutdown() != FX_Ok) + int status = FX_Shutdown(); + if (status != FX_Ok) { - Bsprintf(tempbuf, "S_SoundShutdown(): error: %s", FX_ErrorString(FX_Error)); + Bsprintf(tempbuf, "S_SoundShutdown(): error: %s", FX_ErrorString(status)); G_GameExit(tempbuf); } } @@ -115,9 +117,10 @@ 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) + int status; + if ((status = MUSIC_Init(ud.config.MusicDevice)) != MUSIC_Ok && (status = MUSIC_Init(0)) != MUSIC_Ok && (status = MUSIC_Init(1)) != MUSIC_Ok) { - initprintf("S_MusicStartup(): failed initializing\n"); + initprintf("S_MusicStartup(): failed initializing: %s\n", MUSIC_ErrorString(status)); return; } @@ -139,8 +142,9 @@ void S_MusicShutdown(void) { S_StopMusic(); - if (MUSIC_Shutdown() != MUSIC_Ok) - initprintf("%s\n", MUSIC_ErrorString(MUSIC_ErrorCode)); + int status = MUSIC_Shutdown(); + if (status != MUSIC_Ok) + initprintf("S_MusicShutdown(): %s\n", MUSIC_ErrorString(status)); } void S_PauseMusic(bool paused) diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index 7c6a5a509..2fa5a0fc7 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -1120,7 +1120,6 @@ LoadSong(const char *filename) void SoundStartup(void) { - int32_t status; void *initdata = 0; @@ -1131,11 +1130,10 @@ SoundStartup(void) //snd_enabled = TRUE; - - status = FX_Init(NumVoices, NumChannels, MixRate, initdata); + int status = FX_Init(NumVoices, NumChannels, MixRate, initdata); if (status != FX_Ok) { - buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error)); + buildprintf("Sound error: %s\n", FX_ErrorString(status)); return; } @@ -1157,15 +1155,13 @@ SoundStartup(void) void SoundShutdown(void) { - int32_t status; - if (!FxInitialized) return; - status = FX_Shutdown(); + int status = FX_Shutdown(); if (status != FX_Ok) { - buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error)); + buildprintf("Sound error: %s\n", FX_ErrorString(status)); } } @@ -1200,9 +1196,10 @@ void MusicStartup(void) buildprintf("Initializing MIDI driver... "); - if (MUSIC_Init(MusicDevice) != MUSIC_Ok && MUSIC_Init(0) != MUSIC_Ok && MUSIC_Init(1) != MUSIC_Ok) + int status; + if ((status = MUSIC_Init(MusicDevice)) != MUSIC_Ok && (status = MUSIC_Init(0)) != MUSIC_Ok && (status = MUSIC_Init(1)) != MUSIC_Ok) { - buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error)); + buildprintf("Music error: %s\n", MUSIC_ErrorString(status)); mus_enabled = FALSE; return; } @@ -1232,14 +1229,12 @@ void COVER_SetReverb(int amt) void MusicShutdown(void) { - int32_t status; - StopSong(); - status = MUSIC_Shutdown(); + int status = MUSIC_Shutdown(); if (status != MUSIC_Ok) { - buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error)); + buildprintf("Music error: %s\n", MUSIC_ErrorString(status)); } }