[vlc-commits] FluidSynth: add gain setting and better default value

Rémi Denis-Courmont git at videolan.org
Tue Mar 13 19:15:23 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 13 20:13:49 2012 +0200| [3ead74ab142286d39f1f155569a3f389d7e5f28f] | committer: Rémi Denis-Courmont

FluidSynth: add gain setting and better default value

The default gain of 0.2 was way too low compared to other audio codecs.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3ead74ab142286d39f1f155569a3f389d7e5f28f
---

 modules/codec/fluidsynth.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index cc442f7..787687d 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -47,6 +47,11 @@
 #define SOUNDFONT_LONGTEXT N_( \
     "A sound fonts file is required for software synthesis." )
 
+#define GAIN_TEXT N_("Synthesis gain")
+#define GAIN_LONGTEXT N_("This gain is applied to synthesis output. " \
+    "High values may cause saturation when many notes are played at a time." )
+
+
 static int  Open  (vlc_object_t *);
 static void Close (vlc_object_t *);
 
@@ -58,7 +63,9 @@ vlc_module_begin ()
     set_subcategory (SUBCAT_INPUT_ACODEC)
     set_callbacks (Open, Close)
     add_loadfile ("soundfont", "",
-                  SOUNDFONT_TEXT, SOUNDFONT_LONGTEXT, false);
+                  SOUNDFONT_TEXT, SOUNDFONT_LONGTEXT, false)
+    add_float ("synth-gain", 0.8, GAIN_TEXT, GAIN_LONGTEXT, false)
+        change_float_range (0., 10.)
 vlc_module_end ()
 
 
@@ -135,6 +142,9 @@ static int Open (vlc_object_t *p_this)
         return VLC_EGENERIC;
     }
 
+    fluid_synth_set_gain (p_sys->synth,
+                          var_InheritFloat (p_this, "synth-gain"));
+
     p_dec->fmt_out.i_cat = AUDIO_ES;
     p_dec->fmt_out.audio.i_rate = 44100;
     p_dec->fmt_out.audio.i_channels = 2;



More information about the vlc-commits mailing list