shithub: choc

Download patch

ref: 4537cf40ac55224d1676b77555dbfe193bd5bedc
parent: 3524a67dd3c7d48a172c83d3ae170a7176fb3cfa
author: Michael Day <[email protected]>
date: Thu Aug 12 19:28:02 EDT 2021

Introduce FluidSynth soundfont path

Add fluidsynth_sf_path config variable.
Set FluidSynth soundfont path with Mix_SetSoundFonts.

--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -56,6 +56,7 @@
 static boolean musicpaused = false;
 static int current_music_volume;
 
+char *fluidsynth_sf_path = "";
 char *timidity_cfg_path = "";
 
 static char *temp_timidity_cfg = NULL;
@@ -207,6 +208,14 @@
     // file can be removed.
 
     RemoveTimidityConfig();
+
+    // When using FluidSynth, proceed to set the soundfont path via
+    // Mix_SetSoundFonts if necessary.
+
+    if (strlen(fluidsynth_sf_path) > 0 && strlen(timidity_cfg_path) == 0)
+    {
+        Mix_SetSoundFonts(fluidsynth_sf_path);
+    }
 
     // If snd_musiccmd is set, we need to call Mix_SetMusicCMD to
     // configure an external music playback program.
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -83,6 +83,7 @@
 // For native music module:
 
 extern char *music_pack_path;
+extern char *fluidsynth_sf_path;
 extern char *timidity_cfg_path;
 
 // DOS-specific options: These are unused but should be maintained
@@ -504,6 +505,7 @@
     M_BindIntVariable("snd_pitchshift",          &snd_pitchshift);
 
     M_BindStringVariable("music_pack_path",      &music_pack_path);
+    M_BindStringVariable("fluidsynth_sf_path",   &fluidsynth_sf_path);
     M_BindStringVariable("timidity_cfg_path",    &timidity_cfg_path);
     M_BindStringVariable("gus_patch_path",       &gus_patch_path);
     M_BindIntVariable("gus_ram_kb",              &gus_ram_kb);
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -929,6 +929,12 @@
     CONFIG_VARIABLE_STRING(music_pack_path),
 
     //!
+    // Documentation goes here.
+    //
+
+    CONFIG_VARIABLE_STRING(fluidsynth_sf_path),
+
+    //!
     // Full path to a Timidity configuration file to use for MIDI
     // playback. The file will be evaluated from the directory where
     // it is evaluated, so there is no need to add "dir" commands