[beast/devel: 5/15] DRIVERS: compile bsemididevice-alsa and bsepcmdevice-alsa as C++



commit f9c00216274245a832d387be8c3aa2266231a6af
Author: Tim Janik <timj gnu org>
Date:   Sun Dec 16 02:08:19 2012 +0100

    DRIVERS: compile bsemididevice-alsa and bsepcmdevice-alsa as C++

 drivers/Makefile.am                                |    4 ++--
 ...{bsemididevice-alsa.c => bsemididevice-alsa.cc} |   18 +++++++++---------
 .../{bsepcmdevice-alsa.c => bsepcmdevice-alsa.cc}  |   20 ++++++++++----------
 3 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/drivers/Makefile.am b/drivers/Makefile.am
index 44f04a7..5b92725 100644
--- a/drivers/Makefile.am
+++ b/drivers/Makefile.am
@@ -15,13 +15,13 @@ drivers_libs        = $(top_builddir)/bse/libbse.la $(BSE_LIBS)
 EXTRA_DIST=
 
 # Plugin bsepcmdevice-alsa
-bsepcmdevice_alsa_la_SOURCES = bsepcmdevice-alsa.c
+bsepcmdevice_alsa_la_SOURCES = bsepcmdevice-alsa.cc
 bsepcmdevice_alsa_la_LDFLAGS = -module $(drivers_ldflags)
 bsepcmdevice_alsa_la_LIBADD  = $(drivers_libs) $(ALSA_LIBS)
 EXTRA_DIST                  += bsepcmdevice-alsa.h
 
 # Plugin bsemididevice-alsa
-bsemididevice_alsa_la_SOURCES = bsemididevice-alsa.c
+bsemididevice_alsa_la_SOURCES = bsemididevice-alsa.cc
 bsemididevice_alsa_la_LDFLAGS = -module $(drivers_ldflags)
 bsemididevice_alsa_la_LIBADD  = $(drivers_libs) $(ALSA_LIBS)
 EXTRA_DIST                   += bsemididevice-alsa.h
diff --git a/drivers/bsemididevice-alsa.c b/drivers/bsemididevice-alsa.cc
similarity index 95%
rename from drivers/bsemididevice-alsa.c
rename to drivers/bsemididevice-alsa.cc
index 4caa132..be7741b 100644
--- a/drivers/bsemididevice-alsa.c
+++ b/drivers/bsemididevice-alsa.cc
@@ -36,7 +36,7 @@ typedef struct
 } AlsaMidiHandle;
 
 /* --- prototypes --- */
