[beast/devel: 11/15] BSE: compile bsemidinotifier, bsemidisynth and bsemidivoice.c as C++



commit ba394fd6fb5fe8c83bb689375050a6eb1d9a5c5b
Author: Tim Janik <timj gnu org>
Date:   Mon Dec 17 02:16:57 2012 +0100

    BSE: compile bsemidinotifier, bsemidisynth and bsemidivoice.c as C++

 bse/Makefile.am                               |    6 +-
 bse/{bsemidinotifier.c => bsemidinotifier.cc} |   14 +++---
 bse/{bsemidisynth.c => bsemidisynth.cc}       |   58 +++++++++++-------------
 bse/{bsemidivoice.c => bsemidivoice.cc}       |    6 +-
 po/POTSCAN                                    |    4 +-
 5 files changed, 43 insertions(+), 45 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 81e8d77..c6f108f 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -74,8 +74,8 @@ bse_sources = $(strip \
 	bseglobals.cc		bseglue.cc		bseitem.cc			bsejanitor.cc \
 	bsemain.cc		bsemath.cc		bsemathsignal.cc		bseladspa.cc \
 	bsemidicontroller.cc	bsemididevice.cc 	bsedevice.cc 			\
-	bsemididevice-null.cc	bsemididevice-oss.cc	bsemidievent.cc			bsemidinotifier.c \
-	bsemidireceiver.cc	bsemidisynth.c		bseobject.cc			bsepart.cc \
+	bsemididevice-null.cc	bsemididevice-oss.cc	bsemidievent.cc			bsemidinotifier.cc \
+	bsemidireceiver.cc	bsemidisynth.cc		bseobject.cc			bsepart.cc \
 	bsepcminput.cc		bsepcmoutput.cc		bseparam.cc			bseparasite.cc \
 	bsepcmdevice.cc		bsepcmdevice-oss.cc	bsepcmdevice-null.cc		bseplugin.cc \
 	bseprocedure.cc		bseproject.cc		bsescripthelper.cc		bseserver.cc \
@@ -83,7 +83,7 @@ bse_sources = $(strip \
 	bsesource.cc		bsestandardosc.cc	bsestandardsynths.cc		bsestorage.cc \
 	bseinstrumentoutput.cc	bsesubiport.cc		bseinstrumentinput.cc		bsesuboport.cc \
 	bsesubsynth.cc		bsesuper.cc		bsetrack.cc			bsetype.cc \
-	bseutils.cc		bsemidivoice.c		bsewave.cc			bsewaveosc.cc \
+	bseutils.cc		bsemidivoice.cc		bsewave.cc			bsewaveosc.cc \
 	bsecsynth.cc		bsewaverepo.cc		bseladspamodule.cc		bsepcmwriter.cc \
 	bsecompat.cc		bseundostack.cc		bsemidiinput.cc			bsemididecoder.cc \
 	bsenote.cc		bsemidifile.cc		bseblockutils.cc		\
diff --git a/bse/bsemidinotifier.c b/bse/bsemidinotifier.cc
similarity index 93%
rename from bse/bsemidinotifier.c
rename to bse/bsemidinotifier.cc
index f47c97f..b95b7a3 100644
--- a/bse/bsemidinotifier.c
+++ b/bse/bsemidinotifier.cc
@@ -15,9 +15,9 @@
  * with this library; if not, see http://www.gnu.org/copyleft/.
  */
 #include "bsemidinotifier.h"
-
 #include "bsemain.h"
 #include "gslcommon.h"
+#include "bsecxxplugin.hh"
 
 
 /* --- prototypes --- */
@@ -114,7 +114,7 @@ static inline void
 bse_midi_notifier_notify_event (BseMidiNotifier *self,
                                 BseMidiEvent    *event)
 {
-  BseMidiChannelEvent cev = { 0, };
+  BseMidiChannelEvent cev = { BseMidiChannelEventType (0), };
   switch (event->status)
     {
       /* channel voice messages */
@@ -208,10 +208,12 @@ bse_midi_notifier_dispatch (BseMidiNotifier *self)
   SfiRing *ring = bse_midi_receiver_fetch_notify_events (self->midi_receiver);
   if (!ring)
     return;
-  guint need_emission = g_signal_handler_find (self, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_UNBLOCKED, signal_midi_event, 0, NULL, NULL, NULL);
+  uint need_emission = g_signal_handler_find (self,
+                                              GSignalMatchType (G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_UNBLOCKED),
+                                              signal_midi_event, 0, NULL, NULL, NULL);
   while (ring)
     {
-      BseMidiEvent *event = sfi_ring_pop_head (&ring);
+      BseMidiEvent *event = (BseMidiEvent*) sfi_ring_pop_head (&ring);
       if (event->channel < BSE_MIDI_MAX_CHANNELS && need_emission)
         bse_midi_notifier_notify_event (self, event);
       bse_midi_free_event (event);
@@ -224,7 +226,7 @@ midi_notifiers_need_dispatch (void)
   SfiRing *ring;
   for (ring = midi_notifier_list; ring; ring = sfi_ring_walk (ring, midi_notifier_list))
     {
-      BseMidiNotifier *notifier = ring->data;
+      BseMidiNotifier *notifier = (BseMidiNotifier*) ring->data;
       if (notifier->midi_receiver && bse_midi_receiver_has_notify_events (notifier->midi_receiver))
         return TRUE;
     }
@@ -259,7 +261,7 @@ midi_notifiers_source_dispatch (GSource    *source,
   SfiRing *ring = midi_notifier_list;
   while (ring)
     {
-      BseMidiNotifier *notifier = ring->data;
+      BseMidiNotifier *notifier = (BseMidiNotifier*) ring->data;
       ring = sfi_ring_walk (ring, midi_notifier_list);
       bse_midi_notifier_dispatch (notifier);
     }
diff --git a/bse/bsemidisynth.c b/bse/bsemidisynth.cc
similarity index 89%
rename from bse/bsemidisynth.c
rename to bse/bsemidisynth.cc
index c6ac69e..4aaceb3 100644
--- a/bse/bsemidisynth.c
+++ b/bse/bsemidisynth.cc
@@ -108,14 +108,14 @@ bse_midi_synth_init (BseMidiSynth *self)
   self->volume_factor = bse_db_to_factor (0);
   
   /* midi voice modules */
-  self->voice_input = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_MIDI_VOICE_INPUT, NULL);
+  self->voice_input = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_MIDI_VOICE_INPUT, NULL);
   bse_snet_intern_child (snet, self->voice_input);
-  self->voice_switch = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_MIDI_VOICE_SWITCH, NULL);
+  self->voice_switch = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_MIDI_VOICE_SWITCH, NULL);
   bse_snet_intern_child (snet, self->voice_switch);
   bse_midi_voice_input_set_voice_switch (BSE_MIDI_VOICE_INPUT (self->voice_input), BSE_MIDI_VOICE_SWITCH (self->voice_switch));
   
   /* context merger */
-  self->context_merger = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_CONTEXT_MERGER, NULL);
+  self->context_merger = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_CONTEXT_MERGER, NULL);
   bse_snet_intern_child (snet, self->context_merger);
   
   /* midi voice switch <-> context merger */
