[beast: 5/13] BSE: provide WaveOsc.sync_seek_perc in bseapi.idl



commit 2286cb1aaff5681ec367b24a8a9e42d0318c1e50
Author: Tim Janik <timj gnu org>
Date:   Thu Aug 31 00:22:55 2017 +0200

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

 bse/Makefile.am     |    2 +-
 bse/bseapi.idl      |   12 ++++++++++--
 bse/bsewaveosc.cc   |   17 +++++++++++++++++
 bse/bsewaveosc.hh   |    1 +
 bse/bsewaveosc.proc |   37 -------------------------------------
 5 files changed, 29 insertions(+), 40 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 26b6ba6..57fe7cc 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -116,7 +116,7 @@ bse_proc_sources = $(strip \
        bseeditablesample.proc  \
        bsejanitor.proc         \
                                                                                bsesource.proc          \
-                               bseitem.proc                                    bsewaveosc.proc         \
+                               bseitem.proc                                    \
 )
 bse_proc_gen_sources = $(bse_proc_sources:.proc=.genprc.cc)
 
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 6c096ce..539257a 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -820,10 +820,18 @@ interface WaveRepo : Super {
   void  remove_wave (Wave wave);                ///< Remove a wave from repository.
 };
 
+/// A list of part note events.
+interface WaveOsc;
+sequence WaveOscSeq {
+  WaveOsc wave_oscs;
+};
+
 /// 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.
+  /// Seek a list of wave oscillators to a pcm position given in percentage. The oscillators will seek to 
the given position synchronously.
+  void sync_seek_perc           (float64 pos_perc, WaveOscSeq wosc_seq);
+  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);
diff --git a/bse/bsewaveosc.cc b/bse/bsewaveosc.cc
index d849df8..d2f35bd 100644
--- a/bse/bsewaveosc.cc
+++ b/bse/bsewaveosc.cc
@@ -612,4 +612,21 @@ WaveOscImpl::set_from_editable_sample (EditableSampleIface &esi)
   bse_wave_osc_set_from_esample (self, esample);
 }
 
+void
+WaveOscImpl::sync_seek_perc (double percentage, const WaveOscSeq &other_oscs)
+{
+  BseWaveOsc *self = as<BseWaveOsc*>();
+  size_t j = 0, n = other_oscs.size();
+  BseWaveOsc **woscs = (BseWaveOsc**) g_alloca (sizeof (BseWaveOsc*) * (1 + n));
+  woscs[j++] = self;
+  for (size_t i = 0; i < n; i++)
+    if (other_oscs[i])
+      {
+        BseWaveOsc *other = other_oscs[i]->as<BseWaveOsc*>();
+        if (other != self && BSE_IS_WAVE_OSC (other))
+          woscs[j++] = other;
+      }
+  bse_wave_osc_mass_seek (j, woscs, CLAMP (percentage, 0, 100));
+}
+
 } // Bse
diff --git a/bse/bsewaveosc.hh b/bse/bsewaveosc.hh
index d403cbe..d4dc7e4 100644
--- a/bse/bsewaveosc.hh
+++ b/bse/bsewaveosc.hh
@@ -56,6 +56,7 @@ public:
   explicit      WaveOscImpl              (BseObject*);
   virtual void  request_pcm_position     () override;
   virtual void  set_from_editable_sample (EditableSampleIface &esi) override;
+  virtual void  sync_seek_perc           (double percentage, const WaveOscSeq &other_oscs) override;
 };
 
 } // Bse


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