-static void     bse_midi_device_alsa_class_init (BseMidiDeviceALSAClass *class);
+static void     bse_midi_device_alsa_class_init (BseMidiDeviceALSAClass *klass);
 static void     bse_midi_device_alsa_init       (BseMidiDeviceALSA      *self);
 static gboolean alsa_midi_io_handler            (gpointer                data,
                                                  guint                   n_pfds,
@@ -57,7 +57,7 @@ bse_midi_device_alsa_init (BseMidiDeviceALSA *self)
 {
 }
 
-#define alsa_alloca0(struc)     ({ struc##_t *ptr = alloca (struc##_sizeof()); memset (ptr, 0, struc##_sizeof()); ptr; })
+#define alsa_alloca0(struc)     ({ struc##_t *ptr = (struc##_t*) alloca (struc##_sizeof()); memset (ptr, 0, struc##_sizeof()); ptr; })
 
 static SfiRing*
 bse_midi_device_alsa_list_devices (BseDevice *device)
@@ -181,7 +181,7 @@ bse_midi_device_alsa_open (BseDevice     *device,
       if (!error && snd_rawmidi_params_current (alsa->read_handle, mparams) < 0)
         error = BSE_ERROR_FILE_OPEN_FAILED;
       if (0)
-        g_printerr ("midiread:  buffer=%d active_sensing=%d min_avail=%d\n",
+        g_printerr ("midiread:  buffer=%zd active_sensing=%d min_avail=%zd\n",
                     snd_rawmidi_params_get_buffer_size (mparams),
                     !snd_rawmidi_params_get_no_active_sensing (mparams),
                     snd_rawmidi_params_get_avail_min (mparams));
@@ -191,7 +191,7 @@ bse_midi_device_alsa_open (BseDevice     *device,
       if (!error && snd_rawmidi_params_current (alsa->write_handle, mparams) < 0)
         error = BSE_ERROR_FILE_OPEN_FAILED;
       if (0)
-        g_printerr ("midiwrite: buffer=%d active_sensing=%d min_avail=%d\n",
+        g_printerr ("midiwrite: buffer=%zd active_sensing=%d min_avail=%zd\n",
                     snd_rawmidi_params_get_buffer_size (mparams),
                     !snd_rawmidi_params_get_no_active_sensing (mparams),
                     snd_rawmidi_params_get_avail_min (mparams));
@@ -291,12 +291,12 @@ alsa_midi_io_handler (gpointer        data,     /* Sequencer Thread */
 }
 
 static void
-bse_midi_device_alsa_class_init (BseMidiDeviceALSAClass *class)
+bse_midi_device_alsa_class_init (BseMidiDeviceALSAClass *klass)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
-  BseDeviceClass *device_class = BSE_DEVICE_CLASS (class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
   
-  parent_class = g_type_class_peek_parent (class);
+  parent_class = g_type_class_peek_parent (klass);
   
   gobject_class->finalize = bse_midi_device_alsa_finalize;
   
@@ -317,7 +317,7 @@ bse_midi_device_alsa_class_init (BseMidiDeviceALSAClass *class)
                                          "  DEV    - the device number for plugins like 'hw'\n"
                                          "  SUBDEV - the subdevice number for plugins like 'hw'\n"),
                                        snd_asoundlib_version());
-  bse_device_class_setup (class, BSE_RATING_PREFERRED, name, syntax, info);
+  bse_device_class_setup (klass, BSE_RATING_PREFERRED, name, syntax, info);
   device_class->open = bse_midi_device_alsa_open;
   device_class->close = bse_midi_device_alsa_close;
 }
diff --git a/drivers/bsepcmdevice-alsa.c b/drivers/bsepcmdevice-alsa.cc
similarity index 97%
rename from drivers/bsepcmdevice-alsa.c
rename to drivers/bsepcmdevice-alsa.cc
index ddae337..7dee472 100644
--- a/drivers/bsepcmdevice-alsa.c
+++ b/drivers/bsepcmdevice-alsa.cc
@@ -49,7 +49,7 @@ typedef struct
 
 
 /* --- prototypes --- */
-static void             bse_pcm_device_alsa_class_init  (BsePcmDeviceALSAClass  *class);
+static void             bse_pcm_device_alsa_class_init  (BsePcmDeviceALSAClass  *klass);
 static void             bse_pcm_device_alsa_init        (BsePcmDeviceALSA       *self);
 static BseErrorType     alsa_device_setup               (AlsaPcmHandle          *alsa,
                                                          snd_pcm_t              *phandle,
@@ -82,7 +82,7 @@ bse_pcm_device_alsa_init (BsePcmDeviceALSA *self)
   const_pcm_status_sizeof = snd_pcm_status_sizeof();
 }
 
-#define alsa_alloca0(struc)     ({ struc##_t *ptr = alloca (struc##_sizeof()); memset (ptr, 0, struc##_sizeof()); ptr; })
+#define alsa_alloca0(struc)     ({ struc##_t *ptr = (struc##_t*) alloca (struc##_sizeof()); memset (ptr, 0, struc##_sizeof()); ptr; })
 
 static SfiRing*
 bse_pcm_device_alsa_list_devices (BseDevice *device)
@@ -224,7 +224,7 @@ bse_pcm_device_alsa_open (BseDevice     *device,
   /* setup PCM handle or shutdown */
   if (!error)
     {
-      alsa->period_buffer = g_malloc (alsa->period_size * alsa->frame_size);
+      alsa->period_buffer = (gint16*) g_malloc (alsa->period_size * alsa->frame_size);
       bse_device_set_opened (device, dname, handle->readable, handle->writable);
       if (handle->readable)
         handle->read = alsa_device_read;
@@ -385,7 +385,7 @@ alsa_device_retrigger (AlsaPcmHandle *alsa)
   if (alsa->write_handle)
     {
       gint n, buffer_length = alsa->n_periods * alsa->period_size; /* buffer size chosen by ALSA based on latency request */
-      guint8 *silence = g_malloc0 (buffer_length * alsa->frame_size);
+      guint8 *silence = (guint8*) g_malloc0 (buffer_length * alsa->frame_size);
       do
         n = snd_pcm_writei (alsa->write_handle, silence, buffer_length);
       while (n == -EAGAIN); /* retry on signals */
@@ -439,7 +439,7 @@ alsa_device_check_io (BsePcmHandle *handle,
     }
   
   /* check whether data can be processed */
-  if (n_frames_avail >= handle->block_length)
+  if (n_frames_avail >= ssize_t (handle->block_length))
     return TRUE;        /* need processing */
   
   /* calculate timeout until processing is possible or needed */
@@ -545,12 +545,12 @@ alsa_device_write (BsePcmHandle *handle,
 }
 
 static void
-bse_pcm_device_alsa_class_init (BsePcmDeviceALSAClass *class)
+bse_pcm_device_alsa_class_init (BsePcmDeviceALSAClass *klass)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
-  BseDeviceClass *device_class = BSE_DEVICE_CLASS (class);
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  BseDeviceClass *device_class = BSE_DEVICE_CLASS (klass);
   
-  parent_class = g_type_class_peek_parent (class);
+  parent_class = g_type_class_peek_parent (klass);
   
   gobject_class->finalize = bse_pcm_device_alsa_finalize;
   
@@ -571,7 +571,7 @@ bse_pcm_device_alsa_class_init (BsePcmDeviceALSAClass *class)
                                          "  DEV    - the device number for plugins like 'hw'\n"
                                          "  SUBDEV - the subdevice number for plugins like 'hw'\n"),
                                        snd_asoundlib_version());
-  bse_device_class_setup (class, BSE_RATING_PREFERRED, name, syntax, info);
+  bse_device_class_setup (klass, BSE_RATING_PREFERRED, name, syntax, info);
   device_class->open = bse_pcm_device_alsa_open;
   device_class->close = bse_pcm_device_alsa_close;
   int err = snd_output_stdio_attach (&snd_output, stderr, 0);



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