From d94ee6218b6e3f65554c133d9e09044b99f86396 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 19 Jul 2020 21:31:15 +0200 Subject: LV2: Add plugin Air --- plugins/LV2/CMakeLists.txt | 2 +- plugins/LV2/src/Air/Air.cpp | 94 +++++++++++++++++++++++++++++++++++++ plugins/LV2/src/Air/Air.h | 93 ++++++++++++++++++++++++++++++++++++ plugins/LV2/src/Air/Air.ttl | 84 +++++++++++++++++++++++++++++++++ plugins/LV2/src/Air/manifest.ttl.in | 12 +++++ 5 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 plugins/LV2/src/Air/Air.cpp create mode 100644 plugins/LV2/src/Air/Air.h create mode 100644 plugins/LV2/src/Air/Air.ttl create mode 100644 plugins/LV2/src/Air/manifest.ttl.in 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 +#include + +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(port)) { + case PortIndex::TAP22: + tap22 = static_cast(data); + break; + + case PortIndex::TAP15: + tap15 = static_cast(data); + break; + + case PortIndex::TAP11: + tap11 = static_cast(data); + break; + + case PortIndex::FILTERS_Q: + filters_q = static_cast(data); + break; + + case PortIndex::OUTPUT: + out_level = static_cast(data); + break; + + case PortIndex::DRY_WET: + dry_wet = 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 Air::run(uint32_t num_samples) +{ + A = *tap22; + B = *tap15; + C = *tap11; + D = *filters_q; + E = *out_level; + F = *dry_wet; + + processReplacing(const_cast(in), out, num_samples); +} + +// +// Include the processing code from the VST version. +// +#include +#include "../../../LinuxVST/src/Air/AirProc.cpp" + +// Create the LV2Wrapper and register the plugin +LV2Wrapper 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 +#include + +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: . +@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 "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: . +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + doap:name "Airwindows Air" ; + doap:license ; + lv2:binary ; + rdfs:seeAlso . -- cgit v1.2.3