aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-07-16 10:27:01 +0200
committerHarald Eilertsen <haraldei@anduin.net>2020-07-16 10:27:01 +0200
commit8d8d55aba4c5388fff3681db268cefecd548367a (patch)
tree82a3d1e9a812998d45f1b80c3bd477dd73d9b208
parent15b62ea6eea93d395fff743fa33795823ab0447c (diff)
downloadairwindows-lv2-port-8d8d55aba4c5388fff3681db268cefecd548367a.tar.gz
airwindows-lv2-port-8d8d55aba4c5388fff3681db268cefecd548367a.tar.bz2
airwindows-lv2-port-8d8d55aba4c5388fff3681db268cefecd548367a.zip
LV2: Make Acceleration class instead of POD struct.
The sneaky plan is to have this make use of the processing function(s) from the LinuxVST variant, so we don't have to copy code.
-rw-r--r--plugins/LV2/src/Acceleration/Acceleration.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/LV2/src/Acceleration/Acceleration.cpp b/plugins/LV2/src/Acceleration/Acceleration.cpp
index 7128859..669df75 100644
--- a/plugins/LV2/src/Acceleration/Acceleration.cpp
+++ b/plugins/LV2/src/Acceleration/Acceleration.cpp
@@ -15,7 +15,8 @@ enum PortIndex {
ACCELERATION_OUT_R,
};
-struct acceleration {
+class Acceleration {
+public:
const float * limit;
const float * drywet;
const float * in[2];
@@ -28,7 +29,7 @@ LV2_Handle instantiate(
const char * path,
const LV2_Feature * const * features)
{
- return calloc(1, sizeof(acceleration));
+ return new Acceleration{};
}
void connect_port(
@@ -36,7 +37,7 @@ void connect_port(
uint32_t port,
void * data)
{
- auto accel = (acceleration *) instance;
+ auto accel = static_cast<Acceleration *>(instance);
switch (port) {
case ACCELERATION_LIMIT:
@@ -74,7 +75,7 @@ void activate(LV2_Handle instance)
void run(LV2_Handle instance, uint32_t num_samples)
{
- auto accel = (acceleration *) instance;
+ auto accel = static_cast<Acceleration *>(instance);
for (auto i = 0u; i < num_samples; i++) {
*accel->out[0]++ = *accel->in[0]++;
*accel->out[1]++ = *accel->in[1]++;
@@ -87,7 +88,7 @@ void deactivate(LV2_Handle)
void destroy(LV2_Handle instance)
{
- free(instance);
+ delete static_cast<Acceleration *>(instance);
}
const void * extension_data(const char * uri)