From 271d4c04271f63d565ff0ff96415106b2c121327 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 19 Jul 2020 18:57:34 +0200 Subject: LV2: Refactor common code to base class. --- plugins/LV2/src/ADClip7/ADClip7.cpp | 12 +----------- plugins/LV2/src/ADClip7/ADClip7.h | 14 ++++++-------- 2 files changed, 7 insertions(+), 19 deletions(-) (limited to 'plugins/LV2/src/ADClip7') diff --git a/plugins/LV2/src/ADClip7/ADClip7.cpp b/plugins/LV2/src/ADClip7/ADClip7.cpp index adf6eb9..11c8c27 100644 --- a/plugins/LV2/src/ADClip7/ADClip7.cpp +++ b/plugins/LV2/src/ADClip7/ADClip7.cpp @@ -19,7 +19,7 @@ enum class PortIndex : uint32_t { } // anon namespace ADClip7::ADClip7(double rate) - : rate(rate) + : LV2Plugin(rate) , refclipL(0.99) , refclipR(0.99) { @@ -75,16 +75,6 @@ void ADClip7::run(uint32_t num_samples) processReplacing(const_cast(in), out, num_samples); } -// -// Helper functions to satisfy the processing code -// - -double ADClip7::getSampleRate() -{ - return rate; -} - - // // Include the processing code from the VST version. // diff --git a/plugins/LV2/src/ADClip7/ADClip7.h b/plugins/LV2/src/ADClip7/ADClip7.h index cfe7f40..e3d8474 100644 --- a/plugins/LV2/src/ADClip7/ADClip7.h +++ b/plugins/LV2/src/ADClip7/ADClip7.h @@ -2,11 +2,9 @@ #define __ADClip7_H #include +#include -// Required typa alias for VTS processing funcs. -using VstInt32 = int32_t; - -class ADClip7 { +class ADClip7 : protected LV2Plugin { public: ADClip7(double rate); @@ -16,13 +14,13 @@ public: static constexpr const char * URI = "https://www.airwindows.com/adclip-7"; private: + /* + * These are the original DSP functions from the VST plugin. + * They need to be called from the LV2 plugins `run` function. + */ void processReplacing(float **in, float **out, VstInt32 samples); void processDoubleReplacing(double **in, double **out, VstInt32 samples); - double getSampleRate(); - - double rate; - // Pointers to control ports const float * boost; const float * soften; -- cgit v1.2.3