aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-07-18 13:23:55 +0200
committerHarald Eilertsen <haraldei@anduin.net>2020-07-18 13:23:55 +0200
commitbd7f895d3c459a6ff1d14a6adbbb79c07133947c (patch)
treea47b5fe293b7b20352fcdf34cd34422ba211dee1
parentd5a5c482c42bd6069bf7f130fe2c3f8de71fad5e (diff)
downloadairwindows-lv2-port-bd7f895d3c459a6ff1d14a6adbbb79c07133947c.tar.gz
airwindows-lv2-port-bd7f895d3c459a6ff1d14a6adbbb79c07133947c.tar.bz2
airwindows-lv2-port-bd7f895d3c459a6ff1d14a6adbbb79c07133947c.zip
LV2/Acceleration: Use the LinuxVST processing code
-rw-r--r--plugins/LV2/src/Acceleration/Acceleration.cpp23
-rw-r--r--plugins/LV2/src/Acceleration/Acceleration.h42
2 files changed, 59 insertions, 6 deletions
diff --git a/plugins/LV2/src/Acceleration/Acceleration.cpp b/plugins/LV2/src/Acceleration/Acceleration.cpp
index dcc8734..824f4b3 100644
--- a/plugins/LV2/src/Acceleration/Acceleration.cpp
+++ b/plugins/LV2/src/Acceleration/Acceleration.cpp
@@ -53,8 +53,23 @@ void Acceleration::connect_port(uint32_t port, void * data)
void Acceleration::run(uint32_t num_samples)
{
- for (auto i = 0u; i < num_samples; i++) {
- *out[0]++ = *in[0]++ * *limit;
- *out[1]++ = *in[1]++ * *limit;
- }
+ A = *limit;
+ B = *drywet;
+ processReplacing(const_cast<float **>(in), out, num_samples);
}
+
+//
+// Helper functions to satisfy the processing code
+//
+
+double Acceleration::getSampleRate()
+{
+ return rate;
+}
+
+
+//
+// Include the processing code from the VST version.
+//
+#include <cmath>
+#include "../../../LinuxVST/src/Acceleration/AccelerationProc.cpp"
diff --git a/plugins/LV2/src/Acceleration/Acceleration.h b/plugins/LV2/src/Acceleration/Acceleration.h
index c277cb9..cfef367 100644
--- a/plugins/LV2/src/Acceleration/Acceleration.h
+++ b/plugins/LV2/src/Acceleration/Acceleration.h
@@ -1,8 +1,11 @@
-#ifndef __Acceleration_h
-#define __Acceleration_h
+#ifndef __Acceleration_H
+#define __Acceleration_H
#include <cstdint>
+// Required typa alias for VTS processing funcs.
+using VstInt32 = int32_t;
+
class Acceleration {
public:
Acceleration(double rate);
@@ -11,11 +14,46 @@ public:
void run(uint32_t num_samples);
private:
+ void processReplacing(float **in, float **out, VstInt32 samples);
+ void processDoubleReplacing(double **in, double **out, VstInt32 samples);
+
+ double getSampleRate();
+
double rate;
const float * limit;
const float * drywet;
const float * in[2];
float * out[2];
+
+ // Temp values used by the processing code
+ double A; // Value of limit when processing called
+ double B; // Value of dry/wet when processing called
+
+ // To keep state between runs
+ double ataLastOutL;
+ double s1L;
+ double s2L;
+ double s3L;
+ double o1L;
+ double o2L;
+ double o3L;
+ double m1L;
+ double m2L;
+ double desL;
+
+ double ataLastOutR;
+ double s1R;
+ double s2R;
+ double s3R;
+ double o1R;
+ double o2R;
+ double o3R;
+ double m1R;
+ double m2R;
+ double desR;
+
+ long double fpNShapeL;
+ long double fpNShapeR;
};
#endif