[beast: 11/26] BSE: bseapi.idl: introduce Bus



commit 77cc9465846a98ddca65c2deb23c88aa97b9f1e4
Author: Tim Janik <timj gnu org>
Date:   Wed Jul 1 13:41:40 2015 +0200

    BSE: bseapi.idl: introduce Bus

 beast-gtk/bstbusmixer.cc |    5 ++++-
 bse/bseapi.idl           |   19 +++++++++++++++++++
 bse/bsebus.cc            |   31 +++++++++++++++++++++++++++++++
 bse/bsebus.hh            |   13 ++++++++++++-
 bse/bsebus.proc          |   38 --------------------------------------
 bse/bseobject.cc         |    4 +++-
 6 files changed, 69 insertions(+), 41 deletions(-)
---
diff --git a/beast-gtk/bstbusmixer.cc b/beast-gtk/bstbusmixer.cc
index ae7190d..aea3d2e 100644
--- a/beast-gtk/bstbusmixer.cc
+++ b/beast-gtk/bstbusmixer.cc
@@ -178,7 +178,10 @@ bus_mixer_action_exec (gpointer data,
     case ACTION_ADD_BUS:
       bse_item_group_undo (song, "Create Bus");
       item = bse_song_create_bus (song);
-      bse_bus_ensure_output (item);
+      {
+        Bse::BusH bus = Bse::BusH::down_cast (bse_server.from_proxy (item));
+        bus.ensure_output();
+      }
       bse_item_ungroup_undo (song);
       if (item)
         bst_item_view_select (iview, item);
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index a11379b..79c5760 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -288,6 +288,7 @@ Const MIN_BPM       = 1;
 Const MAX_BPM       = 1024;
 Const MIN_TRANSPOSE = -72;
 Const MAX_TRANSPOSE = +72;
+Const GUI           = "r:w:G";
 Const STORAGE       = "r:w:S";
 Const STANDARD      = STORAGE ":G";
 Const NOTEHINTS     = STANDARD ":note";
@@ -470,6 +471,24 @@ interface Track : ContextMerger {
   // property ItemSeq outputs;     ///< _("Mixer busses used as output for this track.")
 };
 
+/// Bus object, implements effect stacks and per-track audio signal routing to the master output.
+interface Bus : SubSynth {
+  ErrorType ensure_output    ();            ///< Ensure that a bus has an output connection.
+  // ErrorType connect_bus      (Bus bus);     ///< Add a bus to the input list of a bus.
+  // ErrorType connect_track    (Track track); ///< Add a track to the input list of a bus.
+  // ErrorType disconnect_bus   (Bus bus);     ///< Remove a bus from the input list of a bus.
+  // ErrorType disconnect_track (Track track); ///< Remove a track from the input list of a bus.
+  // ItemSeq   inputs        = Object ("Input Signals", "Synthesis signals (from tracks and busses) used as 
bus input", GUI ":item-sequence");
+  // ItemSeq   outputs       = Object ("Output Signals", "Mixer busses used as output for synthesis 
signals", GUI ":item-sequence");
+  // CSynth    snet          = Object ("SNet", "Synthesis network used internally to implement effect 
stack", READWRITE ":skip-undo");
+  // bool      mute          = Bool   ("Mute", "Mute: turn off the bus volume",    STANDARD ":skip-default", 
FALSE);
+  // bool      solo          = Bool   ("Solo", "Solo: mute all other busses",      STANDARD ":skip-default", 
FALSE);
+  // bool      sync          = Bool   ("Sync", "Synchronize left and right volume", STANDARD 
":skip-default", TRUE);
+  // float64   left_volume   = Num    ("Left Volume",  "Volume adjustment in decibel of left bus channel",  
STANDARD ":scale:db-volume");
+  // float64   right_volume  = Num    ("Right Volume", "Volume adjustment in decibel of right bus channel", 
STANDARD ":scale:db-volume");
+  // bool      master_output = Bool   ("Master Output", "", STORAGE ":skip-default", FALSE);
+};
+
 /// Container for Track and Part objects, as well as meta data for sequencing.
 interface Song : SNet {
   Track         find_any_track_for_part (Part part);   ///< Find the first track that contains part, 
suitable to check for orphan parts.
diff --git a/bse/bsebus.cc b/bse/bsebus.cc
index 73239ae..4c5ad2d 100644
--- a/bse/bsebus.cc
+++ b/bse/bsebus.cc
@@ -921,3 +921,34 @@ BSE_BUILTIN_TYPE (BseBus)
                                          &bus_info);
   return type;
 }
