ref: 467fe8ec6d47977438ebe664d8752dd3748111de
parent: a5b01f3b6a0c3ec22d9b23b60923e9d2d73a54b5
author: Michael Day <[email protected]>
date: Tue Jun 28 12:08:05 EDT 2022
Consider soundfonts set via the environment
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -186,7 +186,6 @@
static boolean I_SDL_InitMusic(void)
{
boolean fluidsynth_sf_is_set = false;
- boolean fluidsynth_requested;
// If SDL_mixer is not initialized, we have to initialize it
// and have the responsibility to shut it down later on.
@@ -221,10 +220,7 @@
// Mix_Init() in order for FluidSynth to be registered as a valid decoder
// in the Mix_GetMusicDecoder() list.
- fluidsynth_requested =
- ((strlen(fluidsynth_sf_path) > 0) && (strlen(timidity_cfg_path) == 0));
-
- if (fluidsynth_requested)
+ if ((strlen(fluidsynth_sf_path) > 0) && (strlen(timidity_cfg_path) == 0))
{
if (M_FileExists(fluidsynth_sf_path))
{
@@ -234,7 +230,6 @@
{
fprintf(stderr,
"I_SDL_InitMusic: Can't find FluidSynth soundfont.\n");
- fluidsynth_requested = false;
}
}
@@ -246,8 +241,9 @@
RemoveTimidityConfig();
- // Confirm that FluidSynth is actually available.
- if (fluidsynth_requested)
+ // If a soundfont has been set (either here on in the environment),
+ // confirm that FluidSynth is actually available before trying to use it.
+ if ((Mix_GetSoundFonts() != NULL) && (strlen(timidity_cfg_path) == 0))
{
int total;