From ff6c2043dde3d5d308e0f035c82e6b99ea77fa7a 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 d0bec0b5..bce261c5 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)