[beast: 3/9] BSE: move Bse.Source.n_[io]channels() into bseapi.idl



commit edc34796b707a194a031c2906c8fe4b4c8e189f2
Author: Tim Janik <timj gnu org>
Date:   Mon Jul 24 01:23:36 2017 +0200

    BSE: move Bse.Source.n_[io]channels() into bseapi.idl
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bseapi.idl     |    4 ++--
 bse/bsesource.cc   |   13 +++++++++++++
 bse/bsesource.hh   |    2 ++
 bse/bsesource.proc |   48 ------------------------------------------------
 4 files changed, 17 insertions(+), 50 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 8c4f21d..d4fb1ca 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -595,8 +595,8 @@ interface Source : Item {
   // bool is_joint_ichannel (String input_channel); ///< Check if an input channel is a joint 
(multi-connect) channel.
   // bool is_joint_ichannel_by_id (int32 input_channel); ///< Check if an input channel is a joint 
(multi-connect) channel.
   // bool is_prepared (); ///< Check whether a source is prepared for synthesis processing.
-  // int32 n_ichannels (); ///< Get the number of input channels of a module.
-  // int32 n_ochannels (); ///< Get the number of output channels of a module.
+  int32 n_ichannels (); ///< Get the number of input channels of a module.
+  int32 n_ochannels (); ///< Get the number of output channels of a module.
   // String ochannel_blurb (int32 output_channel); ///< Get output channel description.
   // String ochannel_ident (int32 output_channel); ///< Get canonical output channel name.
   // String ochannel_label (int32 output_channel); ///< Get output channel name.
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index f043bd9..7ea6228 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -2094,5 +2094,18 @@ SourceImpl::has_outputs ()
   return self->outputs != NULL;
 }
 
+int
+SourceImpl::n_ichannels()
+{
+  BseSource *self = as<BseSource*>();
+  return BSE_SOURCE_N_ICHANNELS (self);
+}
+
+int
+SourceImpl::n_ochannels()
+{
+  BseSource *self = as<BseSource*>();
+  return BSE_SOURCE_N_OCHANNELS (self);
+}
 
 } // Bse
diff --git a/bse/bsesource.hh b/bse/bsesource.hh
index ccacac7..9e459e2 100644
--- a/bse/bsesource.hh
+++ b/bse/bsesource.hh
@@ -279,6 +279,8 @@ public:
   virtual SourceIfaceP ichannel_get_osource (int input_channel, int input_joint) override;
   virtual bool         has_output           (int) override;
   virtual bool         has_outputs          () override;
+  virtual int          n_ichannels          () override;
+  virtual int          n_ochannels          () override;
 };
 
 } // Bse
diff --git a/bse/bsesource.proc b/bse/bsesource.proc
index 57cca66..9d8000a 100644
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@ -248,30 +248,6 @@ BODY (BseProcedureClass *proc,
   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,
-                                BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  OUT   = sfi_pspec_int ("n_channels", "Number of Channels", NULL,
-                        0, 0, G_MAXINT, 1, 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_int (out_values++, BSE_SOURCE_N_ICHANNELS (source));
-
-  return Bse::Error::NONE;
-}
-
 METHOD (BseSource, ichannel-label) {
   HELP = "Get input channel name.";
   IN   = bse_param_spec_object ("module", "Module", NULL,
@@ -479,30 +455,6 @@ BODY (BseProcedureClass *proc,
   return Bse::Error::NONE;
 }
 
-METHOD (BseSource, n-ochannels) {
-  HELP = "Get the number of output channels of a module.";
-  IN   = bse_param_spec_object ("module", "Module", NULL,
-                                BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  OUT   = sfi_pspec_int ("n_channels", "Number of Channels", NULL,
-                        0, 0, G_MAXINT, 1, 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_int (out_values++, BSE_SOURCE_N_OCHANNELS (source));
-
-  return Bse::Error::NONE;
-}
-
 METHOD (BseSource, ochannel-label) {
   HELP = "Get output channel name.";
   IN   = bse_param_spec_object ("module", "Module", NULL,


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