[beast/devel: 18/26] PLUGINS: compile DavSynDrum as C++ resident type
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast/devel: 18/26] PLUGINS: compile DavSynDrum as C++ resident type
- Date: Tue, 18 Dec 2012 02:45:30 +0000 (UTC)
commit b7aeb196625c333319b3aea952566ded3c5f5f03
Author: Tim Janik <timj gnu org>
Date: Tue Dec 18 02:53:46 2012 +0100
PLUGINS: compile DavSynDrum as C++ resident type
plugins/Makefile.am | 5 +--
plugins/Makefile.plugins | 15 ---------
plugins/{davsyndrum.c => davsyndrum.cc} | 49 ++++++++++++++----------------
plugins/davsyndrum.h | 2 +-
po/POTSCAN | 2 +-
5 files changed, 27 insertions(+), 46 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 857a414..7b6e245 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -36,9 +36,9 @@ SFIDL_INC = --nostdinc -I$(top_srcdir) -I$(top_builddir)
# == C++ Plugins ==
cxx_plugin_headers = bseadder.h bseatandistort.h bsesimpleadsr.h bsemixer.h bsemult.h bsesequencer.h bseiirfilter.h \
- davcanyondelay.h
+ davcanyondelay.h davsyndrum.h
cxx_plugin_sources = bseadder.cc bseatandistort.cc bsesimpleadsr.cc bsemixer.cc bsemult.cc bsesequencer.cc bseiirfilter.cc \
- davcanyondelay.cc
+ davcanyondelay.cc davsyndrum.cc
cxx_plugin_extra = bsesimpleadsr-aux.cc
EXTRA_DIST += $(cxx_plugin_headers) $(cxx_plugin_extra)
cxxplugins_FPU_la_SOURCES = $(cxx_plugin_sources)
@@ -59,7 +59,6 @@ UNPORTED = $(strip \
)
cglob_plugins = $(strip \
davxtalstrings.[hc] \
- davsyndrum.[hc] \
)
EXTRA_DIST += $(strip \
$(EXTRA_HEADERS) \
diff --git a/plugins/Makefile.plugins b/plugins/Makefile.plugins
index e812ae5..655a531 100644
--- a/plugins/Makefile.plugins
+++ b/plugins/Makefile.plugins
@@ -126,18 +126,3 @@ davxtalstrings_SSE_la_SOURCES = $(davxtalstrings_FPU_la_SOURCES)
davxtalstrings_SSE_la_LDFLAGS = $(davxtalstrings_FPU_la_LDFLAGS)
davxtalstrings_SSE_la_LIBADD = $(davxtalstrings_FPU_la_LIBADD)
davxtalstrings_SSE_la_CFLAGS = $(SSE_PLUGIN_CFLAGS)
-
-
-## C Plugin davsyndrum
-EXTRA_HEADERS += davsyndrum.h
-$(srcdir)/davsyndrum.c: davsyndrum.h
-plugin_FPU_ltlibs += davsyndrum.FPU.la
-davsyndrum_FPU_la_SOURCES = davsyndrum.c
-davsyndrum_FPU_la_LDFLAGS = -module $(plugins_ldflags)
-davsyndrum_FPU_la_LIBADD = $(plugins_libs)
-davsyndrum_FPU_la_CFLAGS = $(FPU_PLUGIN_CFLAGS)
-plugin_SSE_ltlibs += davsyndrum.SSE.la
-davsyndrum_SSE_la_SOURCES = $(davsyndrum_FPU_la_SOURCES)
-davsyndrum_SSE_la_LDFLAGS = $(davsyndrum_FPU_la_LDFLAGS)
-davsyndrum_SSE_la_LIBADD = $(davsyndrum_FPU_la_LIBADD)
-davsyndrum_SSE_la_CFLAGS = $(SSE_PLUGIN_CFLAGS)
diff --git a/plugins/davsyndrum.c b/plugins/davsyndrum.cc
similarity index 90%
rename from plugins/davsyndrum.c
rename to plugins/davsyndrum.cc
index cb3acd7..c7da4a4 100644
--- a/plugins/davsyndrum.c
+++ b/plugins/davsyndrum.cc
@@ -17,6 +17,7 @@
#include "davsyndrum.h"
#include <bse/bseengine.h>
#include <bse/bsemathsignal.h>
+#include <bse/bsecxxplugin.hh>
/* --- parameters --- */
enum
@@ -33,7 +34,7 @@ enum
/* --- prototypes --- */
static void dav_syn_drum_init (DavSynDrum *drum);
-static void dav_syn_drum_class_init (DavSynDrumClass *class);
+static void dav_syn_drum_class_init (DavSynDrumClass *klass);
static void dav_syn_drum_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -49,19 +50,15 @@ static void dav_syn_drum_context_create (BseSource *source,
static void dav_syn_drum_update_modules (DavSynDrum *self,
gboolean force_trigger);
-
-/* --- Export to DAV --- */
+// == Type Registration ==
#include "./icons/drum.c"
-BSE_REGISTER_OBJECT (DavSynDrum, BseSource, "/Modules/Audio Sources/Synthetic Drum", "",
- "DavSynDrum produces synthesized drums. It accepts the drum frequency as "
- "input channel or parameter setting. Drums are triggered through a trigger "
- "parameter or via a trigger input channel which detects raising edges. "
- "The initial frequency shift is controllable through the "
- "\"Ratio In\" input channel, and adjustable through a parameter.",
- drum_icon,
- dav_syn_drum_class_init, NULL, dav_syn_drum_init);
-BSE_DEFINE_EXPORTS ();
-
+BSE_RESIDENT_TYPE_DEF (DavSynDrum, dav_syn_drum, N_("Audio Sources/Synthetic Drum"),
+ "DavSynDrum produces synthesized drums. It accepts the drum frequency as "
+ "input channel or parameter setting. Drums are triggered through a trigger "
+ "parameter or via a trigger input channel which detects raising edges. "
+ "The initial frequency shift is controllable through the "
+ "\"Ratio In\" input channel, and adjustable through a parameter.",
+ drum_icon);
/* --- variables --- */
static gpointer parent_class = NULL;
@@ -69,14 +66,14 @@ static gpointer parent_class = NULL;
/* --- functions --- */
static void
-dav_syn_drum_class_init (DavSynDrumClass *class)
+dav_syn_drum_class_init (DavSynDrumClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- BseObjectClass *object_class = BSE_OBJECT_CLASS (class);
- BseSourceClass *source_class = BSE_SOURCE_CLASS (class);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
+ BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
guint ochannel_id, ichannel_id;
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = dav_syn_drum_set_property;
gobject_class->get_property = dav_syn_drum_get_property;
@@ -146,11 +143,11 @@ dav_syn_drum_set_property (GObject *object,
{
case PROP_BASE_FREQ:
self->params.freq = sfi_value_get_real (value);
- g_object_notify (self, "base-note");
+ g_object_notify ((GObject*) self, "base-note");
break;
case PROP_BASE_NOTE:
self->params.freq = bse_note_to_freq (bse_item_current_musical_tuning (BSE_ITEM (self)), sfi_value_get_note (value));
- g_object_notify (self, "base-freq");
+ g_object_notify ((GObject*) self, "base-freq");
break;
case PROP_RATIO:
self->params.ratio = sfi_value_get_real (value);
@@ -231,7 +228,7 @@ static void
dmod_process (BseModule *module,
guint n_values)
{
- DavSynDrumModule *dmod = module->user_data;
+ DavSynDrumModule *dmod = (DavSynDrumModule*) module->user_data;
const gfloat *freq_in = BSE_MODULE_IBUFFER (module, DAV_SYN_DRUM_ICHANNEL_FREQ);
const gfloat *ratio_in = BSE_MODULE_IBUFFER (module, DAV_SYN_DRUM_ICHANNEL_RATIO);
const gfloat *trigger_in = BSE_MODULE_IBUFFER (module, DAV_SYN_DRUM_ICHANNEL_TRIGGER);
@@ -286,7 +283,7 @@ dmod_process (BseModule *module,
static void
dmod_reset (BseModule *module)
{
- DavSynDrumModule *dmod = module->user_data;
+ DavSynDrumModule *dmod = (DavSynDrumModule*) module->user_data;
/* this function is called whenever we need to start from scratch */
dmod->last_trigger_level = 0;
dmod->spring_vel = 0.0;
@@ -334,8 +331,8 @@ static void
dmod_access (BseModule *module,
gpointer data)
{
- DavSynDrumModule *dmod = module->user_data;
- DavSynDrumParams *params = data;
+ DavSynDrumModule *dmod = (DavSynDrumModule*) module->user_data;
+ DavSynDrumParams *params = (DavSynDrumParams*) data;
dmod->params = *params;
}
@@ -345,8 +342,8 @@ static void
dmod_access_trigger (BseModule *module,
gpointer data)
{
- DavSynDrumModule *dmod = module->user_data;
- DavSynDrumParams *params = data;
+ DavSynDrumModule *dmod = (DavSynDrumModule*) module->user_data;
+ DavSynDrumParams *params = (DavSynDrumParams*) data;
dmod->params = *params;
dmod_trigger (dmod, dmod->params.freq, 1.0);
diff --git a/plugins/davsyndrum.h b/plugins/davsyndrum.h
index 569b4a2..ada9b9b 100644
--- a/plugins/davsyndrum.h
+++ b/plugins/davsyndrum.h
@@ -24,7 +24,7 @@ G_BEGIN_DECLS
/* --- object type macros --- */
-#define DAV_TYPE_SYN_DRUM (BSE_EXPORT_TYPE_ID (DavSynDrum))
+#define DAV_TYPE_SYN_DRUM (dav_syn_drum_get_type())
#define DAV_SYN_DRUM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DAV_TYPE_SYN_DRUM, DavSynDrum))
#define DAV_SYN_DRUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), DAV_TYPE_SYN_DRUM, DavSynDrumClass))
#define DAV_IS_SYN_DRUM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DAV_TYPE_SYN_DRUM))
diff --git a/po/POTSCAN b/po/POTSCAN
index 4073915..a0a4728 100644
--- a/po/POTSCAN
+++ b/po/POTSCAN
@@ -134,7 +134,7 @@ plugins/davcanyondelay.cc
plugins/davchorus.idl
# plugins/davguitar.c
plugins/davorgan.idl
-plugins/davsyndrum.c
+plugins/davsyndrum.cc
plugins/davxtalstrings.c
plugins/freeverb/bsefreeverb.c
plugins/standardguspatchenvelope.idl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]