From cccd83938fd33631c36dd5e22ea2364a12fe5305 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 2 Sep 2020 21:35:47 +0200 Subject: LV2: Reset state on activate. This makes sure all internal parameters are initializet to sane values before processing starts. The VST version does this on construction, but it seems better (at least for LV2) to do this as part of the activate callback. This should fix noise on the start of the audio processing with the plugins. --- plugins/LV2/src/AverMatrix/AverMatrix.cpp | 13 +++++++++++++ plugins/LV2/src/AverMatrix/AverMatrix.h | 1 + 2 files changed, 14 insertions(+) (limited to 'plugins/LV2/src/AverMatrix') diff --git a/plugins/LV2/src/AverMatrix/AverMatrix.cpp b/plugins/LV2/src/AverMatrix/AverMatrix.cpp index 2c6493c..4c3dba8 100644 --- a/plugins/LV2/src/AverMatrix/AverMatrix.cpp +++ b/plugins/LV2/src/AverMatrix/AverMatrix.cpp @@ -7,6 +7,19 @@ AverMatrix::AverMatrix(double rate) { } +void AverMatrix::activate() +{ + for(int x = 0; x < 11; x++) { + f[x] = 0.0; + for (int y = 0; y < 11; y++) { + bL[x][y] = 0.0; + bR[x][y] = 0.0; + } + } + + fpd = 17; +} + void AverMatrix::run(uint32_t num_samples) { A = *params[0]; diff --git a/plugins/LV2/src/AverMatrix/AverMatrix.h b/plugins/LV2/src/AverMatrix/AverMatrix.h index 548efe8..d28f9d5 100644 --- a/plugins/LV2/src/AverMatrix/AverMatrix.h +++ b/plugins/LV2/src/AverMatrix/AverMatrix.h @@ -7,6 +7,7 @@ class AverMatrix : public LV2Plugin<3> { public: AverMatrix(double rate); + void activate() override; void run(uint32_t num_samples); static constexpr const char * URI = "https://www.airwindows.com/avermatrix"; -- cgit v1.2.3