[vlc-commits] FluidSynth: support for custom sample rate

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


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

FluidSynth: support for custom sample rate

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

 configure.ac               |    2 +-
 modules/codec/fluidsynth.c |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0b35430..4e50bee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2882,7 +2882,7 @@ fi
 dnl
 dnl libfluidsynth (MIDI synthetizer) plugin
 dnl
-PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.0], [MIDI synthetiser with libfluidsynth], [auto])
+PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
 
 dnl
 dnl Teletext Modules
diff --git a/modules/codec/fluidsynth.c b/modules/codec/fluidsynth.c
index 787687d..5c65e8e 100644
--- a/modules/codec/fluidsynth.c
+++ b/modules/codec/fluidsynth.c
@@ -51,6 +51,7 @@
 #define GAIN_LONGTEXT N_("This gain is applied to synthesis output. " \
     "High values may cause saturation when many notes are played at a time." )
 
+#define SAMPLE_RATE_TEXT N_("Sample rate")
 
 static int  Open  (vlc_object_t *);
 static void Close (vlc_object_t *);
@@ -66,6 +67,9 @@ vlc_module_begin ()
                   SOUNDFONT_TEXT, SOUNDFONT_LONGTEXT, false)
     add_float ("synth-gain", 0.8, GAIN_TEXT, GAIN_LONGTEXT, false)
         change_float_range (0., 10.)
+    add_integer ("synth-sample-rate", 44100,
+                 SAMPLE_RATE_TEXT, SAMPLE_RATE_TEXT, true)
+        change_integer_range (22050, 96000)
 vlc_module_end ()
 
 
@@ -146,7 +150,9 @@ static int Open (vlc_object_t *p_this)
                           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_rate =
+        var_InheritInteger (p_this, "synth-sample-rate");;
+    fluid_synth_set_sample_rate (p_sys->synth, p_dec->fmt_out.audio.i_rate);
     p_dec->fmt_out.audio.i_channels = 2;
     p_dec->fmt_out.audio.i_original_channels =
     p_dec->fmt_out.audio.i_physical_channels =



More information about the vlc-commits mailing list