@@ -125,9 +125,7 @@ bse_midi_synth_init (BseMidiSynth *self)
                              self->voice_switch, BSE_MIDI_VOICE_SWITCH_OCHANNEL_RIGHT);
 
   /* post processing slot */
-  self->postprocess = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_SUB_SYNTH,
-                                               "uname", "Postprocess",
-                                               NULL);
+  self->postprocess = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_SUB_SYNTH, "uname", "Postprocess", NULL);
   bse_snet_intern_child (snet, self->postprocess);
   bse_sub_synth_set_null_shortcut (BSE_SUB_SYNTH (self->postprocess), TRUE);
 
@@ -138,7 +136,7 @@ bse_midi_synth_init (BseMidiSynth *self)
                              self->context_merger, 1);
 
   /* output */
-  self->output = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_PCM_OUTPUT, NULL);
+  self->output = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_PCM_OUTPUT, NULL);
   bse_snet_intern_child (snet, self->output);
   
   /* postprocess <-> output */
@@ -148,16 +146,16 @@ bse_midi_synth_init (BseMidiSynth *self)
                              self->postprocess, 1);
   
   /* sub synth */
-  self->sub_synth = bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_SUB_SYNTH,
-                                             "in_port_1", "frequency",
-                                             "in_port_2", "gate",
-                                             "in_port_3", "velocity",
-                                             "in_port_4", "aftertouch",
-                                             "out_port_1", "left-audio",
-                                             "out_port_2", "right-audio",
-                                             "out_port_3", "unused",
-                                             "out_port_4", "synth-done",
-                                             NULL);
+  self->sub_synth = (BseSource*) bse_container_new_child (BSE_CONTAINER (self), BSE_TYPE_SUB_SYNTH,
+                                                          "in_port_1", "frequency",
+                                                          "in_port_2", "gate",
+                                                          "in_port_3", "velocity",
+                                                          "in_port_4", "aftertouch",
+                                                          "out_port_1", "left-audio",
+                                                          "out_port_2", "right-audio",
+                                                          "out_port_3", "unused",
+                                                          "out_port_4", "synth-done",
+                                                          NULL);
   bse_snet_intern_child (snet, self->sub_synth);
 
   /* voice input <-> sub-synth */
@@ -271,7 +269,7 @@ bse_midi_synth_set_property (GObject      *object,
               bse_item_cross_unlink (BSE_ITEM (self), BSE_ITEM (self->snet), midi_synth_uncross_snet);
               self->snet = NULL;
             }
