[beast: 1/9] BSE: move Bse.Source.has_output(s) into bseapi.idl



commit c8691331fc740dcb28aaa5c99683c8af53de1bd8
Author: Tim Janik <timj gnu org>
Date:   Sun Jul 23 21:02:02 2017 +0200

    BSE: move Bse.Source.has_output(s) into bseapi.idl
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bseapi.idl     |    4 ++--
 bse/bsesource.cc   |   15 +++++++++++++++
 bse/bsesource.hh   |    2 ++
 bse/bsesource.proc |   48 ------------------------------------------------
 4 files changed, 19 insertions(+), 50 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 95904ae..8c4f21d 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -585,8 +585,8 @@ interface Source : Item {
   // void clear_outputs (); ///< Disconnect all module outputs.
   // int32 get_automation_channel (String property_name); ///< Get MIDI channel from an automation property.
   // MidiControlType get_automation_control (String property_name); ///< Get control type from an automation 
property.
-  // bool has_output (int32 ochannel); ///< Check whether a module's output channel is connected.
-  // bool has_outputs (); ///< Check whether a module has output channel connections.
+  bool has_output (int32 ochannel); ///< Check whether a module's output channel is connected.
+  bool has_outputs (); ///< Check whether a module has output channel connections.
   // String ichannel_blurb (int32 input_channel); ///< Get input channel description.
   // int32 ichannel_get_n_joints (int32 input_channel); ///< Retrieve the number of inputs connected to an 
input channel.
   // int32 ichannel_get_ochannel (int32 input_channel, int32 input_joint); ///< Retrieve output channel of 
the module connected to a specific joint of an input channel.
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index 8a34eaa..f043bd9 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -2080,4 +2080,19 @@ SourceImpl::ichannel_get_osource (int input_channel, int input_joint)
   return osource->as<SourceIfaceP>();
 }
 
+bool
+SourceImpl::has_output (int ochannel)
+{
+  BseSource *self = as<BseSource*>();
+  return bse_source_has_output (self, ochannel);
+}
+
+bool
+SourceImpl::has_outputs ()
+{
+  BseSource *self = as<BseSource*>();
+  return self->outputs != NULL;
+}
+
+
 } // Bse
diff --git a/bse/bsesource.hh b/bse/bsesource.hh
index f927180..ccacac7 100644
--- a/bse/bsesource.hh
+++ b/bse/bsesource.hh
@@ -277,6 +277,8 @@ protected:
 public:
   explicit             SourceImpl           (BseObject*);
   virtual SourceIfaceP ichannel_get_osource (int input_channel, int input_joint) override;
+  virtual bool         has_output           (int) override;
+  virtual bool         has_outputs          () override;
 };
 
 } // Bse
diff --git a/bse/bsesource.proc b/bse/bsesource.proc
index 3d5bb2c..57cca66 100644
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@ -248,54 +248,6 @@ BODY (BseProcedureClass *proc,
   return Bse::Error::NONE;
 }
 
-METHOD (BseSource, has-output) {
-  HELP = "Check whether a module's output channel is connected.";
-  IN   = bse_param_spec_object ("module", NULL, NULL, BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  IN    = sfi_pspec_int ("ochannel", NULL, NULL, 0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
-  OUT   = sfi_pspec_bool ("has_outputs", NULL, NULL, FALSE, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-  guint ochannel    = sfi_value_get_int (in_values++);
-
-  /* check parameters */
-  if (!BSE_IS_SOURCE (source))
-    return Bse::Error::PROC_PARAM_INVAL;
-
-  /* set output parameters */
-  sfi_value_set_bool (out_values++, bse_source_has_output (source, ochannel));
-
-  return Bse::Error::NONE;
-}
-
-METHOD (BseSource, has-outputs) {
-  HELP = "Check whether a module has output channel connections.";
-  IN   = bse_param_spec_object ("module", "Module", NULL,
-                                BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  OUT   = sfi_pspec_bool ("has_outputs", "Has Outputs", NULL,
-                         FALSE, SFI_PARAM_STANDARD);
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-
-  /* check parameters */
-  if (!BSE_IS_SOURCE (source))
-    return Bse::Error::PROC_PARAM_INVAL;
-
-  /* set output parameters */
-  sfi_value_set_bool (out_values++, source->outputs != NULL);
-
-  return Bse::Error::NONE;
-}
-
 METHOD (BseSource, n-ichannels) {
   HELP = "Get the number of input channels of a module.";
   IN   = bse_param_spec_object ("module", "Module", NULL,


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