From e3035058fb56b0d507df942b6b89099b2e1a288f Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 19 Jul 2020 21:00:49 +0200 Subject: LV2: Add plugin ADT. --- plugins/LV2/CMakeLists.txt | 2 +- plugins/LV2/src/ADT/ADT.cpp | 94 +++++++++++++++++++++++++++++++++++++ plugins/LV2/src/ADT/ADT.h | 56 ++++++++++++++++++++++ plugins/LV2/src/ADT/ADT.ttl | 84 +++++++++++++++++++++++++++++++++ plugins/LV2/src/ADT/manifest.ttl.in | 12 +++++ 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 plugins/LV2/src/ADT/ADT.cpp create mode 100644 plugins/LV2/src/ADT/ADT.h create mode 100644 plugins/LV2/src/ADT/ADT.ttl create mode 100644 plugins/LV2/src/ADT/manifest.ttl.in 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 +#include + +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(port)) { + case PortIndex::HEADRM: + headroom = static_cast(data); + break; + + case PortIndex::A_DELAY: + a_delay = static_cast(data); + break; + + case PortIndex::A_LEVEL: + a_level = static_cast(data); + break; + + case PortIndex::B_DELAY: + b_delay = static_cast(data); + break; + + case PortIndex::B_LEVEL: + b_level = static_cast(data); + break; + + case PortIndex::OUTPUT: + out_level = static_cast(data); + break; + + case PortIndex::IN_L: + in[0] = static_cast(data); + break; + + case PortIndex::IN_R: + in[1] = static_cast(data); + break; + + case PortIndex::OUT_L: + out[0] = static_cast(data); + break; + + case PortIndex::OUT_R: + out[1] = static_cast(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(in), out, num_samples); +} + +// +// Include the processing code from the VST version. +// +#include +#include "../../../LinuxVST/src/ADT/ADTProc.cpp" + +// Create the LV2Wrapper and register the plugin +LV2Wrapper 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 +#include + +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: . +@prefix rdf: . +@prefix rdfs: . +@prefix units: . + + + a lv2:Plugin , + lv2:DelayPlugin ; + lv2:project ; + + 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: . +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + doap:name "Airwindows Adjustable Delay Taps" ; + doap:license ; + lv2:binary ; + rdfs:seeAlso . -- cgit v1.2.3