[beast/devel: 10/26] PLUGINS: compile BseMixer as C++ resident type



commit 3a2960a59984fa61666c2ad547b16dfd9e206ecb
Author: Tim Janik <timj gnu org>
Date:   Tue Dec 18 01:59:33 2012 +0100

    PLUGINS: compile BseMixer as C++ resident type

 plugins/Makefile.am                 |    5 +--
 plugins/Makefile.plugins            |   15 ----------
 plugins/{bsemixer.c => bsemixer.cc} |   51 +++++++++++++++++------------------
 plugins/bsemixer.h                  |    2 +-
 4 files changed, 28 insertions(+), 45 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index df79124..b1355cc 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -35,8 +35,8 @@ SFIDL_INC = --nostdinc -I$(top_srcdir) -I$(top_builddir)
 	$(SFIDL) --plugin  --macro $(<F) $(SFIDL_INC) -I$(top_builddir) $< > $@ || (rm $@ ; exit 1 )
 
 # == C++ Plugins ==
-cxx_plugin_headers = bseadder.h  bseatandistort.h  bsesimpleadsr.h
-cxx_plugin_sources = bseadder.cc bseatandistort.cc bsesimpleadsr.cc
+cxx_plugin_headers = bseadder.h  bseatandistort.h  bsesimpleadsr.h  bsemixer.h
+cxx_plugin_sources = bseadder.cc bseatandistort.cc bsesimpleadsr.cc bsemixer.cc
 cxx_plugin_extra   = bsesimpleadsr-aux.cc
 EXTRA_DIST        += $(cxx_plugin_headers) $(cxx_plugin_extra)
 cxxplugins_FPU_la_SOURCES  = $(cxx_plugin_sources)
