[beast: 6/11] BSE: move Source.get_automation_channel() into bseapi.idl



commit 2b361e21ba3a64e88c3a5f6540ec7b5cc8ba90d2
Author: Tim Janik <timj gnu org>
Date:   Mon Sep 4 21:39:02 2017 +0200

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

 bse/bseapi.idl     |    4 ++--
 bse/bsesource.cc   |    9 +++++++++
 bse/bsesource.hh   |    3 ++-
 bse/bsesource.proc |   29 -----------------------------
 4 files changed, 13 insertions(+), 32 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 89b8855..dcd8def 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -753,7 +753,6 @@ interface Source : Item {
 
   // void clear_inputs (); ///< Disconnect all module inputs.
   // void clear_outputs (); ///< Disconnect all module outputs.
-  // int32 get_automation_channel (String property_name); ///< Get MIDI channel 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.
   String ichannel_blurb (int32 input_channel); ///< Get input channel description.
@@ -774,8 +773,9 @@ interface Source : Item {
    * @param midi_channel The MIDI Channel from which automation events should be received, 0 designates the 
default MIDI channel
    * @param control_type The type of control events used for automation
    */
-  Error set_automation (String property_name, int32 midi_channel, MidiControl control_type);
+  Error       set_automation         (String property_name, int32 midi_channel, MidiControl control_type);
   MidiControl get_automation_control (String property_name); ///< Get control type from an automation 
property.
+  int32       get_automation_channel (String property_name); ///< Get MIDI channel from an automation 
property.
   Error set_input (String input_channel, Source omodule, String output_channel); ///< Connect a module input 
to another module's output.
   Error set_input_by_id (int32 input_channel, Source omodule, int32 output_channel); ///< Connect a module 
input to another module's output.
   Error unset_input (String input_channel, Source omodule, String output_channel); ///< Disconnect a module 
input.
diff --git a/bse/bsesource.cc b/bse/bsesource.cc
index 092c89a..44b7dd1 100644
--- a/bse/bsesource.cc
+++ b/bse/bsesource.cc
@@ -2336,6 +2336,15 @@ SourceImpl::set_pos (double x_pos, double y_pos)
     }
 }
 
+int32
+SourceImpl::get_automation_channel (const String &property_name)
+{
+  BseSource *self = as<BseSource*>();
+  uint midi_channel = 0;
+  bse_source_get_automation_property (self, property_name.c_str(), &midi_channel, NULL);
+  return midi_channel;
+}
+
 MidiControl
 SourceImpl::get_automation_control (const String &property_name)
 {
diff --git a/bse/bsesource.hh b/bse/bsesource.hh
index da33f7c..928076e 100644
--- a/bse/bsesource.hh
+++ b/bse/bsesource.hh
@@ -297,8 +297,9 @@ public:
   virtual Error        unset_input             (const String &input_channel, SourceIface &omodule, const 
String &output_channel) override;
   virtual Error        unset_input_by_id       (int input_channel, SourceIface &omodule, int output_channel) 
override;
   virtual void         set_pos                 (double x_pos, double y_pos) override;
-  virtual MidiControl  get_automation_control  (const String &property_name) override;
   virtual Error        set_automation          (const String &property_name, int midi_channel, MidiControl 
control_type) override;
+  virtual MidiControl  get_automation_control  (const String &property_name) override;
+  virtual int32        get_automation_channel  (const String &property_name) override;
 };
 
 } // Bse
diff --git a/bse/bsesource.proc b/bse/bsesource.proc
index be03c87..5bcad58 100644
--- a/bse/bsesource.proc
+++ b/bse/bsesource.proc
@@ -65,32 +65,3 @@ BODY (BseProcedureClass *proc,
 
   return Bse::Error::NONE;
 }
-
-METHOD (BseSource, get-automation-channel) {
-  HELP = "Get MIDI channel from an automation property.";
-  IN   = bse_param_spec_object ("source", NULL, NULL,
-                                BSE_TYPE_SOURCE, SFI_PARAM_STANDARD);
-  IN    = sfi_pspec_string ("property_name", NULL, "Item property name",
-                            NULL, SFI_PARAM_STANDARD);
-  OUT   = sfi_pspec_int ("midi_channel", NULL, NULL, 0, 0, BSE_MIDI_MAX_CHANNELS, 1, SFI_PARAM_STANDARD 
":scale:unprepared");
-}
-BODY (BseProcedureClass *proc,
-      const GValue      *in_values,
-      GValue            *out_values)
-{
-  /* extract parameter values */
-  BseSource *source = (BseSource*) bse_value_get_object (in_values++);
-  const char *property = sfi_value_get_string (in_values++);
-
-  /* check parameters */
-  if (!BSE_IS_SOURCE (source) || !property)
-    return Bse::Error::PROC_PARAM_INVAL;
-
-  /* connect */
-  guint midi_channel = 0;
-  bse_source_get_automation_property (source, property, &midi_channel, NULL);
-  /* set output parameters */
-  g_value_set_int (out_values++, midi_channel);
-
-  return Bse::Error::NONE;
-}


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