]> git.sesse.net Git - vlc/blobdiff - modules/codec/fluidsynth.c
Merge branch 1.0-bugfix
[vlc] / modules / codec / fluidsynth.c
index d59a5081d31f9dd643bdc3324a5c0f250afe6d4a..ae08aeff7cdc04587158a9511fb8ed7545dfe921 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_aout.h>
 #include <vlc_codec.h>
 
 static int  Open  (vlc_object_t *);
 static void Close (vlc_object_t *);
 
-vlc_module_begin();
-    set_description (_("FluidSynth MIDI synthetizer"));
-    set_capability ("decoder", 100);
-    set_category (CAT_INPUT);
-    set_subcategory (SUBCAT_INPUT_ACODEC);
-    set_callbacks (Open, Close);
+vlc_module_begin ()
+    set_description (N_("FluidSynth MIDI synthetizer"))
+    set_capability ("decoder", 100)
+    set_shortname (N_("FluidSynth"))
+    set_category (CAT_INPUT)
+    set_subcategory (SUBCAT_INPUT_ACODEC)
+    set_callbacks (Open, Close)
     add_file ("soundfont", "", NULL,
-              SOUNDFONT_TEXT, SOUNDFONT_LONGTEXT, VLC_FALSE);
-vlc_module_end();
+              SOUNDFONT_TEXT, SOUNDFONT_LONGTEXT, false);
+vlc_module_end ()
 
 
 struct decoder_sys_t
@@ -60,7 +66,7 @@ static int Open (vlc_object_t *p_this)
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys;
 
-    if (p_dec->fmt_in.i_codec != VLC_FOURCC ('M', 'I', 'D', 'I'))
+    if (p_dec->fmt_in.i_codec != VLC_CODEC_MIDI)
         return VLC_EGENERIC;
 
     char *font_path = var_CreateGetNonEmptyString (p_this, "soundfont");
@@ -76,8 +82,8 @@ static int Open (vlc_object_t *p_this)
     p_dec->fmt_out.audio.i_original_channels =
     p_dec->fmt_out.audio.i_physical_channels =
         AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
-    p_dec->fmt_out.i_codec = AOUT_FMT_S16_NE;
-    p_dec->fmt_out.audio.i_bitspersample = 16;
+    p_dec->fmt_out.i_codec = VLC_CODEC_FL32;
+    p_dec->fmt_out.audio.i_bitspersample = 32;
 
     p_dec->pf_decode_audio = DecodeBlock;
     p_sys = p_dec->p_sys = malloc (sizeof (*p_sys));
@@ -172,7 +178,7 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
     if (samples == 0)
         return NULL;
 
-    aout_buffer_t *p_out = p_dec->pf_aout_buffer_new (p_dec, samples);
+    aout_buffer_t *p_out = decoder_NewAudioBuffer (p_dec, samples);
     if (p_out == NULL)
     {
         block_Release (p_block);
@@ -181,8 +187,8 @@ static aout_buffer_t *DecodeBlock (decoder_t *p_dec, block_t **pp_block)
 
     p_out->start_date = aout_DateGet (&p_sys->end_date );
     p_out->end_date   = aout_DateIncrement (&p_sys->end_date, samples);
-    fluid_synth_write_s16 (p_sys->synth, samples,
-                           (int16_t *)p_out->p_buffer, 0, 2,
-                           (int16_t *)p_out->p_buffer, 1, 2);
+    fluid_synth_write_float (p_sys->synth, samples,
+                             p_out->p_buffer, 0, 2,
+                             p_out->p_buffer, 1, 2);
     return p_out;
 }