@@ -57,7 +57,6 @@ UNPORTED = $(strip		\
 )
 cglob_plugins = $(strip		\
 	bseiirfilter.[hc]	\
-	bsemixer.[hc]		\
 	bsemult.[hc]		\
 	bsesequencer.[hc]	\
 	davxtalstrings.[hc]	\
diff --git a/plugins/Makefile.plugins b/plugins/Makefile.plugins
index 8339bbf..49aca8b 100644
--- a/plugins/Makefile.plugins
+++ b/plugins/Makefile.plugins
@@ -128,21 +128,6 @@ bseiirfilter_SSE_la_LIBADD    = $(bseiirfilter_FPU_la_LIBADD)
 bseiirfilter_SSE_la_CFLAGS    = $(SSE_PLUGIN_CFLAGS)
 
 
-## C Plugin bsemixer
-EXTRA_HEADERS      += bsemixer.h
-$(srcdir)/bsemixer.c: bsemixer.h
-plugin_FPU_ltlibs += bsemixer.FPU.la
-bsemixer_FPU_la_SOURCES = bsemixer.c
-bsemixer_FPU_la_LDFLAGS = -module $(plugins_ldflags)
-bsemixer_FPU_la_LIBADD  = $(plugins_libs)
-bsemixer_FPU_la_CFLAGS    = $(FPU_PLUGIN_CFLAGS)
-plugin_SSE_ltlibs   += bsemixer.SSE.la
-bsemixer_SSE_la_SOURCES   = $(bsemixer_FPU_la_SOURCES)
-bsemixer_SSE_la_LDFLAGS   = $(bsemixer_FPU_la_LDFLAGS)
-bsemixer_SSE_la_LIBADD    = $(bsemixer_FPU_la_LIBADD)
-bsemixer_SSE_la_CFLAGS    = $(SSE_PLUGIN_CFLAGS)
-
-
 ## C Plugin bsemult
 EXTRA_HEADERS      += bsemult.h
 $(srcdir)/bsemult.c: bsemult.h
diff --git a/plugins/bsemixer.c b/plugins/bsemixer.cc
similarity index 88%
rename from plugins/bsemixer.c
rename to plugins/bsemixer.cc
index 8eb3ab4..7530d19 100644
--- a/plugins/bsemixer.c
+++ b/plugins/bsemixer.cc
@@ -17,6 +17,7 @@
 #include "bsemixer.h"
 
 #include <bse/bseengine.h>
+#include <bse/bsecxxplugin.hh>
 
 #include <string.h>
 
@@ -38,7 +39,7 @@ enum
 
 /* --- prototypes --- */
 static void	 bse_mixer_init			(BseMixer	*self);
-static void	 bse_mixer_class_init		(BseMixerClass	*class);
+static void	 bse_mixer_class_init		(BseMixerClass	*klass);
 static void	 bse_mixer_set_property		(GObject	*object,
 						 guint           param_id,
 						 const GValue   *value,
@@ -54,14 +55,12 @@ static void	 bse_mixer_update_modules	(BseMixer	*self,
 						 BseTrans       *trans);
 
 
-/* --- Export to BSE --- */
+// == Type Registration ==
 #include "./icons/mixer.c"
-BSE_REGISTER_OBJECT (BseMixer, BseSource, "/Modules/Routing/Mixer", "",
-                     "The Mixer module sums up incomming signals, and allowes for fine "
-                     "adjusted weighting (volume setting) of the input sources",
-                     mixer_icon,
-                     bse_mixer_class_init, NULL, bse_mixer_init);
-BSE_DEFINE_EXPORTS ();
+BSE_RESIDENT_TYPE_DEF (BseMixer, bse_mixer, N_("Routing/Mixer"),
+                       "The Mixer module sums up incomming signals, and allowes for fine "
+                       "adjusted weighting (volume setting) of the input sources",
+                       mixer_icon);
 
 
 /* --- variables --- */
@@ -70,15 +69,15 @@ static gpointer		 parent_class = NULL;
 
 /* --- functions --- */
 static void
-bse_mixer_class_init (BseMixerClass *class)
+bse_mixer_class_init (BseMixerClass *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 ichannel, ochannel;
   guint i;
   
-  parent_class = g_type_class_peek_parent (class);
+  parent_class = g_type_class_peek_parent (klass);
   
   gobject_class->set_property = bse_mixer_set_property;
   gobject_class->get_property = bse_mixer_get_property;
@@ -178,20 +177,20 @@ bse_mixer_set_property (GObject      *object,
     case PROP_MVOLUME_f:
       self->master_volume_factor = sfi_value_get_real (value);
       bse_mixer_update_modules (self, NULL);
-      g_object_notify (object, "master_volume_dB");
-      g_object_notify (object, "master_volume_perc");
+      g_object_notify ((GObject*) object, "master_volume_dB");
+      g_object_notify ((GObject*) object, "master_volume_perc");
       break;
     case PROP_MVOLUME_dB:
       self->master_volume_factor = bse_db_to_factor (sfi_value_get_real (value));
       bse_mixer_update_modules (self, NULL);
-      g_object_notify (object, "master_volume_f");
-      g_object_notify (object, "master_volume_perc");
+      g_object_notify ((GObject*) object, "master_volume_f");
+      g_object_notify ((GObject*) object, "master_volume_perc");
       break;
     case PROP_MVOLUME_PERC:
       self->master_volume_factor = sfi_value_get_int (value) / 100.0;
       bse_mixer_update_modules (self, NULL);
-      g_object_notify (object, "master_volume_f");
-      g_object_notify (object, "master_volume_dB");
+      g_object_notify ((GObject*) object, "master_volume_f");
+      g_object_notify ((GObject*) object, "master_volume_dB");
       break;
     default:
       indx = (param_id - PROP_NTH_VOLUME_f) % 3;
@@ -203,30 +202,30 @@ bse_mixer_set_property (GObject      *object,
 	  self->volume_factors[n] = sfi_value_get_real (value);
 	  bse_mixer_update_modules (self, NULL);
 	  prop = g_strdup_printf ("volume_dB%u", n + 1);
-	  g_object_notify (object, prop);
+	  g_object_notify ((GObject*) object, prop);
 	  g_free (prop);
           prop = g_strdup_printf ("volume_perc%u", n + 1);
-	  g_object_notify (object, prop);
+	  g_object_notify ((GObject*) object, prop);
 	  g_free (prop);
 	  break;
 	case PROP_NTH_VOLUME_dB - PROP_NTH_VOLUME_f:
 	  self->volume_factors[n] = bse_db_to_factor (sfi_value_get_real (value));
 	  bse_mixer_update_modules (self, NULL);
 	  prop = g_strdup_printf ("volume_f%u", n + 1);
-	  g_object_notify (object, prop);
+	  g_object_notify ((GObject*) object, prop);
 	  g_free (prop);
           prop = g_strdup_printf ("volume_perc%u", n + 1);
-	  g_object_notify (object, prop);
+	  g_object_notify ((GObject*) object, prop);
 	  g_free (prop);
 	  break;
 	case PROP_NTH_VOLUME_PERC - PROP_NTH_VOLUME_f:
 	  self->volume_factors[n] = sfi_value_get_int (value) / 100.0;
 	  bse_mixer_update_modules (self, NULL);
 	  prop = g_strdup_printf ("volume_f%u", n + 1);
-	  g_object_notify (object, prop);
+	  g_object_notify ((GObject*) object, prop);
 	  g_free (prop);
 	  prop = g_strdup_printf ("volume_dB%u", n + 1);
-	  g_object_notify (object, prop);
+	  g_object_notify ((GObject*) object, prop);
 	  g_free (prop);
 	  break;
 	default:
@@ -303,7 +302,7 @@ static void
 mixer_process (BseModule *module,
 	       guint      n_values)
 {
-  Mixer *mixer = module->user_data;
+  Mixer *mixer = (Mixer*) module->user_data;
   gfloat *wave_out = BSE_MODULE_OBUFFER (module, 0);
   gfloat *wave_bound = wave_out + n_values;
   
diff --git a/plugins/bsemixer.h b/plugins/bsemixer.h
index a67f0ba..921ea09 100644
--- a/plugins/bsemixer.h
+++ b/plugins/bsemixer.h
@@ -28,7 +28,7 @@ extern "C" {
 
 
 /* --- object type macros --- */
-#define BSE_TYPE_MIXER              (BSE_EXPORT_TYPE_ID (BseMixer))
+#define BSE_TYPE_MIXER              (bse_mixer_get_type())
 #define BSE_MIXER(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_MIXER, BseMixer))
 #define BSE_MIXER_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_MIXER, BseMixerClass))
 #define BSE_IS_MIXER(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_MIXER))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]