mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Prefer early return on error in sound and MIDI init functions
git-svn-id: https://svn.eduke32.com/eduke32@8259 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:
parent
14996d930b
commit
553dfb3544
2 changed files with 17 additions and 21 deletions
|
@ -115,10 +115,13 @@ 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)
|
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);
|
auto const fil = kopen4load("d3dtimbr.tmb", 0);
|
||||||
|
|
||||||
if (fil != buildvfs_kfd_invalid)
|
if (fil != buildvfs_kfd_invalid)
|
||||||
|
@ -130,11 +133,6 @@ void S_MusicStartup(void)
|
||||||
Xfree(tmb);
|
Xfree(tmb);
|
||||||
kclose(fil);
|
kclose(fil);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
initprintf("S_MusicStartup(): failed initializing\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_MusicShutdown(void)
|
void S_MusicShutdown(void)
|
||||||
|
|
|
@ -1133,17 +1133,16 @@ SoundStartup(void)
|
||||||
|
|
||||||
|
|
||||||
status = FX_Init(NumVoices, NumChannels, MixRate, initdata);
|
status = FX_Init(NumVoices, NumChannels, MixRate, initdata);
|
||||||
if (status == FX_Ok)
|
|
||||||
{
|
|
||||||
FxInitialized = TRUE;
|
|
||||||
snd_fxvolume.Callback();
|
|
||||||
snd_reversestereo.Callback();
|
|
||||||
}
|
|
||||||
if (status != FX_Ok)
|
if (status != FX_Ok)
|
||||||
{
|
{
|
||||||
buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error));
|
buildprintf("Sound error: %s\n",FX_ErrorString(FX_Error));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FxInitialized = TRUE;
|
||||||
|
snd_fxvolume.Callback();
|
||||||
|
snd_reversestereo.Callback();
|
||||||
|
|
||||||
FX_SetCallBack(SoundCallBack);
|
FX_SetCallBack(SoundCallBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,17 +1200,16 @@ 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)
|
if (MUSIC_Init(MusicDevice) != MUSIC_Ok && MUSIC_Init(0) != MUSIC_Ok && MUSIC_Init(1) != MUSIC_Ok)
|
||||||
{
|
{
|
||||||
MusicInitialized = TRUE;
|
buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error));
|
||||||
MUSIC_SetVolume(mus_volume);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_ErrorCode));
|
|
||||||
mus_enabled = FALSE;
|
mus_enabled = FALSE;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MusicInitialized = TRUE;
|
||||||
|
MUSIC_SetVolume(gs.MusicVolume);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (MusicInitialized)
|
if (MusicInitialized)
|
||||||
loadtmb();
|
loadtmb();
|
||||||
|
@ -1241,7 +1239,7 @@ MusicShutdown(void)
|
||||||
status = MUSIC_Shutdown();
|
status = MUSIC_Shutdown();
|
||||||
if (status != MUSIC_Ok)
|
if (status != MUSIC_Ok)
|
||||||
{
|
{
|
||||||
buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_ErrorCode));
|
buildprintf("Music error: %s\n",MUSIC_ErrorString(MUSIC_Error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue