From 257ca75e850d0aa8380d6d2215e85ec28fb491d7 Mon Sep 17 00:00:00 2001
From: Districh <[EMAIL REDACTED]>
Date: Fri, 24 Mar 2023 20:24:26 +0300
Subject: [PATCH] Make FluidSynth gain adjustment between 0 and 1.0 to avoid
clicks in sound and have the loudness same as other MIDI backends
---
src/codecs/music_fluidsynth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/codecs/music_fluidsynth.c b/src/codecs/music_fluidsynth.c
index 348e51a1..6a27decf 100644
--- a/src/codecs/music_fluidsynth.c
+++ b/src/codecs/music_fluidsynth.c
@@ -259,9 +259,9 @@ static void *FLUIDSYNTH_CreateFromRW(SDL_RWops *src, int freesrc)
static void FLUIDSYNTH_SetVolume(void *context, int volume)
{
FLUIDSYNTH_Music *music = (FLUIDSYNTH_Music *)context;
- /* FluidSynth's default is 0.2. Make 1.2 the maximum. */
+ /* FluidSynth's default gain is 0.2. Make 1.0 the maximum gain value to avoid sound overload. */
music->volume = volume;
- fluidsynth.fluid_synth_set_gain(music->synth, (float) (volume * 1.2 / MIX_MAX_VOLUME));
+ fluidsynth.fluid_synth_set_gain(music->synth, (float) (volume * 1.0 / MIX_MAX_VOLUME));
}
static int FLUIDSYNTH_GetVolume(void *context)