aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2020-07-19 21:31:15 +0200
committerHarald Eilertsen <haraldei@anduin.net>2020-07-19 21:31:15 +0200
commitd94ee6218b6e3f65554c133d9e09044b99f86396 (patch)
tree2788a56f3550c5eba70c25e0f854b112ccfb190e
parente3035058fb56b0d507df942b6b89099b2e1a288f (diff)
downloadairwindows-lv2-port-d94ee6218b6e3f65554c133d9e09044b99f86396.tar.gz
airwindows-lv2-port-d94ee6218b6e3f65554c133d9e09044b99f86396.tar.bz2
airwindows-lv2-port-d94ee6218b6e3f65554c133d9e09044b99f86396.zip
LV2: Add plugin Air
-rwxr-xr-xplugins/LV2/CMakeLists.txt2
-rw-r--r--plugins/LV2/src/Air/Air.cpp94
-rw-r--r--plugins/LV2/src/Air/Air.h93
-rw-r--r--plugins/LV2/src/Air/Air.ttl84
-rw-r--r--plugins/LV2/src/Air/manifest.ttl.in12
5 files changed, 284 insertions, 1 deletions
diff --git a/plugins/LV2/CMakeLists.txt b/plugins/LV2/CMakeLists.txt
index 0ddeafe..2896693 100755
--- a/plugins/LV2/CMakeLists.txt
+++ b/plugins/LV2/CMakeLists.txt
@@ -12,7 +12,7 @@ include_directories(include)
add_airwindows_plugin(Acceleration)
add_airwindows_plugin(ADClip7)
add_airwindows_plugin(ADT)
-# add_airwindows_plugin(Air)
+add_airwindows_plugin(Air)
# add_airwindows_plugin(Apicolypse)
# add_airwindows_plugin(AQuickVoiceClip)
# add_airwindows_plugin(AtmosphereBuss)
diff --git a/plugins/LV2/src/Air/Air.cpp b/plugins/LV2/src/Air/Air.cpp
new file mode 100644
index 0000000..0783317
--- /dev/null
+++ b/plugins/LV2/src/Air/Air.cpp
@@ -0,0 +1,94 @@
+#include "Air.h"
+#include <iostream>
+#include <lv2wrapper.h>
+
+namespace {
+
+enum class PortIndex : uint32_t {
+ TAP22,
+ TAP15,
+ TAP11,
+ FILTERS_Q,
+ OUTPUT,
+ DRY_WET,
+ IN_L,
+ IN_R,
+ OUT_L,
+ OUT_R,
+};
+
+} // anon namespace
+
+Air::Air(double rate)
+ : LV2Plugin(rate)
+{
+}
+
+void Air::connect_port(uint32_t port, void * data)
+{
+ switch (static_cast<PortIndex>(port)) {
+ case PortIndex::TAP22:
+ tap22 = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::TAP15:
+ tap15 = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::TAP11:
+ tap11 = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::FILTERS_Q:
+ filters_q = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::OUTPUT:
+ out_level = static_cast<const float *>(data);
+ break;
+
+ case PortIndex::DRY_WET:
+ dry_wet = 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 Air::run(uint32_t num_samples)
+{
+ A = *tap22;
+ B = *tap15;
+ C = *tap11;
+ D = *filters_q;
+ E = *out_level;
+ F = *dry_wet;
+
+ processReplacing(const_cast<float **>(in), out, num_samples);
+}
+
+//
+// Include the processing code from the VST version.
+//
+#include <cmath>
+#include "../../../LinuxVST/src/Air/AirProc.cpp"
+
+// Create the LV2Wrapper and register the plugin
+LV2Wrapper<Air> air;
diff --git a/plugins/LV2/src/Air/Air.h b/plugins/LV2/src/Air/Air.h
new file mode 100644
index 0000000..580650a
--- /dev/null
+++ b/plugins/LV2/src/Air/Air.h
@@ -0,0 +1,93 @@
+#ifndef __Air_H
+#define __Air_H
+
+#include <cstdint>
+#include <lv2plugin.h>
+
+class Air : protected LV2Plugin {
+public:
+ Air(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/air";
+
+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 * tap22;
+ const float * tap15;
+ const float * tap11;
+ const float * filters_q;
+ const float * out_level;
+ const float * dry_wet;
+
+ const float * in[2];
+ float * out[2];
+
+ /*
+ * Members needed by the processing functions.
+ */
+ double airPrevAL;
+ double airEvenAL;
+ double airOddAL;
+ double airFactorAL;
+ double airPrevBL;
+ double airEvenBL;
+ double airOddBL;
+ double airFactorBL;
+ double airPrevCL;
+ double airEvenCL;
+ double airOddCL;
+ double airFactorCL;
+ double tripletPrevL;
+ double tripletMidL;
+ double tripletAL;
+ double tripletBL;
+ double tripletCL;
+ double tripletFactorL;
+
+ double airPrevAR;
+ double airEvenAR;
+ double airOddAR;
+ double airFactorAR;
+ double airPrevBR;
+ double airEvenBR;
+ double airOddBR;
+ double airFactorBR;
+ double airPrevCR;
+ double airEvenCR;
+ double airOddCR;
+ double airFactorCR;
+ double tripletPrevR;
+ double tripletMidR;
+ double tripletAR;
+ double tripletBR;
+ double tripletCR;
+ double tripletFactorR;
+
+ bool flipA;
+ bool flipB;
+ bool flop;
+ int count;
+
+ long double fpNShapeL;
+ long double fpNShapeR;
+ //
+ //default stuff
+
+ float A;
+ float B;
+ float C;
+ float D; //parameters. Always 0-1, and we scale/alter them elsewhere.
+ float E;
+ float F;
+};
+
+#endif
diff --git a/plugins/LV2/src/Air/Air.ttl b/plugins/LV2/src/Air/Air.ttl
new file mode 100644
index 0000000..0bcffc9
--- /dev/null
+++ b/plugins/LV2/src/Air/Air.ttl
@@ -0,0 +1,84 @@
+# Airwindows Air 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/air>
+ 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 "22K tap" ;
+ 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 "15K tap" ;
+ 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 "11K tap" ;
+ 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 "filters Q" ;
+ lv2:default 0.5 ;
+ lv2:minimum 1.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 4 ;
+ lv2:symbol "E" ;
+ lv2:name "Output level" ;
+ lv2:default 0.5 ;
+ lv2:minimum 1.0 ;
+ lv2:maximum 1.0 ;
+ ] , [
+ a lv2:InputPort , lv2:ControlPort ;
+ lv2:index 5 ;
+ lv2:symbol "F" ;
+ lv2:name "Dry/Wet" ;
+ 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/Air/manifest.ttl.in b/plugins/LV2/src/Air/manifest.ttl.in
new file mode 100644
index 0000000..9bcf114
--- /dev/null
+++ b/plugins/LV2/src/Air/manifest.ttl.in
@@ -0,0 +1,12 @@
+# LV2 Plugin manifest for airwindows Air 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/air>
+ a lv2:Plugin ;
+ doap:name "Airwindows Air" ;
+ doap:license <http://opensource.org/licenses/mit> ;
+ lv2:binary <Air@CMAKE_SHARED_LIBRARY_SUFFIX@> ;
+ rdfs:seeAlso <Air.ttl> .