[beast: 8/26] BSE: move BseWave methods into bseapi.idl
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 8/26] BSE: move BseWave methods into bseapi.idl
- Date: Fri, 14 Oct 2016 15:48:39 +0000 (UTC)
commit e8bbd02a4bf64e5cdc584914eacb25f1acd28f5c
Author: Tim Janik <timj gnu org>
Date: Sat May 28 13:53:25 2016 +0200
BSE: move BseWave methods into bseapi.idl
Signed-off-by: Tim Janik <timj gnu org>
bse/Makefile.am | 2 +-
bse/bseapi.idl | 4 ++
bse/bsewave.cc | 41 +++++++++++++++++
bse/bsewave.hh | 6 ++-
bse/bsewave.proc | 133 ------------------------------------------------------
5 files changed, 51 insertions(+), 135 deletions(-)
---
diff --git a/bse/Makefile.am b/bse/Makefile.am
index 45a6afc..367c894 100644
--- a/bse/Makefile.am
+++ b/bse/Makefile.am
@@ -118,7 +118,7 @@ bse_proc_sources = $(strip \
bsecategories.proc bseeditablesample.proc \
bsejanitor.proc bseproject.proc \
bsesong.proc bsesource.proc \
- bseitem.proc bsewave.proc bsewaveosc.proc \
+ bseitem.proc bsewaveosc.proc \
)
bse_proc_gen_sources = $(bse_proc_sources:.proc=.genprc.cc)
# non-compile and non-install sources required
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 6b5d211..9efed38 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -794,6 +794,10 @@ interface EditableSample : Item {
/// Interface for PCM wave samples.
interface Wave : Source {
+ float64 chunk_get_mix_freq (int32 chunk_index); ///< Retrieve mixing frequency of a wave chunk.
+ float64 chunk_get_osc_freq (int32 chunk_index); ///< Retrieve oscillating frequency of a wave
chunk.
+ int32 n_wave_chunks (); ///< Get the number of wave chunks of a wave.
+ EditableSample use_editable (int32 chunk_index); ///< Retrieve an editable sample object for a
wave chunk.
};
/// Interface serving as container for Wave objects.
diff --git a/bse/bsewave.cc b/bse/bsewave.cc
index 0d64b56..be118eb 100644
--- a/bse/bsewave.cc
+++ b/bse/bsewave.cc
@@ -7,6 +7,7 @@
#include "gsldatahandle.hh"
#include "bseserver.hh"
#include "bseloader.hh"
+#include "bseeditablesample.hh"
#include <string.h>
@@ -866,4 +867,44 @@ WaveImpl::WaveImpl (BseObject *bobj) :
WaveImpl::~WaveImpl ()
{}
+double
+WaveImpl::chunk_get_mix_freq (int chunk_index)
+{
+ BseWave *self = as<BseWave*>();
+ GslWaveChunk *wchunk = (GslWaveChunk*) sfi_ring_nth_data (self->wave_chunks, chunk_index);
+ return wchunk ? wchunk->mix_freq : 0;
+}
+
+double
+WaveImpl::chunk_get_osc_freq (int chunk_index)
+{
+ BseWave *self = as<BseWave*>();
+ GslWaveChunk *wchunk = (GslWaveChunk*) sfi_ring_nth_data (self->wave_chunks, chunk_index);
+ return wchunk ? wchunk->osc_freq : 0;
+}
+
+int
+WaveImpl::n_wave_chunks ()
+{
+ BseWave *self = as<BseWave*>();
+ return self->n_wchunks;
+}
+
+EditableSampleIfaceP
+WaveImpl::use_editable (int chunk_index)
+{
+ BseWave *self = as<BseWave*>();
+ GslWaveChunk *wchunk = (GslWaveChunk*) sfi_ring_nth_data (self->wave_chunks, chunk_index);
+ BseEditableSample *esample = NULL;
+ if (wchunk)
+ {
+ esample = (BseEditableSample*) bse_object_new (BSE_TYPE_EDITABLE_SAMPLE, NULL);
+ bse_editable_sample_set_wchunk (esample, wchunk);
+ bse_item_use (BSE_ITEM (esample));
+ g_object_unref (esample);
+ return esample->as<EditableSampleIfaceP>();
+ }
+ return NULL;
+}
+
} // Bse
diff --git a/bse/bsewave.hh b/bse/bsewave.hh
index 956912a..68136e6 100644
--- a/bse/bsewave.hh
+++ b/bse/bsewave.hh
@@ -74,7 +74,11 @@ class WaveImpl : public SourceImpl, public virtual WaveIface {
protected:
virtual ~WaveImpl ();
public:
- explicit WaveImpl (BseObject*);
+ explicit WaveImpl (BseObject*);
+ virtual double chunk_get_mix_freq (int chunk_index) override;
+ virtual double chunk_get_osc_freq (int chunk_index) override;
+ virtual int n_wave_chunks () override;
+ virtual EditableSampleIfaceP use_editable (int chunk_index) override;
};
} // Bse
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]