[beast/devel: 8/26] PLUGINS: compile BseAtanDistort as C++ resident type



commit 84e565d3fd03aa8be4e4771e7f049079f5b7a809
Author: Tim Janik <timj gnu org>
Date:   Mon Dec 17 20:29:40 2012 +0100

    PLUGINS: compile BseAtanDistort as C++ resident type

 plugins/Makefile.am                             |    5 +--
 plugins/Makefile.plugins                        |   15 -----------
 plugins/{bseatandistort.c => bseatandistort.cc} |   30 ++++++++++-------------
 plugins/bseatandistort.h                        |    2 +-
 4 files changed, 16 insertions(+), 36 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 06c6fce..92d2ea2 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
-cxx_plugin_sources = bseadder.cc
+cxx_plugin_headers = bseadder.h bseatandistort.h
+cxx_plugin_sources = bseadder.cc bseatandistort.cc
 EXTRA_HEADERS	  += $(cxx_plugin_headers)
 cxxplugins_FPU_la_SOURCES  = $(cxx_plugin_sources)
 cxxplugins_FPU_la_LDFLAGS  = -module $(plugins_ldflags)
@@ -56,7 +56,6 @@ UNPORTED = $(strip		\
 )
 cglob_plugins = $(strip		\
 	bsesimpleadsr.[hc]	\
-	bseatandistort.[hc]	\
 	bseiirfilter.[hc]	\
 	bsemixer.[hc]		\
 	bsemult.[hc]		\
diff --git a/plugins/Makefile.plugins b/plugins/Makefile.plugins
index d193a5b..fb5cb3b 100644
--- a/plugins/Makefile.plugins
+++ b/plugins/Makefile.plugins
@@ -128,21 +128,6 @@ bsesimpleadsr_SSE_la_LIBADD    = $(bsesimpleadsr_FPU_la_LIBADD)
 bsesimpleadsr_SSE_la_CFLAGS    = $(SSE_PLUGIN_CFLAGS)
 
 
-## C Plugin bseatandistort
-EXTRA_HEADERS      += bseatandistort.h
-$(srcdir)/bseatandistort.c: bseatandistort.h
-plugin_FPU_ltlibs += bseatandistort.FPU.la
-bseatandistort_FPU_la_SOURCES = bseatandistort.c
-bseatandistort_FPU_la_LDFLAGS = -module $(plugins_ldflags)
-bseatandistort_FPU_la_LIBADD  = $(plugins_libs)
-bseatandistort_FPU_la_CFLAGS    = $(FPU_PLUGIN_CFLAGS)
-plugin_SSE_ltlibs   += bseatandistort.SSE.la
-bseatandistort_SSE_la_SOURCES   = $(bseatandistort_FPU_la_SOURCES)
-bseatandistort_SSE_la_LDFLAGS   = $(bseatandistort_FPU_la_LDFLAGS)
-bseatandistort_SSE_la_LIBADD    = $(bseatandistort_FPU_la_LIBADD)
-bseatandistort_SSE_la_CFLAGS    = $(SSE_PLUGIN_CFLAGS)
-
-
 ## C Plugin bseiirfilter
 EXTRA_HEADERS      += bseiirfilter.h
 $(srcdir)/bseiirfilter.c: bseiirfilter.h
diff --git a/plugins/bseatandistort.c b/plugins/bseatandistort.cc
similarity index 89%
rename from plugins/bseatandistort.c
rename to plugins/bseatandistort.cc
index b6d6036..4fbd16e 100644
--- a/plugins/bseatandistort.c
+++ b/plugins/bseatandistort.cc
@@ -15,9 +15,9 @@
  * with this library; if not, see http://www.gnu.org/copyleft/.
  */
 #include "bseatandistort.h"
-
 #include <bse/bseengine.h>
 #include <bse/bsemathsignal.h>
+#include <bse/bsecxxplugin.hh>
 
 
 /* --- parameters --- */
@@ -30,7 +30,7 @@ enum
 
 /* --- prototypes --- */
 static void	 bse_atan_distort_init		      (BseAtanDistort		*self);
-static void	 bse_atan_distort_class_init	      (BseAtanDistortClass	*class);
+static void	 bse_atan_distort_class_init	      (BseAtanDistortClass	*klass);
 static void	 bse_atan_distort_set_property	      (GObject			*object,
 						       guint                     param_id,
 						       const GValue             *value,
@@ -47,15 +47,11 @@ static void	 bse_atan_distort_update_modules      (BseAtanDistort		*comp);
 
 /* --- Export to BSE --- */
 #include "./icons/atan.c"
-BSE_REGISTER_OBJECT (BseAtanDistort, BseSource, "/Modules/Distortion/Atan Distort", "",
-                     "BseAtanDistort compresses or expands the input signal with distortion "
-                     "(in a manner similar to the atan(3) mathematical function, thus it's name). "
-                     "The strength with which the input signal is treated is adjustable from "
-                     "maximum attenuation to maximum boost.",
-                     atan_icon,
-                     bse_atan_distort_class_init, NULL, bse_atan_distort_init);
-BSE_DEFINE_EXPORTS ();
-
+BSE_RESIDENT_TYPE_DEF (BseAtanDistort, bse_atan_distort, "Distortion/Atan Distort",
+                       "BseAtanDistort compresses or expands the input signal with distortion "
+                       "(in a manner similar to the atan(3) mathematical function, thus it's name). "
+                       "The strength with which the input signal is treated is adjustable from "
+                       "maximum attenuation to maximum boost.", atan_icon);
 
 /* --- variables --- */
 static gpointer	       parent_class = NULL;
@@ -63,14 +59,14 @@ static gpointer	       parent_class = NULL;
 
 /* --- functions --- */
 static void
-bse_atan_distort_class_init (BseAtanDistortClass *class)
+bse_atan_distort_class_init (BseAtanDistortClass *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 channel_id;
   
-  parent_class = g_type_class_peek_parent (class);
+  parent_class = g_type_class_peek_parent (klass);
   
   gobject_class->set_property = bse_atan_distort_set_property;
   gobject_class->get_property = bse_atan_distort_get_property;
@@ -172,7 +168,7 @@ static void
 atan_distort_process (BseModule *module,
 		      guint      n_values)
 {
-  AtanDistortModule *admod = module->user_data;
+  AtanDistortModule *admod = (AtanDistortModule*) module->user_data;
   const gfloat *sig_in = module->istreams[BSE_ATAN_DISTORT_ICHANNEL_MONO1].values;
   gfloat *sig_out = module->ostreams[BSE_ATAN_DISTORT_OCHANNEL_MONO1].values;
   gfloat *bound = sig_out + n_values;
diff --git a/plugins/bseatandistort.h b/plugins/bseatandistort.h
index 76b5e2c..7e89e01 100644
--- a/plugins/bseatandistort.h
+++ b/plugins/bseatandistort.h
@@ -26,7 +26,7 @@ extern "C" {
 
 
 /* --- object type macros --- */
-#define BSE_TYPE_ATAN_DISTORT              (BSE_EXPORT_TYPE_ID (BseAtanDistort))
+#define BSE_TYPE_ATAN_DISTORT              (bse_atan_distort_get_type())
 #define BSE_ATAN_DISTORT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_ATAN_DISTORT, BseAtanDistort))
 #define BSE_ATAN_DISTORT_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_ATAN_DISTORT, BseAtanDistortClass))
 #define BSE_IS_ATAN_DISTORT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_ATAN_DISTORT))



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