-          self->snet = bse_value_get_object (value);
+          self->snet = (BseSNet*) bse_value_get_object (value);
           if (self->snet)
             {
               bse_item_cross_link (BSE_ITEM (self), BSE_ITEM (self->snet), midi_synth_uncross_snet);
@@ -291,7 +289,7 @@ bse_midi_synth_set_property (GObject      *object,
               bse_item_cross_unlink (BSE_ITEM (self), BSE_ITEM (self->pnet), midi_synth_uncross_pnet);
               self->pnet = NULL;
             }
-          self->pnet = bse_value_get_object (value);
+          self->pnet = (BseSNet*) bse_value_get_object (value);
           if (self->pnet)
             {
               bse_item_cross_link (BSE_ITEM (self), BSE_ITEM (self->pnet), midi_synth_uncross_pnet);
@@ -319,24 +317,24 @@ bse_midi_synth_set_property (GObject      *object,
       g_object_set (self->output, /* no undo */
                     "master_volume_f", self->volume_factor,
                     NULL);
-      g_object_notify (self, "volume_dB");
-      g_object_notify (self, "volume_perc");
+      g_object_notify ((GObject*) self, "volume_dB");
+      g_object_notify ((GObject*) self, "volume_perc");
       break;
     case PROP_VOLUME_dB:
       self->volume_factor = bse_db_to_factor (sfi_value_get_real (value));
       g_object_set (self->output, /* no undo */
                     "master_volume_f", self->volume_factor,
                     NULL);
-      g_object_notify (self, "volume_f");
-      g_object_notify (self, "volume_perc");
+      g_object_notify ((GObject*) self, "volume_f");
+      g_object_notify ((GObject*) self, "volume_perc");
       break;
     case PROP_VOLUME_PERC:
       self->volume_factor = sfi_value_get_int (value) / 100.0;
       g_object_set (self->output, /* no undo */
                     "master_volume_f", self->volume_factor,
                     NULL);
-      g_object_notify (self, "volume_f");
-      g_object_notify (self, "volume_dB");
+      g_object_notify ((GObject*) self, "volume_f");
+      g_object_notify ((GObject*) self, "volume_dB");
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (self, param_id, pspec);
@@ -427,18 +425,16 @@ bse_midi_synth_class_init (BseMidiSynthClass *klass)
   BseObjectClass *object_class = BSE_OBJECT_CLASS (klass);
   BseItemClass *item_class = BSE_ITEM_CLASS (klass);
   BseSourceClass *source_class = BSE_SOURCE_CLASS (klass);
-  
-  parent_class = g_type_class_peek_parent (klass);
-  
+
+  parent_class = (GTypeClass*) g_type_class_peek_parent (klass);
   gobject_class->set_property = bse_midi_synth_set_property;
   gobject_class->get_property = bse_midi_synth_get_property;
   gobject_class->finalize = bse_midi_synth_finalize;
-  
   item_class->get_candidates = bse_midi_synth_get_candidates;
-  
+
   source_class->context_create = bse_midi_synth_context_create;
   source_class->context_dismiss = bse_midi_synth_context_dismiss;
-  
+
   bse_object_class_add_param (object_class, _("MIDI Instrument"),
 			      PROP_MIDI_CHANNEL,
 			      sfi_pspec_int ("midi_channel", _("MIDI Channel"), NULL,
diff --git a/bse/bsemidivoice.c b/bse/bsemidivoice.cc
similarity index 99%
rename from bse/bsemidivoice.c
rename to bse/bsemidivoice.cc
index 1b35767..1b0e709 100644
--- a/bse/bsemidivoice.c
+++ b/bse/bsemidivoice.cc
@@ -312,7 +312,7 @@ bse_midi_voice_switch_ref_poly_voice (BseMidiVoiceSwitch     *self,
   mcontext.midi_channel = self->midi_channel;
   for (slist = self->midi_voices; slist; slist = slist->next)
     {
-      mvoice = slist->data;
+      mvoice = (MidiVoice*) slist->data;
       if (mvoice->context_handle == context_handle)
 	break;
     }
@@ -343,7 +343,7 @@ bse_midi_voice_switch_peek_poly_voice (BseMidiVoiceSwitch     *self,
 
   for (slist = self->midi_voices; slist; slist = slist->next)
     {
-      mvoice = slist->data;
+      mvoice = (MidiVoice*) slist->data;
       if (mvoice->context_handle == context_handle)
 	break;
     }
@@ -373,7 +373,7 @@ bse_midi_voice_switch_unref_poly_voice (BseMidiVoiceSwitch *self,
   mcontext.midi_channel = self->midi_channel;
   for (slist = self->midi_voices; slist; slist = slist->next)
     {
-      mvoice = slist->data;
+      mvoice = (MidiVoice*) slist->data;
       if (mvoice->context_handle == context_handle)
 	break;
     }
diff --git a/po/POTSCAN b/po/POTSCAN
index 5b020f0..08d186c 100644
--- a/po/POTSCAN
+++ b/po/POTSCAN
@@ -81,8 +81,8 @@ bse/bsemidicontroller.cc
 bse/bsemididevice-null.cc
 bse/bsemididevice-oss.cc
 bse/bsemidiinput.cc
-bse/bsemidisynth.c
-bse/bsemidivoice.c
+bse/bsemidisynth.cc
+bse/bsemidivoice.cc
 bse/bseobject.cc
 bse/bseparasite.proc
 bse/bsepcmdevice-null.cc



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