shithub: choc

Download patch

ref: b64e421ccf21b0d187cc94bc42c605ae32aac1c7
parent: ffeb096167f496a66e4288e8abd07ba621c55250
parent: 74aa9078ec06b207ac7b41078f7d2cceb9b385f4
author: Fabian Greffrath <fabian@greffrath.com>
date: Sun Nov 14 07:53:16 EST 2021

Merge pull request #1404 from rfomin/fix_fluidsynth

Fix Fluidsynth support for Windows

--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -185,6 +185,8 @@
 // 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,6 +228,18 @@
 
     if (strlen(fluidsynth_sf_path) > 0 && strlen(timidity_cfg_path) == 0)
     {
+        if (M_FileExists(fluidsynth_sf_path))
+        {
+            fluidsynth_sf_is_set = true;
+        }
+        else
+        {
+            fprintf(stderr, "Can't find Fluidsynth soundfont.\n");
+        }
+    }
+
+    if (fluidsynth_sf_is_set)
+    {
         Mix_SetSoundFonts(fluidsynth_sf_path);
     }
 
@@ -238,8 +252,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();
     }