2013-03-21 06:05:54 +00:00
|
|
|
/*
|
2013-03-22 14:19:32 +00:00
|
|
|
* gstfluiddec - fluiddec plugin for gstreamer
|
2013-03-21 06:05:54 +00:00
|
|
|
*
|
|
|
|
* Copyright 2013 Wim Taymans <wim.taymans@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-03-22 14:19:32 +00:00
|
|
|
* SECTION:element-fluiddec
|
2013-03-21 06:05:54 +00:00
|
|
|
* @see_also: timidity, wildmidi
|
|
|
|
*
|
|
|
|
* This element renders midi-events as audio streams using
|
|
|
|
* <ulink url="http://fluidsynth.sourceforge.net//">Fluidsynth</ulink>.
|
|
|
|
* It offers better sound quality compared to the timidity or wildmidi element.
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example pipeline</title>
|
|
|
|
* |[
|
2013-03-22 14:19:32 +00:00
|
|
|
* gst-launch-1.0 filesrc location=song.mid ! midiparse ! fluiddec ! pulsesink
|
2013-03-21 06:05:54 +00:00
|
|
|
* ]| This example pipeline will parse the midi and render to raw audio which is
|
|
|
|
* played via pulseaudio.
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
#define FLUID_DEC_RATE 44100
|
|
|
|
#define FLUID_DEC_BPS (4 * 2)
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <glib/gstdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <gst/audio/audio.h>
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
#include "gstfluiddec.h"
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_fluid_dec_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_fluid_dec_debug
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2013-03-22 10:04:10 +00:00
|
|
|
#define DEFAULT_SOUNDFONT NULL
|
|
|
|
#define DEFAULT_SYNTH_CHORUS TRUE
|
|
|
|
#define DEFAULT_SYNTH_REVERB TRUE
|
|
|
|
#define DEFAULT_SYNTH_GAIN 0.2
|
|
|
|
#define DEFAULT_SYNTH_POLYPHONY 256
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2013-03-22 10:04:10 +00:00
|
|
|
PROP_SOUNDFONT,
|
|
|
|
PROP_SYNTH_CHORUS,
|
|
|
|
PROP_SYNTH_REVERB,
|
|
|
|
PROP_SYNTH_GAIN,
|
|
|
|
PROP_SYNTH_POLYPHONY
|
2013-03-21 06:05:54 +00:00
|
|
|
};
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
static void gst_fluid_dec_finalize (GObject * object);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
static gboolean gst_fluid_dec_sink_event (GstPad * pad, GstObject * parent,
|
2013-03-21 06:05:54 +00:00
|
|
|
GstEvent * event);
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
static GstStateChangeReturn gst_fluid_dec_change_state (GstElement * element,
|
2013-03-21 06:05:54 +00:00
|
|
|
GstStateChange transition);
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
static GstFlowReturn gst_fluid_dec_chain (GstPad * sinkpad, GstObject * parent,
|
2013-03-21 06:05:54 +00:00
|
|
|
GstBuffer * buffer);
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
static void gst_fluid_dec_set_property (GObject * object, guint prop_id,
|
2013-03-21 06:05:54 +00:00
|
|
|
const GValue * value, GParamSpec * pspec);
|
2013-03-22 14:19:32 +00:00
|
|
|
static void gst_fluid_dec_get_property (GObject * object, guint prop_id,
|
2013-03-21 06:05:54 +00:00
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-midi-event")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw, "
|
|
|
|
"format = (string) " GST_AUDIO_NE (F32) ", "
|
2013-03-22 14:19:32 +00:00
|
|
|
"rate = (int) " G_STRINGIFY (FLUID_DEC_RATE) ", "
|
2013-03-21 06:05:54 +00:00
|
|
|
"channels = (int) 2, " "layout = (string) interleaved"));
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
#define parent_class gst_fluid_dec_parent_class
|
|
|
|
G_DEFINE_TYPE (GstFluidDec, gst_fluid_dec, GST_TYPE_ELEMENT);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 07:54:32 +00:00
|
|
|
/* fluid_synth log handler */
|
|
|
|
static void
|
|
|
|
gst_fluid_synth_error_log_function (int level, char *message, void *data)
|
|
|
|
{
|
|
|
|
GST_ERROR ("%s", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_fluid_synth_warning_log_function (int level, char *message, void *data)
|
|
|
|
{
|
|
|
|
GST_WARNING ("%s", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_fluid_synth_info_log_function (int level, char *message, void *data)
|
|
|
|
{
|
|
|
|
GST_INFO ("%s", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_fluid_synth_debug_log_function (int level, char *message, void *data)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("%s", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
/* initialize the plugin's class */
|
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_class_init (GstFluidDecClass * klass)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
gobject_class->finalize = gst_fluid_dec_finalize;
|
|
|
|
gobject_class->set_property = gst_fluid_dec_set_property;
|
|
|
|
gobject_class->get_property = gst_fluid_dec_get_property;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 10:04:10 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SOUNDFONT,
|
|
|
|
g_param_spec_string ("soundfont",
|
|
|
|
"Soundfont", "the filename of a soundfont (NULL for default)",
|
|
|
|
DEFAULT_SOUNDFONT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNTH_CHORUS,
|
|
|
|
g_param_spec_boolean ("synth-chorus",
|
|
|
|
"Synth Chorus", "Turn the chorus on or off",
|
|
|
|
DEFAULT_SYNTH_CHORUS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNTH_REVERB,
|
|
|
|
g_param_spec_boolean ("synth-reverb",
|
|
|
|
"Synth Reverb", "Turn the reverb on or off",
|
|
|
|
DEFAULT_SYNTH_REVERB, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNTH_GAIN,
|
|
|
|
g_param_spec_double ("synth-gain",
|
|
|
|
"Synth Gain", "Set the master gain", 0.0, 10.0,
|
|
|
|
DEFAULT_SYNTH_GAIN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_SYNTH_POLYPHONY,
|
|
|
|
g_param_spec_int ("synth-polyphony",
|
|
|
|
"Synth Polyphony", "The number of simultaneous voices", 1, 65535,
|
|
|
|
DEFAULT_SYNTH_POLYPHONY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2016-03-04 06:50:26 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &src_factory);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &sink_factory);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Fluidsynth",
|
|
|
|
"Codec/Decoder/Audio",
|
|
|
|
"Midi Synthesizer Element", "Wim Taymans <wim.taymans@gmail.com>");
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
gstelement_class->change_state = gst_fluid_dec_change_state;
|
2013-03-22 07:54:32 +00:00
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
fluid_set_log_function (FLUID_PANIC, gst_fluid_synth_error_log_function,
|
|
|
|
NULL);
|
|
|
|
fluid_set_log_function (FLUID_ERR, gst_fluid_synth_warning_log_function,
|
|
|
|
NULL);
|
|
|
|
fluid_set_log_function (FLUID_WARN, gst_fluid_synth_warning_log_function,
|
|
|
|
NULL);
|
|
|
|
fluid_set_log_function (FLUID_INFO, gst_fluid_synth_info_log_function, NULL);
|
|
|
|
fluid_set_log_function (FLUID_DBG, gst_fluid_synth_debug_log_function, NULL);
|
|
|
|
#else
|
|
|
|
fluid_set_log_function (FLUID_PANIC, NULL, NULL);
|
|
|
|
fluid_set_log_function (FLUID_ERR, NULL, NULL);
|
|
|
|
fluid_set_log_function (FLUID_WARN, NULL, NULL);
|
|
|
|
fluid_set_log_function (FLUID_INFO, NULL, NULL);
|
|
|
|
fluid_set_log_function (FLUID_DBG, NULL, NULL);
|
|
|
|
#endif
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize the new element
|
|
|
|
* instantiate pads and add them to element
|
|
|
|
* set functions
|
|
|
|
* initialize structure
|
|
|
|
*/
|
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_init (GstFluidDec * filter)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_pad_set_event_function (filter->sinkpad, gst_fluid_dec_sink_event);
|
|
|
|
gst_pad_set_chain_function (filter->sinkpad, gst_fluid_dec_chain);
|
2013-03-21 06:05:54 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
|
|
|
|
|
|
|
|
filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
|
|
|
|
gst_pad_use_fixed_caps (filter->srcpad);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
|
|
|
filter->soundfont = g_strdup (DEFAULT_SOUNDFONT);
|
|
|
|
filter->synth_chorus = DEFAULT_SYNTH_CHORUS;
|
|
|
|
filter->synth_reverb = DEFAULT_SYNTH_REVERB;
|
|
|
|
filter->synth_gain = DEFAULT_SYNTH_GAIN;
|
|
|
|
filter->synth_polyphony = DEFAULT_SYNTH_POLYPHONY;
|
|
|
|
|
|
|
|
filter->settings = new_fluid_settings ();
|
|
|
|
filter->synth = new_fluid_synth (filter->settings);
|
|
|
|
filter->sf = -1;
|
|
|
|
|
|
|
|
fluid_synth_set_chorus_on (filter->synth, filter->synth_chorus);
|
|
|
|
fluid_synth_set_reverb_on (filter->synth, filter->synth_reverb);
|
|
|
|
fluid_synth_set_gain (filter->synth, filter->synth_gain);
|
|
|
|
fluid_synth_set_polyphony (filter->synth, filter->synth_polyphony);
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_finalize (GObject * object)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GstFluidDec *fluiddec = GST_FLUID_DEC (object);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
delete_fluid_synth (fluiddec->synth);
|
|
|
|
delete_fluid_settings (fluiddec->settings);
|
|
|
|
g_free (fluiddec->soundfont);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static GstBuffer *
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_clip_buffer (GstFluidDec * fluiddec, GstBuffer * buffer)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
guint64 start, stop;
|
|
|
|
guint64 new_start, new_stop;
|
|
|
|
gint64 offset, length;
|
|
|
|
|
|
|
|
/* clipping disabled for now */
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
start = GST_BUFFER_OFFSET (buffer);
|
|
|
|
stop = GST_BUFFER_OFFSET_END (buffer);
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
if (!gst_segment_clip (&fluiddec->segment, GST_FORMAT_DEFAULT,
|
2013-03-21 06:05:54 +00:00
|
|
|
start, stop, &new_start, &new_stop)) {
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (start == new_start && stop == new_stop)
|
|
|
|
return buffer;
|
|
|
|
|
|
|
|
offset = new_start - start;
|
|
|
|
length = new_stop - new_start;
|
|
|
|
|
|
|
|
buffer = gst_buffer_make_writable (buffer);
|
|
|
|
gst_buffer_resize (buffer, offset, length);
|
|
|
|
|
|
|
|
GST_BUFFER_OFFSET (buffer) = new_start;
|
|
|
|
GST_BUFFER_OFFSET_END (buffer) = new_stop;
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) =
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_util_uint64_scale_int (new_start, GST_SECOND, FLUID_DEC_RATE);
|
2013-03-21 06:05:54 +00:00
|
|
|
GST_BUFFER_DURATION (buffer) =
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_util_uint64_scale_int (new_stop, GST_SECOND, FLUID_DEC_RATE) -
|
2013-03-21 06:05:54 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-03-22 11:16:45 +00:00
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_reset (GstFluidDec * fluiddec)
|
2013-03-22 11:16:45 +00:00
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_system_reset (fluiddec->synth);
|
|
|
|
fluiddec->last_pts = GST_CLOCK_TIME_NONE;
|
2013-03-22 11:16:45 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
static gboolean
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
gboolean res;
|
2013-03-22 14:19:32 +00:00
|
|
|
GstFluidDec *fluiddec = GST_FLUID_DEC (parent);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (pad, "%s event received", GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/x-raw",
|
|
|
|
"format", G_TYPE_STRING, GST_AUDIO_NE (F32),
|
2013-03-22 14:19:32 +00:00
|
|
|
"rate", G_TYPE_INT, FLUID_DEC_RATE,
|
2013-03-21 06:05:54 +00:00
|
|
|
"channels", G_TYPE_INT, 2,
|
|
|
|
"layout", G_TYPE_STRING, "interleaved", NULL);
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_set_sample_rate (fluiddec->synth, FLUID_DEC_RATE);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
res = gst_pad_push_event (fluiddec->srcpad, gst_event_new_caps (caps));
|
2013-03-21 06:05:54 +00:00
|
|
|
gst_caps_unref (caps);
|
2014-10-10 12:05:49 +00:00
|
|
|
gst_event_unref (event);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_SEGMENT:
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_event_copy_segment (event, &fluiddec->segment);
|
|
|
|
GST_DEBUG_OBJECT (fluiddec, "configured segment %" GST_SEGMENT_FORMAT,
|
|
|
|
&fluiddec->segment);
|
2013-03-21 06:05:54 +00:00
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
|
|
|
break;
|
2013-03-22 11:16:45 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_reset (fluiddec);
|
2013-03-22 11:16:45 +00:00
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
|
|
|
break;
|
2013-03-21 06:05:54 +00:00
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* FIXME, push last samples */
|
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2013-03-22 14:19:32 +00:00
|
|
|
produce_samples (GstFluidDec * fluiddec, GstClockTime pts, guint64 sample)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
2013-03-21 16:05:36 +00:00
|
|
|
GstClockTime duration, timestamp;
|
|
|
|
guint64 samples, offset;
|
2013-03-21 06:05:54 +00:00
|
|
|
GstMapInfo info;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
samples = sample - fluiddec->last_sample;
|
|
|
|
duration = pts - fluiddec->last_pts;
|
|
|
|
offset = fluiddec->last_sample;
|
|
|
|
timestamp = fluiddec->last_pts;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->last_pts = pts;
|
|
|
|
fluiddec->last_sample = sample;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-21 16:05:36 +00:00
|
|
|
if (samples == 0)
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_OBJECT (fluiddec, "duration %" GST_TIME_FORMAT
|
2013-04-08 16:40:14 +00:00
|
|
|
", samples %" G_GUINT64_FORMAT, GST_TIME_ARGS (duration), samples);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
outbuf = gst_buffer_new_allocate (NULL, samples * FLUID_DEC_BPS, NULL);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
gst_buffer_map (outbuf, &info, GST_MAP_WRITE);
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_write_float (fluiddec->synth, samples, info.data, 0, 2,
|
2013-03-21 06:05:54 +00:00
|
|
|
info.data, 1, 2);
|
|
|
|
gst_buffer_unmap (outbuf, &info);
|
|
|
|
|
2013-03-21 16:05:36 +00:00
|
|
|
GST_BUFFER_DTS (outbuf) = timestamp;
|
|
|
|
GST_BUFFER_PTS (outbuf) = timestamp;
|
|
|
|
GST_BUFFER_DURATION (outbuf) = duration;
|
|
|
|
GST_BUFFER_OFFSET (outbuf) = offset;
|
|
|
|
GST_BUFFER_OFFSET_END (outbuf) = offset + samples;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
if (fluiddec->discont) {
|
2013-03-22 12:48:03 +00:00
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->discont = FALSE;
|
2013-03-22 12:48:03 +00:00
|
|
|
}
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
return gst_pad_push (fluiddec->srcpad, outbuf);
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
handle_buffer (GstFluidDec * fluiddec, GstBuffer * buffer)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
GstMapInfo info;
|
2013-03-21 17:17:40 +00:00
|
|
|
guint8 event;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
gst_buffer_map (buffer, &info, GST_MAP_READ);
|
|
|
|
|
2014-09-30 23:53:59 +00:00
|
|
|
if (info.size == 0)
|
|
|
|
goto done;
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
event = info.data[0];
|
2013-03-21 13:57:43 +00:00
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
switch (event & 0xf0) {
|
|
|
|
case 0xf0:
|
|
|
|
switch (event) {
|
|
|
|
case 0xff:
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_OBJECT (fluiddec, "system reset");
|
|
|
|
fluid_synth_system_reset (fluiddec->synth);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case 0xf0:
|
|
|
|
case 0xf7:
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_OBJECT (fluiddec, "sysex 0x%02x", event);
|
|
|
|
GST_MEMDUMP_OBJECT (fluiddec, "bytes ", info.data + 1, info.size - 1);
|
|
|
|
fluid_synth_sysex (fluiddec->synth, (char *) info.data + 1,
|
2013-03-21 06:05:54 +00:00
|
|
|
info.size - 1, NULL, NULL, NULL, 0);
|
|
|
|
|
2013-03-22 07:54:54 +00:00
|
|
|
break;
|
|
|
|
case 0xf9:
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_LOG_OBJECT (fluiddec, "midi tick");
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_WARNING_OBJECT (fluiddec, "unhandled event 0x%02x", event);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
2013-03-21 17:17:40 +00:00
|
|
|
guint8 channel, p1, p2;
|
|
|
|
|
|
|
|
channel = event & 0x0f;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
p1 = info.size > 1 ? info.data[1] & 0x7f : 0;
|
|
|
|
p2 = info.size > 2 ? info.data[2] & 0x7f : 0;
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_OBJECT (fluiddec, "event 0x%02x channel %d, 0x%02x 0x%02x",
|
2013-03-21 17:17:40 +00:00
|
|
|
event, channel, p1, p2);
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
switch (event & 0xf0) {
|
|
|
|
case 0x80:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_noteoff (fluiddec->synth, channel, p1);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case 0x90:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_noteon (fluiddec->synth, channel, p1, p2);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case 0xA0:
|
|
|
|
/* aftertouch */
|
|
|
|
break;
|
|
|
|
case 0xB0:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_cc (fluiddec->synth, channel, p1, p2);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case 0xC0:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_program_change (fluiddec->synth, channel, p1);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case 0xD0:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_channel_pressure (fluiddec->synth, channel, p1);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case 0xE0:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluid_synth_pitch_bend (fluiddec->synth, channel, (p2 << 7) | p1);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-09-30 23:53:59 +00:00
|
|
|
|
|
|
|
done:
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buffer)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
2013-03-22 14:19:32 +00:00
|
|
|
GstFluidDec *fluiddec;
|
2013-03-21 06:05:54 +00:00
|
|
|
GstClockTime pts;
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec = GST_FLUID_DEC (parent);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 12:48:03 +00:00
|
|
|
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->discont = TRUE;
|
2013-03-22 12:48:03 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
pts = GST_BUFFER_PTS (buffer);
|
|
|
|
|
2013-03-21 16:05:36 +00:00
|
|
|
if (pts != GST_CLOCK_TIME_NONE) {
|
|
|
|
guint64 sample =
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_util_uint64_scale_int (pts, FLUID_DEC_RATE, GST_SECOND);
|
2013-03-21 16:05:36 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
if (fluiddec->last_pts == GST_CLOCK_TIME_NONE) {
|
|
|
|
fluiddec->last_pts = pts;
|
|
|
|
fluiddec->last_sample = sample;
|
|
|
|
} else if (fluiddec->last_pts < pts) {
|
2013-03-21 16:05:36 +00:00
|
|
|
/* generate samples for the elapsed time */
|
2013-03-22 14:19:32 +00:00
|
|
|
res = produce_samples (fluiddec, pts, sample);
|
2013-03-21 16:05:36 +00:00
|
|
|
}
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (res == GST_FLOW_OK) {
|
2013-03-22 14:19:32 +00:00
|
|
|
handle_buffer (fluiddec, buffer);
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_open (GstFluidDec * fluiddec)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
2013-03-22 10:04:10 +00:00
|
|
|
GDir *dir;
|
|
|
|
GError *error = NULL;
|
2014-02-10 08:19:52 +00:00
|
|
|
const gchar *const *sharedirs;
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
if (fluiddec->sf != -1)
|
2013-03-22 10:04:10 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
if (fluiddec->soundfont) {
|
|
|
|
GST_DEBUG_OBJECT (fluiddec, "loading soundfont file %s",
|
|
|
|
fluiddec->soundfont);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->sf = fluid_synth_sfload (fluiddec->synth, fluiddec->soundfont, 1);
|
|
|
|
if (fluiddec->sf == -1)
|
2013-03-22 10:04:10 +00:00
|
|
|
goto load_failed;
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_OBJECT (fluiddec, "loaded soundfont file %s",
|
|
|
|
fluiddec->soundfont);
|
2013-03-22 10:04:10 +00:00
|
|
|
} else {
|
2014-02-10 13:34:40 +00:00
|
|
|
gint i, j;
|
|
|
|
/* ubuntu/debian in sounds/sf2, fedora in soundfonts */
|
|
|
|
static const gchar *paths[] = { "sounds/sf2/", "soundfonts/", NULL };
|
|
|
|
|
2014-02-10 08:19:52 +00:00
|
|
|
sharedirs = g_get_system_data_dirs ();
|
2014-02-10 13:34:40 +00:00
|
|
|
|
2014-02-10 08:19:52 +00:00
|
|
|
for (i = 0; sharedirs[i]; i++) {
|
2014-02-10 13:34:40 +00:00
|
|
|
for (j = 0; paths[j]; j++) {
|
|
|
|
gchar *soundfont_path = g_build_path ("/", sharedirs[i], paths[j],
|
|
|
|
NULL);
|
|
|
|
GST_DEBUG_OBJECT (fluiddec, "Trying to list contents of a %s directory",
|
|
|
|
soundfont_path);
|
|
|
|
error = NULL;
|
|
|
|
dir = g_dir_open (soundfont_path, 0, &error);
|
|
|
|
if (dir == NULL) {
|
|
|
|
GST_DEBUG_OBJECT (fluiddec,
|
|
|
|
"Can't open a potential soundfont directory %s: %s",
|
|
|
|
soundfont_path, error->message);
|
|
|
|
g_free (soundfont_path);
|
|
|
|
g_error_free (error);
|
|
|
|
continue;
|
|
|
|
}
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2014-02-10 13:34:40 +00:00
|
|
|
while (TRUE) {
|
|
|
|
const gchar *name;
|
|
|
|
gchar *filename;
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2014-02-10 13:34:40 +00:00
|
|
|
if ((name = g_dir_read_name (dir)) == NULL)
|
|
|
|
break;
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2014-02-10 13:34:40 +00:00
|
|
|
filename = g_build_filename (soundfont_path, name, NULL);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2014-02-10 13:34:40 +00:00
|
|
|
GST_DEBUG_OBJECT (fluiddec, "loading soundfont file %s", filename);
|
|
|
|
fluiddec->sf = fluid_synth_sfload (fluiddec->synth, filename, 1);
|
|
|
|
if (fluiddec->sf != -1) {
|
|
|
|
GST_DEBUG_OBJECT (fluiddec, "loaded soundfont file %s", filename);
|
2014-10-09 09:51:16 +00:00
|
|
|
g_free (filename);
|
|
|
|
g_dir_close (dir);
|
|
|
|
g_free (soundfont_path);
|
2014-02-10 13:34:40 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
GST_DEBUG_OBJECT (fluiddec, "could not load soundfont file %s",
|
|
|
|
filename);
|
2014-10-09 09:51:16 +00:00
|
|
|
g_free (filename);
|
2014-02-10 08:19:52 +00:00
|
|
|
}
|
2014-02-10 13:34:40 +00:00
|
|
|
g_dir_close (dir);
|
|
|
|
g_free (soundfont_path);
|
2013-03-22 10:04:10 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-10 08:19:52 +00:00
|
|
|
if (fluiddec->sf == -1) {
|
2013-03-22 10:04:10 +00:00
|
|
|
goto no_soundfont;
|
2014-02-10 08:19:52 +00:00
|
|
|
}
|
2013-03-22 10:04:10 +00:00
|
|
|
}
|
2014-02-10 13:34:40 +00:00
|
|
|
done:
|
2013-03-21 06:05:54 +00:00
|
|
|
return TRUE;
|
2013-03-22 10:04:10 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
load_failed:
|
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_ELEMENT_ERROR (fluiddec, RESOURCE, OPEN_READ,
|
|
|
|
("Can't open soundfont %s", fluiddec->soundfont),
|
|
|
|
("failed to open soundfont file %s for reading", fluiddec->soundfont));
|
2013-03-22 10:04:10 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
no_soundfont:
|
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_ELEMENT_ERROR (fluiddec, RESOURCE, OPEN_READ,
|
2014-02-10 13:34:40 +00:00
|
|
|
("Can't find a soundfont file in subdirectories of XDG_DATA_DIRS paths"),
|
|
|
|
("no usable soundfont files found in subdirectories of XDG_DATA_DIRS"));
|
2013-03-22 10:04:10 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_close (GstFluidDec * fluiddec)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
if (fluiddec->sf) {
|
|
|
|
fluid_synth_sfunload (fluiddec->synth, fluiddec->sf, 1);
|
|
|
|
fluiddec->sf = -1;
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstStateChangeReturn
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_change_state (GstElement * element, GstStateChange transition)
|
2013-03-21 06:05:54 +00:00
|
|
|
{
|
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2013-03-22 14:19:32 +00:00
|
|
|
GstFluidDec *fluiddec = GST_FLUID_DEC (element);
|
2013-03-21 06:05:54 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2013-03-22 14:19:32 +00:00
|
|
|
if (!gst_fluid_dec_open (fluiddec))
|
2013-03-21 06:05:54 +00:00
|
|
|
goto open_failed;
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_reset (fluiddec);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_close (fluiddec);
|
2013-03-21 06:05:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
open_failed:
|
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_ERROR_OBJECT (fluiddec, "could not open");
|
2013-03-21 06:05:54 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_set_property (GObject * object, guint prop_id,
|
2013-03-21 06:05:54 +00:00
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GstFluidDec *fluiddec = GST_FLUID_DEC (object);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
switch (prop_id) {
|
2013-03-22 10:04:10 +00:00
|
|
|
case PROP_SOUNDFONT:
|
2013-03-22 14:19:32 +00:00
|
|
|
g_free (fluiddec->soundfont);
|
|
|
|
fluiddec->soundfont = g_value_dup_string (value);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_CHORUS:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->synth_chorus = g_value_get_boolean (value);
|
|
|
|
fluid_synth_set_chorus_on (fluiddec->synth, fluiddec->synth_chorus);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_REVERB:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->synth_reverb = g_value_get_boolean (value);
|
|
|
|
fluid_synth_set_reverb_on (fluiddec->synth, fluiddec->synth_reverb);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_GAIN:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->synth_gain = g_value_get_double (value);
|
|
|
|
fluid_synth_set_gain (fluiddec->synth, fluiddec->synth_gain);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_POLYPHONY:
|
2013-03-22 14:19:32 +00:00
|
|
|
fluiddec->synth_polyphony = g_value_get_int (value);
|
|
|
|
fluid_synth_set_polyphony (fluiddec->synth, fluiddec->synth_polyphony);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
2013-03-21 06:05:54 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-22 14:19:32 +00:00
|
|
|
gst_fluid_dec_get_property (GObject * object, guint prop_id,
|
2013-03-21 06:05:54 +00:00
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GstFluidDec *fluiddec = GST_FLUID_DEC (object);
|
2013-03-22 10:04:10 +00:00
|
|
|
|
2013-03-21 06:05:54 +00:00
|
|
|
switch (prop_id) {
|
2013-03-22 10:04:10 +00:00
|
|
|
case PROP_SOUNDFONT:
|
2013-03-22 14:19:32 +00:00
|
|
|
g_value_set_string (value, fluiddec->soundfont);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_CHORUS:
|
2013-03-22 14:19:32 +00:00
|
|
|
g_value_set_boolean (value, fluiddec->synth_chorus);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_REVERB:
|
2013-03-22 14:19:32 +00:00
|
|
|
g_value_set_boolean (value, fluiddec->synth_reverb);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_GAIN:
|
2013-03-22 14:19:32 +00:00
|
|
|
g_value_set_double (value, fluiddec->synth_gain);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
|
|
|
case PROP_SYNTH_POLYPHONY:
|
2013-03-22 14:19:32 +00:00
|
|
|
g_value_set_int (value, fluiddec->synth_polyphony);
|
2013-03-22 10:04:10 +00:00
|
|
|
break;
|
2013-03-21 06:05:54 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2013-03-22 14:19:32 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_fluid_dec_debug, "fluiddec",
|
|
|
|
0, "Fluidsynth MIDI decoder plugin");
|
2013-03-21 06:05:54 +00:00
|
|
|
|
2013-03-22 14:19:32 +00:00
|
|
|
return gst_element_register (plugin, "fluiddec",
|
|
|
|
GST_RANK_SECONDARY, GST_TYPE_FLUID_DEC);
|
2013-03-21 06:05:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2013-03-22 14:19:32 +00:00
|
|
|
fluidsynthmidi,
|
|
|
|
"Fluidsynth MIDI Plugin",
|
2013-03-21 06:05:54 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|