diff options
Diffstat (limited to 'lv2/output_lv2.cc')
-rw-r--r-- | lv2/output_lv2.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lv2/output_lv2.cc b/lv2/output_lv2.cc index 226b92a..8187a5a 100644 --- a/lv2/output_lv2.cc +++ b/lv2/output_lv2.cc @@ -30,7 +30,10 @@ OutputLV2::OutputLV2() { - for(size_t i = 0; i < NUM_OUTPUTS; i++) outputPort[i] = NULL; + for(size_t i = 0; i < NUM_OUTPUTS; i++) { + outputPorts[i].size = 0; + outputPorts[i].samples = NULL; + } } OutputLV2::~OutputLV2() @@ -59,11 +62,14 @@ void OutputLV2::pre(size_t nsamples) { } +#include <stdio.h> void OutputLV2::run(int ch, sample_t *samples, size_t nsamples) { if(ch < NUM_OUTPUTS) { - if(outputPort[ch]) - memcpy(outputPort[ch], samples, nsamples * sizeof(sample_t)); + // if(outputPorts[ch].size != nsamples) printf("port.%d nsamples.%d\n", outputPorts[ch].size, nsamples); + if(outputPorts[ch].samples) { + memcpy(outputPorts[ch].samples, samples, nsamples * sizeof(sample_t)); + } } } @@ -71,6 +77,12 @@ void OutputLV2::post(size_t nsamples) { } +sample_t *OutputLV2::getBuffer(int ch) +{ + if(ch < NUM_OUTPUTS) return outputPorts[ch].samples; + return NULL; +} + #ifdef TEST_OUTPUT_LV2 //Additional dependency files //deps: |