shithub: choc

Download patch

ref: ed96b0d9a3161421ca4c319e761be8c1afc7bbb8
parent: 060c171d6922ca20da503131ae74f4688954e044
author: Roman Fomin <rfomin@gmail.com>
date: Fri Nov 12 19:19:17 EST 2021

Fix Fluidsynth support for Windows

--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -185,6 +185,7 @@
 // Initialize music subsystem
 static boolean I_SDL_InitMusic(void)
 {
+    boolean fluidsynth_sf_is_set = false;
     // If SDL_mixer is not initialized, we have to initialize it
     // and have the responsibility to shut it down later on.
 
@@ -226,7 +227,15 @@
 
     if (strlen(fluidsynth_sf_path) > 0 && strlen(timidity_cfg_path) == 0)
     {
-        Mix_SetSoundFonts(fluidsynth_sf_path);
+        if (!M_FileExists(fluidsynth_sf_path))
+        {
+            fprintf(stderr, "Can't find Fluidsynth soundfont.\n");
+        }
+        else
+        {
+            Mix_SetSoundFonts(fluidsynth_sf_path);
+            fluidsynth_sf_is_set = true;
+        }
     }
 
     // If snd_musiccmd is set, we need to call Mix_SetMusicCMD to
@@ -238,8 +247,9 @@
     }
 
 #if defined(_WIN32)
-    // Don't enable it for GUS, since it handles its own volume just fine.
-    if (snd_musicdevice != SNDDEVICE_GUS)
+    // Don't enable it for GUS or Fluidsynth, since they handle their own volume
+    // just fine.
+    if (snd_musicdevice != SNDDEVICE_GUS && !fluidsynth_sf_is_set)
     {
         win_midi_stream_opened = I_WIN_InitMusic();
     }