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
This commit is contained in:
hendricks266 2019-10-24 05:47:24 +00:00 committed by Christoph Oelckers
parent 553dfb3544
commit 7650cbe592
2 changed files with 21 additions and 22 deletions

View file

@ -67,9 +67,10 @@ void S_SoundStartup(void)
initprintf("Initializing sound... "); 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; return;
} }
@ -104,9 +105,10 @@ void S_SoundShutdown(void)
if (MusicVoice >= 0) if (MusicVoice >= 0)
S_MusicShutdown(); 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); G_GameExit(tempbuf);
} }
} }
@ -115,9 +117,10 @@ void S_MusicStartup(void)
{ {
initprintf("Initializing MIDI driver... "); 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; return;
} }
@ -139,8 +142,9 @@ void S_MusicShutdown(void)
{ {
S_StopMusic(); S_StopMusic();
if (MUSIC_Shutdown() != MUSIC_Ok) int status = MUSIC_Shutdown();
initprintf("%s\n", MUSIC_ErrorString(MUSIC_ErrorCode)); if (status != MUSIC_Ok)
initprintf("S_MusicShutdown(): %s\n", MUSIC_ErrorString(status));
} }
void S_PauseMusic(bool paused) void S_PauseMusic(bool paused)

View file

@ -1120,7 +1120,6 @@ LoadSong(const char *filename)
void void
SoundStartup(void) SoundStartup(void)
{ {
int32_t status;
void *initdata = 0; void *initdata = 0;
@ -1131,11 +1130,10 @@ SoundStartup(void)
//snd_enabled = TRUE; //snd_enabled = TRUE;
int status = FX_Init(NumVoices, NumChannels, MixRate, initdata);
status = FX_Init(NumVoices, NumChannels, MixRate, initdata);
if (status != FX_Ok) if (status != FX_Ok)
{ {
buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error)); buildprintf("Sound error: %s\n", FX_ErrorString(status));
return; return;
} }
@ -1157,15 +1155,13 @@ SoundStartup(void)
void void
SoundShutdown(void) SoundShutdown(void)
{ {
int32_t status;
if (!FxInitialized) if (!FxInitialized)
return; return;
status = FX_Shutdown(); int status = FX_Shutdown();
if (status != FX_Ok) 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... "); 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; mus_enabled = FALSE;
return; return;
} }
@ -1232,14 +1229,12 @@ void COVER_SetReverb(int amt)
void void
MusicShutdown(void) MusicShutdown(void)
{ {
int32_t status;
StopSong(); StopSong();
status = MUSIC_Shutdown(); int status = MUSIC_Shutdown();
if (status != MUSIC_Ok) if (status != MUSIC_Ok)
{ {
buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error)); buildprintf("Music error: %s\n", MUSIC_ErrorString(status));
} }
} }