aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-07-19 21:00:49 +0200
committerHarald Eilertsen <haraldei@anduin.net>2020-07-19 21:00:49 +0200
commite3035058fb56b0d507df942b6b89099b2e1a288f (patch)
tree836c6ec5f141e2fc47ce82ed5faf5541aac7b6f3
parent271d4c04271f63d565ff0ff96415106b2c121327 (diff)
downloadairwindows-lv2-port-e3035058fb56b0d507df942b6b89099b2e1a288f.tar.gz
airwindows-lv2-port-e3035058fb56b0d507df942b6b89099b2e1a288f.tar.bz2
airwindows-lv2-port-e3035058fb56b0d507df942b6b89099b2e1a288f.zip
LV2: Add plugin ADT.
-rwxr-xr-xplugins/LV2/CMakeLists.txt2
-rw-r--r--plugins/LV2/src/ADT/ADT.cpp94
-rw-r--r--plugins/LV2/src/ADT/ADT.h56
-rw-r--r--plugins/LV2/src/ADT/ADT.ttl84
-rw-r--r--plugins/LV2/src/ADT/manifest.ttl.in12
5 files changed, 247 insertions, 1 deletions
diff --git a/plugins/LV2/CMakeLists.txt b/plugins/LV2/CMakeLists.txt
index 4923f92..0ddeafe 100755
--- a/plugins/LV2/CMakeLists.txt
+++ b/plugins/LV2/CMakeLists.txt
@@ -11,7 +11,7 @@ include_directories(include)
# add_subdirectory(include/vstsdk)
add_airwindows_plugin(Acceleration)
add_airwindows_plugin(ADClip7)
-# add_airwindows_plugin(ADT)
+add_airwindows_plugin(ADT)
# add_airwindows_plugin(Air)
# add_airwindows_plugin(Apicolypse)
# add_airwindows_plugin(AQuickVoiceClip)
diff --git a/plugins/LV2/src/ADT/ADT.cpp b/plugins/LV2/src/ADT/ADT.cpp
new file mode 100644
index 0000000..66423b2
--- /dev/null
+++ b/plugins/LV2/src/ADT/ADT.cpp
@@ -0,0 +1,94 @@
+#include "ADT.h"
+#include <iostream>
+#include <lv2wrapper.h>
+
+namespace {
+
+enum class PortIndex : uint32_t {
+ HEADRM,
+ A_DELAY,
+ A_LEVEL,
+ B_DELAY,
+ B_LEVEL,
+ OUTPUT,
+ IN_L,
+ IN_R,
+ OUT_L,
+ OUT_R,
+};
+
+} // anon namespace
+
+ADT::ADT(double rate)
+ : LV2Plugin(rate)
+{
+}
+
+void ADT::connect_port(uint32_t port, void * data)
+{
+ switch (static_cast<PortIndex>(port)) {
+ case PortIndex::HEADRM:
+ headroom = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::A_DELAY:
+ a_delay = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::A_LEVEL:
+ a_level = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::B_DELAY:
+ b_delay = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::B_LEVEL:
+ b_level = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::OUTPUT:
+ out_level = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::IN_L:
+ in[0] = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::IN_R:
+ in[1] = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::OUT_L:
+ out[0] = static_cast<float *>(data);
+ break;
+
+ case PortIndex::OUT_R:
+ out[1] = static_cast<float *>(data);
+ break;
+
+ default:
+ std::cerr << "Invalid port " << port << ": ignoring." << std::endl;
+ }
+}
+
+void ADT::run(uint32_t num_samples)
+{
+ A = *headroom;
+ B = *a_delay;
+ C = *a_level;
+ D = *b_delay;
+ E = *b_level;
+ F = *out_level;
+
+ processReplacing(const_cast<float **>(in), out, num_samples);
+}
+
+//
+// Include the processing code from the VST version.
+//
+#include <cmath>
+#include "../../../LinuxVST/src/ADT/ADTProc.cpp"
+
+// Create the LV2Wrapper and register the plugin
+LV2Wrapper<ADT> accel;
diff --git a/plugins/LV2/src/ADT/ADT.h b/plugins/LV2/src/ADT/ADT.h
new file mode 100644
index 0000000..e76ae87
--- /dev/null
+++ b/plugins/LV2/src/ADT/ADT.h
@@ -0,0 +1,56 @@
+#ifndef __ADT_H
+#define __ADT_H
+
+#include <cstdint>
+#include <lv2plugin.h>
+
+class ADT : protected LV2Plugin {
+public:
+ ADT(double rate);
+
+ void connect_port(uint32_t port, void * data);
+ void run(uint32_t num_samples);
+
+ static constexpr const char * URI = "https://www.airwindows.com/adt";
+
+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);
+
+ const float * headroom;
+ const float * a_delay;
+ const float * a_level;
+ const float * b_delay;
+ const float * b_level;
+ const float * out_level;
+
+ const float * in[2];
+ float * out[2];
+
+ /*
+ * Members needed by the processing functions.
+ */
+ double pL[10000];
+ double pR[10000];
+ int gcount;
+ double offsetA;
+ double offsetB;
+
+ long double fpNShapeL;
+ long double fpNShapeR;
+
+ //default stuff
+
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+};
+
+#endif
diff --git a/plugins/LV2/src/ADT/ADT.ttl b/plugins/LV2/src/ADT/ADT.ttl
new file mode 100644
index 0000000..32ec128
--- /dev/null
+++ b/plugins/LV2/src/ADT/ADT.ttl
@@ -0,0 +1,84 @@
+# Airwindows ADT plugin description
+
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix units: <http://lv2plug.in/ns/extensions/units#> .
+
+<https://www.airwindows.com/adt>
+ a lv2:Plugin ,
+ lv2:DelayPlugin ;
+ lv2:project <https://www.airwindows.com> ;
+
+ lv2:optionalFeature lv2:hardRTCapable ;
+
+ # Define the ports for this plugin.
+ lv2:port [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "A" ;
+ lv2:name "Headroom" ;
+ lv2:default 0.5 ;
+ lv2:minimum 0.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 1 ;
+ lv2:symbol "B" ;
+ lv2:name "A Delay" ;
+ lv2:default 0.5 ;
+ lv2:minimum 0.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 2 ;
+ lv2:symbol "C" ;
+ lv2:name "A Level" ;
+ lv2:default 0.5 ;
+ lv2:minimum 0.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 3 ;
+ lv2:symbol "D" ;
+ lv2:name "B Delay" ;
+ lv2:default 0.5 ;
+ lv2:minimum 0.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 4 ;
+ lv2:symbol "E" ;
+ lv2:name "B Level" ;
+ lv2:default 0.5 ;
+ lv2:minimum 0.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 5 ;
+ lv2:symbol "F" ;
+ lv2:name "Output" ;
+ lv2:default 0.5 ;
+ lv2:minimum 0.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:AudioPort ;
+ lv2:index 6 ;
+ lv2:symbol "in_l" ;
+ lv2:name "In left" ;
+ ] , [
+ a lv2:InputPort , lv2:AudioPort ;
+ lv2:index 7 ;
+ lv2:symbol "in_r" ;
+ lv2:name "In right" ;
+ ] , [
+ a lv2:OutputPort , lv2:AudioPort ;
+ lv2:index 8 ;
+ lv2:symbol "out_l" ;
+ lv2:name "Out left" ;
+ ] , [
+ a lv2:OutputPort , lv2:AudioPort ;
+ lv2:index 9 ;
+ lv2:symbol "out_r" ;
+ lv2:name "Out right" ;
+ ] .
diff --git a/plugins/LV2/src/ADT/manifest.ttl.in b/plugins/LV2/src/ADT/manifest.ttl.in
new file mode 100644
index 0000000..9f2b511
--- /dev/null
+++ b/plugins/LV2/src/ADT/manifest.ttl.in
@@ -0,0 +1,12 @@
+# LV2 Plugin manifest for airwindows ADT plugin
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<https://www.airwindows.com/adt>
+ a lv2:Plugin ;
+ doap:name "Airwindows Adjustable Delay Taps" ;
+ doap:license <http://opensource.org/licenses/mit> ;
+ lv2:binary <ADT@CMAKE_SHARED_LIBRARY_SUFFIX@> ;
+ rdfs:seeAlso <ADT.ttl> .