[vlc-commits] FluidSynth: add gain setting and better default value
Rémi Denis-Courmont
git at videolan.org
Tue Mar 13 19:15:09 CET 2012
vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 13 20:13:49 2012 +0200| [820cbad5b91558e12da382de19fcbde86d504303] | 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.
(cherry picked from commit 734c123c221a806204d8c75a6297bebece0e91d2)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=820cbad5b91558e12da382de19fcbde86d504303
---
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 3228555..f6317ab 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -57,6 +57,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 *);
@@ -68,7 +73,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 ()
@@ -146,6 +153,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