[beast: 2/8] BSE: move Bus.connect_track() to bseapi.idl



commit 38663be275ba214e525a111f6eeaca35cad585ee
Author: Tim Janik <timj gnu org>
Date:   Thu Sep 17 00:27:10 2015 +0200

    BSE: move Bus.connect_track() to bseapi.idl

 bse/bseapi.idl  |    2 +-
 bse/bsebus.cc   |   16 ++++++++++++++++
 bse/bsebus.hh   |    1 +
 bse/bsebus.proc |   36 ------------------------------------
 4 files changed, 18 insertions(+), 37 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 5098da4..14509d6 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -509,7 +509,7 @@ sequence PartLinkSeq {
 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 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");
diff --git a/bse/bsebus.cc b/bse/bsebus.cc
index 4c5ad2d..9e519b5 100644
--- a/bse/bsebus.cc
+++ b/bse/bsebus.cc
@@ -951,4 +951,20 @@ BusImpl::ensure_output ()
   return error;
 }
 
+ErrorType
+BusImpl::connect_track (TrackIface &tracki)
+{
+  BseBus *self = as<BseBus*>();
+  TrackImpl &track = dynamic_cast<TrackImpl&> (tracki);
+
+  if (!this->parent() || this->parent() != track.parent())
+    return ERROR_SOURCE_PARENT_MISMATCH;
+
+  BseItem *track_item = track.as<BseItem*>();
+  ErrorType error = bse_bus_connect (self, track_item);
+  if (!error)
+    bse_item_push_undo_proc (self, "disconnect-track", track_item);
+  return error;
+}
+
 } // Bse
diff --git a/bse/bsebus.hh b/bse/bsebus.hh
index 5e820b4..0296683 100644
--- a/bse/bsebus.hh
+++ b/bse/bsebus.hh
@@ -86,6 +86,7 @@ protected:
 public:
   explicit          BusImpl       (BseObject*);
   virtual ErrorType ensure_output () override;
+  virtual ErrorType connect_track (TrackIface &track);
 };
 
 } // Bse
diff --git a/bse/bsebus.proc b/bse/bsebus.proc
index 8794032..6ebd995 100644
--- a/bse/bsebus.proc
+++ b/bse/bsebus.proc
@@ -11,42 +11,6 @@ AUTHORS      = "Tim Janik <timj gtk org>";
 LICENSE = "Copyright (C) 2004 Tim Janik";
 
 
-METHOD (BseBus, connect-track) {
-  HELP  = _("Add a track to the input list of a bus.");
-  IN    = bse_param_spec_object ("sbus", NULL, NULL, BSE_TYPE_BUS, SFI_PARAM_STANDARD);
-  IN    = bse_param_spec_object ("track", NULL, NULL, BSE_TYPE_TRACK, 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++);
-  BseTrack *track = (BseTrack*) bse_value_get_object (in_values++);
-  Bse::ErrorType error = Bse::ERROR_NONE;
-
-  /* check parameters */
-  if (!BSE_IS_BUS (self) || !BSE_IS_TRACK (track))
-    return Bse::ERROR_PROC_PARAM_INVAL;
-
-  /* action */
-  if (!BSE_ITEM (self)->parent || BSE_ITEM (self)->parent != BSE_ITEM (track)->parent)
-    error = Bse::ERROR_SOURCE_PARENT_MISMATCH;
-  else
-    {
-      error = bse_bus_connect (self, BSE_ITEM (track));
-      if (!error)
-        bse_item_push_undo_proc (self, "disconnect-track", track);
-    }
-
-  /* set output parameters */
-  g_value_set_enum (out_values++, error);
-
-  return Bse::ERROR_NONE;
-}
-
 METHOD (BseBus, disconnect-track) {
   HELP  = _("Remove a track from the input list of a bus.");
   IN    = bse_param_spec_object ("sbus", NULL, NULL, BSE_TYPE_BUS, SFI_PARAM_STANDARD);


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