[beast: 1/13] BSE: bseapi.idl: introduce WaveOsc



commit 311ba66a658d1ee53834c2f1b8e2d6a9f2552ee1
Author: Tim Janik <timj gnu org>
Date:   Wed Aug 30 12:38:06 2017 +0200

    BSE: bseapi.idl: introduce WaveOsc
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bseapi.idl      |   12 ++++++++++++
 bse/bseobject.cc    |    3 +++
 bse/bsewaveosc.cc   |   18 ++++++++++++++++++
 bse/bsewaveosc.hh   |   13 ++++++++++++-
 bse/bsewaveosc.proc |   20 --------------------
 5 files changed, 45 insertions(+), 21 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 05660f0..b09de0e 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -820,6 +820,18 @@ interface WaveRepo : Super {
   void  remove_wave (Wave wave);                ///< Remove a wave from repository.
 };
 
+/// Oscillator module for wave files.
+interface WaveOsc : Source {
+  void        request_pcm_position     ();                       ///< Request emission of the 
::notify_pcm_position signal.
+  // void        set_from_editable_sample (EditableSample esample); ///< Set wave to play from editable 
sample, bypassing undo and storage mechanisms.
+  // signal void notify_pcm_position      (int64 timestamp, int64 position); ///< Notification signal 
containing the current PCM play position pointer.
+  // Wave    wave           = ("Wave", "Wave used as oscillator source", STANDARD);
+  // int64   channel        = Range ("Channel", "The audio channel to play, usually 1 is left, 2 is right", 
":readwrite", 1, 256);
+  // float64 fm_perc        = Range ("Input Modulation [%]", "Modulation Strength for linear frequency 
modulation", STANDARD  ":scale", 0, 100, 10);
+  // bool    exponential_fm = Bool ("Exponential FM", "Perform exponential frequency modulation instead of 
linear", STANDARD, false);
+  // float64 fm_n_octaves   = Range ("Octaves", "Number of octaves to be affected by exponential frequency 
modulation", STANDARD ":scale", 0, 3, 1);
+};
+
 /// Interface for sound fonts
 interface SoundFont : Container {
 };
diff --git a/bse/bseobject.cc b/bse/bseobject.cc
index 712f5bd..44c66c1 100644
--- a/bse/bseobject.cc
+++ b/bse/bseobject.cc
@@ -908,6 +908,7 @@ bse_object_new (GType object_type, const gchar *first_property_name, ...)
 #include "bsepcmwriter.hh"
 #include "bseeditablesample.hh"
 #include "bsesong.hh"
+#include "bsewaveosc.hh"
 #include "bsecsynth.hh"
 #include "bsetrack.hh"
 #include "bsecontextmerger.hh"
@@ -955,6 +956,8 @@ bse_object_new_valist (GType object_type, const gchar *first_property_name, va_l
     cxxo = new Bse::MidiNotifierImpl (object);
   else if (g_type_is_a (object_type, BSE_TYPE_MIDI_SYNTH))
     cxxo = new Bse::MidiSynthImpl (object);
+  else if (g_type_is_a (object_type, BSE_TYPE_WAVE_OSC))
+    cxxo = new Bse::WaveOscImpl (object);
   else if (g_type_is_a (object_type, BSE_TYPE_CSYNTH))
     cxxo = new Bse::CSynthImpl (object);
   else if (g_type_is_a (object_type, BSE_TYPE_SNET))
diff --git a/bse/bsewaveosc.cc b/bse/bsewaveosc.cc
index faa93a2..74724f9 100644
--- a/bse/bsewaveosc.cc
+++ b/bse/bsewaveosc.cc
@@ -585,3 +585,21 @@ bse_wave_osc_class_init (BseWaveOscClass *klass)
   ochannel = bse_source_class_add_ochannel (source_class, "done-out", _("Done Out"), _("Done Output"));
   assert_return (ochannel == BSE_WAVE_OSC_OCHANNEL_DONE);
 }
+
+namespace Bse {
+
+WaveOscImpl::WaveOscImpl (BseObject *bobj) :
+  SourceImpl (bobj)
+{}
+
+WaveOscImpl::~WaveOscImpl ()
+{}
+
+void
+WaveOscImpl::request_pcm_position ()
+{
+  BseWaveOsc *self = as<BseWaveOsc*>();
+  bse_wave_osc_request_pcm_position (self);
+}
+
+} // Bse
diff --git a/bse/bsewaveosc.hh b/bse/bsewaveosc.hh
index da9212c..4ac604b 100644
--- a/bse/bsewaveosc.hh
+++ b/bse/bsewaveosc.hh
@@ -31,7 +31,6 @@ void    bse_wave_osc_mass_seek                  (guint              n_woscs,
 void    bse_wave_osc_set_from_esample           (BseWaveOsc        *self,
                                                  BseEditableSample *esample);
 
-
 /* --- channels --- */
 enum
 {
@@ -48,4 +47,16 @@ enum
   BSE_WAVE_OSC_N_OCHANNELS
 };
 
+namespace Bse {
+
+class WaveOscImpl : public SourceImpl, public virtual WaveOscIface {
+protected:
+  virtual      ~WaveOscImpl             ();
+public:
+  explicit      WaveOscImpl             (BseObject*);
+  virtual void  request_pcm_position    () override;
+};
+
+} // Bse
+
 #endif /* __BSE_WAVE_OSC_H__ */
diff --git a/bse/bsewaveosc.proc b/bse/bsewaveosc.proc
index 12d33bb..c2385bc 100644
--- a/bse/bsewaveosc.proc
+++ b/bse/bsewaveosc.proc
@@ -10,26 +10,6 @@ AUTHORS      = "Tim Janik <timj gtk org>";
 LICENSE = "GNU Lesser General Public License";
 
 
-METHOD (BseWaveOsc, request-pcm-position) {
-  HELP = "Request emission of the ::notify_pcm_position signal.";
-  IN   = bse_param_spec_object ("wosc", NULL, "Wave Oscilator",
-                                BSE_TYPE_WAVE_OSC, SFI_PARAM_STANDARD);
-} BODY (BseProcedureClass *proc,
-       const GValue      *in_values,
-       GValue            *out_values)
-{
-  /* extract parameter values */
-  BseWaveOsc *self = (BseWaveOsc*) bse_value_get_object (in_values++);
-
-  /* check parameters */
-  if (!BSE_IS_WAVE_OSC (self))
-    return Bse::Error::PROC_PARAM_INVAL;
-
-  bse_wave_osc_request_pcm_position (self);
-
-  return Bse::Error::NONE;
-}
-
 PROCEDURE (bse-wave-osc-mass-seek-perc, "Seek Wave Oscillators") {
   HELP = "Seek a list of wave oscillators to a pcm position given in percentage. The oscillators will seek 
to the given position syncronously.";
   IN    = bse_param_spec_boxed ("wosc-seq", "Wave Oscilators", NULL, BSE_TYPE_IT3M_SEQ, SFI_PARAM_STANDARD); 
// FIXME: using BseIt3mSeq because BseWaveOscSeq requires idl+C++


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