+
+namespace Bse {
+
+BusImpl::BusImpl (BseObject *bobj) :
+  SubSynthImpl (bobj)
+{}
+
+BusImpl::~BusImpl ()
+{}
+
+ErrorType
+BusImpl::ensure_output ()
+{
+  BseBus *self = as<BseBus*>();
+  ErrorType error = ERROR_NONE;
+  BseItem *parent = self->parent;
+  if (BSE_IS_SONG (parent) && !self->bus_outputs)
+    {
+      BseSong *song = BSE_SONG (parent);
+      BseBus *master = bse_song_find_master (song);
+      if (master && self != master)
+        {
+          error = bse_bus_connect (master, BSE_ITEM (self));
+          if (!error)
+            bse_item_push_undo_proc (master, "disconnect-bus", self);
+        }
+    }
+  return error;
+}
+
+} // Bse
diff --git a/bse/bsebus.hh b/bse/bsebus.hh
index f5a6c77..5e820b4 100644
--- a/bse/bsebus.hh
+++ b/bse/bsebus.hh
@@ -76,7 +76,18 @@ enum
   BSE_BUS_N_OCHANNELS
 };
 
-
 G_END_DECLS
 
+namespace Bse {
+
+class BusImpl : public SubSynthImpl, public virtual BusIface {
+protected:
+  virtual           ~BusImpl      ();
+public:
+  explicit          BusImpl       (BseObject*);
+  virtual ErrorType ensure_output () override;
+};
+
+} // Bse
+
 #endif /* __BSE_BUS_H__ */
diff --git a/bse/bsebus.proc b/bse/bsebus.proc
index 02cb120..8794032 100644
--- a/bse/bsebus.proc
+++ b/bse/bsebus.proc
@@ -156,41 +156,3 @@ BODY (BseProcedureClass *proc,
 
   return Bse::ERROR_NONE;
 }
-
-METHOD (BseBus, ensure-output) {
-  HELP  = _("Ensure that a bus has an output connection.");
-  IN    = bse_param_spec_object ("bus", NULL, NULL, BSE_TYPE_BUS, SFI_PARAM_STANDARD);
-  OUT   = bse_param_spec_genum ("error", NULL, NULL,
-                                BSE_TYPE_ERROR_TYPE, Bse::ERROR_NONE, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseBus *self = (BseBus*) bse_value_get_object (in_values++);
-  Bse::ErrorType error = Bse::ERROR_NONE;
-
-  /* check parameters */
-  if (!BSE_IS_BUS (self))
-    return Bse::ERROR_PROC_PARAM_INVAL;
-
-  /* action */
-  BseItem *parent = BSE_ITEM (self)->parent;
-  if (BSE_IS_SONG (parent) && !self->bus_outputs)
-    {
-      BseSong *song = BSE_SONG (parent);
-      BseBus *master = bse_song_find_master (song);
-      if (master && self != master)
-        {
-          error = bse_bus_connect (master, BSE_ITEM (self));
-          if (!error)
-            bse_item_push_undo_proc (master, "disconnect-bus", self);
-        }
-    }
-
-  /* set output parameters */
-  g_value_set_enum (out_values++, error);
-
-  return Bse::ERROR_NONE;
-}
diff --git a/bse/bseobject.cc b/bse/bseobject.cc
index b48823f..8e5121f 100644
--- a/bse/bseobject.cc
+++ b/bse/bseobject.cc
@@ -921,7 +921,7 @@ bse_object_new (GType object_type, const gchar *first_property_name, ...)
 #include "bsecsynth.hh"
 #include "bsetrack.hh"
 #include "bsecontextmerger.hh"
-#include "bsesubsynth.hh"
+#include "bsebus.hh"
 #include "bsesnet.hh"
 #include "bsepart.hh"
 
@@ -957,6 +957,8 @@ bse_object_new_valist (GType object_type, const gchar *first_property_name, va_l
     cxxo = new Bse::ContextMergerImpl (object);
   else if (g_type_is_a (object_type, BSE_TYPE_PART))
     cxxo = new Bse::PartImpl (object);
+  else if (g_type_is_a (object_type, BSE_TYPE_BUS))
+    cxxo = new Bse::BusImpl (object);
   else if (g_type_is_a (object_type, BSE_TYPE_SUB_SYNTH))
     cxxo = new Bse::SubSynthImpl (object);
   else if (g_type_is_a (object_type, BSE_TYPE_SOURCE))


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