[beast/devel: 24/26] DRIVERS: compile bsemididevice-alsa and bsepcmdevice-alsa as resident types



commit cadec9f8ca19b635b69b06b6a2ce2ad360ddd761
Author: Tim Janik <timj gnu org>
Date:   Tue Dec 18 03:32:45 2012 +0100

    DRIVERS: compile bsemididevice-alsa and bsepcmdevice-alsa as resident types

 bse/bsecxxplugin.hh           |    9 ++++++---
 drivers/bsemididevice-alsa.cc |   10 +++++-----
 drivers/bsemididevice-alsa.h  |    2 +-
 drivers/bsepcmdevice-alsa.cc  |   10 +++++-----
 drivers/bsepcmdevice-alsa.h   |    2 +-
 5 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/bse/bsecxxplugin.hh b/bse/bsecxxplugin.hh
index bcbf403..5849312 100644
--- a/bse/bsecxxplugin.hh
+++ b/bse/bsecxxplugin.hh
@@ -49,7 +49,7 @@ extern ::BseExportIdentity bse_builtin_export_identity; /* sync with bseplugin.h
 #endif
 
 // == Resident Type Plugin Registration ==
-#define BSE_RESIDENT_SOURCE_DEF(Object, func, category, blurb, icon)    \
+#define BSE_RESIDENT_TYPE_DEF(Object, func, anc, category, blurb, icon) \
   static GType func##_get_type () {                                     \
     static const GTypeInfo type_info = {                                \
       sizeof (Object##Class),                                           \
@@ -65,8 +65,9 @@ extern ::BseExportIdentity bse_builtin_export_identity; /* sync with bseplugin.h
     static GType type_id = 0;                                           \
     if (!type_id)                                                       \
       {                                                                 \
-        type_id = bse_type_register_static (BSE_TYPE_SOURCE,  # Object , blurb, __FILE__, __LINE__, &type_info); \
-        bse_categories_register_stock_module (N_(category), type_id, icon); \
+        type_id = bse_type_register_static (anc,  # Object , blurb, __FILE__, __LINE__, &type_info); \
+        if (category)                                                   \
+          bse_categories_register_stock_module (category, type_id, icon); \
       }                                                                 \
     return type_id;                                                     \
   }                                                                     \
@@ -74,6 +75,8 @@ extern ::BseExportIdentity bse_builtin_export_identity; /* sync with bseplugin.h
     bse_plugin_make_resident();                                         \
     (void) (volatile GType) func##_get_type();                          \
   } static Sfi::Init func##__onload_ (func##__onload);
+#define BSE_RESIDENT_SOURCE_DEF(Object, func, category, blurb, icon)    \
+  BSE_RESIDENT_TYPE_DEF(Object, func, BSE_TYPE_SOURCE, category, blurb, icon)
 
 /* --- hook registration --- */
 /* hook registration is based on a static ExportTypeKeeper
diff --git a/drivers/bsemididevice-alsa.cc b/drivers/bsemididevice-alsa.cc
index be7741b..5eea76d 100644
--- a/drivers/bsemididevice-alsa.cc
+++ b/drivers/bsemididevice-alsa.cc
@@ -15,6 +15,7 @@
  * with this library; if not, see http://www.gnu.org/copyleft/.
  */
 #include "configure.h"
+#include <bse/bsecxxplugin.hh>
 #include "bsemididevice-alsa.h"
 #include <bse/bsesequencer.h>
 #include <bse/bsemididecoder.h>
@@ -42,11 +43,10 @@ static gboolean alsa_midi_io_handler            (gpointer                data,
                                                  guint                   n_pfds,
                                                  GPollFD                *pfds);
 
-/* --- define object type and export to BSE --- */
-static const char type_blurb[] = ("MIDI driver implementation for the Advanced Linux Sound Architecture "
-                                  "(http://alsa-project.org/alsa-doc/alsa-lib/midi.html)");
-BSE_REGISTER_OBJECT (BseMidiDeviceALSA, BseMidiDevice, NULL, "", type_blurb, NULL, bse_midi_device_alsa_class_init, NULL, bse_midi_device_alsa_init);
-BSE_DEFINE_EXPORTS ();
+// == Type Registration ==
+BSE_RESIDENT_TYPE_DEF (BseMidiDeviceALSA, bse_midi_device_alsa, BSE_TYPE_MIDI_DEVICE, NULL,
+                       "MIDI driver implementation for the Advanced Linux Sound Architecture "
+                       "(http://alsa-project.org/alsa-doc/alsa-lib/midi.html)", NULL);
 
 /* --- variables --- */
 static gpointer parent_class = NULL;
