diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-10-04 17:31:19 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-10-04 17:31:19 +0200 |
commit | 5fbec7c02c6677d701675bfcfd529bb646b4bea8 (patch) | |
tree | d871f59aa0ed3999e25cb32e154b2f6a5d98f7bb | |
parent | 6f0edf4dbb11278f5cce9506b3af2b7940b45824 (diff) |
Add samplerate() method to lv2 output engine.
-rw-r--r-- | lv2/lv2.cc | 2 | ||||
-rw-r--r-- | lv2/output_lv2.cc | 22 | ||||
-rw-r--r-- | lv2/output_lv2.h | 6 |
3 files changed, 12 insertions, 18 deletions
@@ -248,7 +248,7 @@ LV2_Handle instantiate(const struct _LV2_Descriptor *descriptor, dg_descriptor.get_pci = dg_get_pci; dglv2->in = new InputLV2(); - dglv2->out = new OutputLV2(); + dglv2->out = new OutputLV2(sample_rate); dglv2->buffer = NULL; dglv2->buffer_size = 0; diff --git a/lv2/output_lv2.cc b/lv2/output_lv2.cc index 8187a5a..b4a6877 100644 --- a/lv2/output_lv2.cc +++ b/lv2/output_lv2.cc @@ -28,8 +28,9 @@ #include <string.h> -OutputLV2::OutputLV2() +OutputLV2::OutputLV2(double sample_rate) { + this->sample_rate = sample_rate; for(size_t i = 0; i < NUM_OUTPUTS; i++) { outputPorts[i].size = 0; outputPorts[i].samples = NULL; @@ -83,19 +84,8 @@ sample_t *OutputLV2::getBuffer(int ch) return NULL; } -#ifdef TEST_OUTPUT_LV2 -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; +size_t OutputLV2::samplerate() +{ + return sample_rate; +} -#endif/*TEST_OUTPUT_LV2*/ diff --git a/lv2/output_lv2.h b/lv2/output_lv2.h index 1b4e8c9..272a78c 100644 --- a/lv2/output_lv2.h +++ b/lv2/output_lv2.h @@ -39,7 +39,7 @@ public: class OutputLV2 : public AudioOutputEngine { public: - OutputLV2(); + OutputLV2(double sample_rate); ~OutputLV2(); bool init(Channels channels); @@ -54,9 +54,13 @@ public: void post(size_t nsamples); sample_t *getBuffer(int c); + + size_t samplerate(); // sample_t *outputPort[NUM_OUTPUTS]; OutputPort outputPorts[NUM_OUTPUTS]; + + double sample_rate; }; #endif/*__DRUMGIZMO_OUTPUT_LV2_H__*/ |