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... ");
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)

View file

@ -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));
}
}