diff --git a/drivers/bsemididevice-alsa.h b/drivers/bsemididevice-alsa.h
index 256d52f..72cf477 100644
--- a/drivers/bsemididevice-alsa.h
+++ b/drivers/bsemididevice-alsa.h
@@ -23,7 +23,7 @@
 G_BEGIN_DECLS
 
 /* --- object type macros --- */
-#define BSE_TYPE_MIDI_DEVICE_ALSA              (BSE_EXPORT_TYPE_ID (BseMidiDeviceALSA))
+#define BSE_TYPE_MIDI_DEVICE_ALSA              (bse_midi_device_alsa_get_type())
 #define BSE_MIDI_DEVICE_ALSA(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_MIDI_DEVICE_ALSA, BseMidiDeviceALSA))
 #define BSE_MIDI_DEVICE_ALSA_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_MIDI_DEVICE_ALSA, BseMidiDeviceALSAClass))
 #define BSE_IS_MIDI_DEVICE_ALSA(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_MIDI_DEVICE_ALSA))
diff --git a/drivers/bsepcmdevice-alsa.cc b/drivers/bsepcmdevice-alsa.cc
index 7dee472..2d7d66b 100644
--- a/drivers/bsepcmdevice-alsa.cc
+++ b/drivers/bsepcmdevice-alsa.cc
@@ -15,6 +15,7 @@
  * with this library; if not, see http://www.gnu.org/copyleft/.
  */
 #include "configure.h"
+#include <bse/bsecxxplugin.hh>
 #include "bsepcmdevice-alsa.h"
 #include <bse/gsldatautils.h>
 #include <alsa/asoundlib.h>
@@ -65,11 +66,10 @@ static gboolean         alsa_device_check_io            (BsePcmHandle
                                                          glong                  *tiumeoutp);
 static guint            alsa_device_latency             (BsePcmHandle           *handle);
 
-/* --- define object type and export to BSE --- */
-static const char type_blurb[] = ("PCM driver implementation for the Advanced Linux Sound Architecture "
-                                  "(http://alsa-project.org/alsa-doc/alsa-lib/pcm.html)");
-BSE_REGISTER_OBJECT (BsePcmDeviceALSA, BsePcmDevice, NULL, "", type_blurb, NULL, bse_pcm_device_alsa_class_init, NULL, bse_pcm_device_alsa_init);
-BSE_DEFINE_EXPORTS ();
+// == Type Registration ==
+BSE_RESIDENT_TYPE_DEF (BsePcmDeviceALSA, bse_pcm_device_alsa, BSE_TYPE_PCM_DEVICE, NULL,
+                       "PCM driver implementation for the Advanced Linux Sound Architecture "
+                       "(http://alsa-project.org/alsa-doc/alsa-lib/pcm.html)", NULL);
 
 /* --- variables --- */
 static gpointer parent_class = NULL;
diff --git a/drivers/bsepcmdevice-alsa.h b/drivers/bsepcmdevice-alsa.h
index ff41193..3939013 100644
--- a/drivers/bsepcmdevice-alsa.h
+++ b/drivers/bsepcmdevice-alsa.h
@@ -23,7 +23,7 @@
 G_BEGIN_DECLS
 
 /* --- object type macros --- */
-#define BSE_TYPE_PCM_DEVICE_ALSA              (BSE_EXPORT_TYPE_ID (BsePcmDeviceALSA))
+#define BSE_TYPE_PCM_DEVICE_ALSA              (bse_pcm_device_alsa_get_type())
 #define BSE_PCM_DEVICE_ALSA(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_PCM_DEVICE_ALSA, BsePcmDeviceALSA))
 #define BSE_PCM_DEVICE_ALSA_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_PCM_DEVICE_ALSA, BsePcmDeviceALSAClass))
 #define BSE_IS_PCM_DEVICE_ALSA(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_PCM_DEVICE_ALSA))



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