aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LinuxVST
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2019-08-18 15:56:09 -0400
committerChris Johnson <jinx6568@sover.net>2019-08-18 15:56:09 -0400
commited847692d3e120b8c64b42d2a073d5b6bb033981 (patch)
tree1f7ee541a72b62fa1ea6f586567caf5cf10b2c1d /plugins/LinuxVST
parent7a548964e81440e6752e87e525d074432ddb94ee (diff)
downloadairwindows-lv2-port-ed847692d3e120b8c64b42d2a073d5b6bb033981.tar.gz
airwindows-lv2-port-ed847692d3e120b8c64b42d2a073d5b6bb033981.tar.bz2
airwindows-lv2-port-ed847692d3e120b8c64b42d2a073d5b6bb033981.zip
Interstage
Diffstat (limited to 'plugins/LinuxVST')
-rwxr-xr-xplugins/LinuxVST/CMakeLists.txt1
-rwxr-xr-xplugins/LinuxVST/src/Interstage/Interstage.cpp107
-rwxr-xr-xplugins/LinuxVST/src/Interstage/Interstage.h72
-rwxr-xr-xplugins/LinuxVST/src/Interstage/InterstageProc.cpp182
4 files changed, 362 insertions, 0 deletions
diff --git a/plugins/LinuxVST/CMakeLists.txt b/plugins/LinuxVST/CMakeLists.txt
index 476a386..9ca381a 100755
--- a/plugins/LinuxVST/CMakeLists.txt
+++ b/plugins/LinuxVST/CMakeLists.txt
@@ -95,6 +95,7 @@ add_airwindows_plugin(Highpass)
add_airwindows_plugin(Highpass2)
add_airwindows_plugin(Holt)
add_airwindows_plugin(Hombre)
+add_airwindows_plugin(Interstage)
add_airwindows_plugin(IronOxide5)
add_airwindows_plugin(IronOxideClassic)
add_airwindows_plugin(Logical4)
diff --git a/plugins/LinuxVST/src/Interstage/Interstage.cpp b/plugins/LinuxVST/src/Interstage/Interstage.cpp
new file mode 100755
index 0000000..9c8acdd
--- /dev/null
+++ b/plugins/LinuxVST/src/Interstage/Interstage.cpp
@@ -0,0 +1,107 @@
+/* ========================================
+ * Interstage - Interstage.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __Interstage_H
+#include "Interstage.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new Interstage(audioMaster);}
+
+Interstage::Interstage(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ iirSampleAL = 0.0;
+ iirSampleBL = 0.0;
+ iirSampleCL = 0.0;
+ iirSampleDL = 0.0;
+ iirSampleEL = 0.0;
+ iirSampleFL = 0.0;
+ lastSampleL = 0.0;
+ iirSampleAR = 0.0;
+ iirSampleBR = 0.0;
+ iirSampleCR = 0.0;
+ iirSampleDR = 0.0;
+ iirSampleER = 0.0;
+ iirSampleFR = 0.0;
+ lastSampleR = 0.0;
+ fpd = 17;
+ flip = true;
+ //this is reset: values being initialized only once. Startup values, whatever they are.
+
+ _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.
+ _canDo.insert("plugAsSend"); // plug-in can be used as a send effect.
+ _canDo.insert("x2in2out");
+ setNumInputs(kNumInputs);
+ setNumOutputs(kNumOutputs);
+ setUniqueID(kUniqueId);
+ canProcessReplacing(); // supports output replacing
+ canDoubleReplacing(); // supports double precision processing
+ programsAreChunks(true);
+ vst_strncpy (_programName, "Default", kVstMaxProgNameLen); // default program name
+}
+
+Interstage::~Interstage() {}
+VstInt32 Interstage::getVendorVersion () {return 1000;}
+void Interstage::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void Interstage::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMaxProgNameLen);}
+//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
+//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
+
+VstInt32 Interstage::getChunk (void** data, bool isPreset)
+{
+ return 0;
+}
+
+VstInt32 Interstage::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void Interstage::setParameter(VstInt32 index, float value) {
+ switch (index) {
+ default: throw; // unknown parameter, shouldn't happen!
+ }
+}
+
+float Interstage::getParameter(VstInt32 index) {
+ switch (index) {
+ default: break; // unknown parameter, shouldn't happen!
+ } return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void Interstage::getParameterName(VstInt32 index, char *text) {
+ switch (index) {
+ default: break; // unknown parameter, shouldn't happen!
+ } //this is our labels for displaying in the VST host
+}
+
+void Interstage::getParameterDisplay(VstInt32 index, char *text) {
+ switch (index) {
+ default: break; // unknown parameter, shouldn't happen!
+ } //this displays the values and handles 'popups' where it's discrete choices
+}
+
+void Interstage::getParameterLabel(VstInt32 index, char *text) {
+ switch (index) {
+ default: break; // unknown parameter, shouldn't happen!
+ }
+}
+
+VstInt32 Interstage::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool Interstage::getEffectName(char* name) {
+ vst_strncpy(name, "Interstage", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory Interstage::getPlugCategory() {return kPlugCategEffect;}
+
+bool Interstage::getProductString(char* text) {
+ vst_strncpy (text, "airwindows Interstage", kVstMaxProductStrLen); return true;
+}
+
+bool Interstage::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/Interstage/Interstage.h b/plugins/LinuxVST/src/Interstage/Interstage.h
new file mode 100755
index 0000000..146b84c
--- /dev/null
+++ b/plugins/LinuxVST/src/Interstage/Interstage.h
@@ -0,0 +1,72 @@
+/* ========================================
+ * Interstage - Interstage.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __Interstage_H
+#define __Interstage_H
+
+#ifndef __audioeffect__
+#include "audioeffectx.h"
+#endif
+
+#include <set>
+#include <string>
+#include <math.h>
+
+enum {
+ kNumParameters = 0
+}; //
+
+const int kNumPrograms = 0;
+const int kNumInputs = 2;
+const int kNumOutputs = 2;
+const unsigned long kUniqueId = 'inte'; //Change this to what the AU identity is!
+
+class Interstage :
+ public AudioEffectX
+{
+public:
+ Interstage(audioMasterCallback audioMaster);
+ ~Interstage();
+ virtual bool getEffectName(char* name); // The plug-in name
+ virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
+ virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
+ virtual bool getVendorString(char* text); // Vendor info
+ virtual VstInt32 getVendorVersion(); // Version number
+ virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
+ virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
+ virtual void getProgramName(char *name); // read the name from the host
+ virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
+ virtual VstInt32 getChunk (void** data, bool isPreset);
+ virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
+ virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
+ virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
+ virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
+ virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
+ virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
+ virtual VstInt32 canDo(char *text);
+private:
+ char _programName[kVstMaxProgNameLen + 1];
+ std::set< std::string > _canDo;
+
+ double iirSampleAL;
+ double iirSampleBL;
+ double iirSampleCL;
+ double iirSampleDL;
+ double iirSampleEL;
+ double iirSampleFL;
+ long double lastSampleL;
+ double iirSampleAR;
+ double iirSampleBR;
+ double iirSampleCR;
+ double iirSampleDR;
+ double iirSampleER;
+ double iirSampleFR;
+ long double lastSampleR;
+ uint32_t fpd;
+ bool flip;
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/Interstage/InterstageProc.cpp b/plugins/LinuxVST/src/Interstage/InterstageProc.cpp
new file mode 100755
index 0000000..16f3ba1
--- /dev/null
+++ b/plugins/LinuxVST/src/Interstage/InterstageProc.cpp
@@ -0,0 +1,182 @@
+/* ========================================
+ * Interstage - Interstage.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __Interstage_H
+#include "Interstage.h"
+#endif
+
+void Interstage::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ double overallscale = 1.0;
+ overallscale /= 44100.0;
+ overallscale *= getSampleRate();
+
+ double firstStage = 0.381966011250105 / overallscale;
+ double iirAmount = 0.00295 / overallscale;
+ double threshold = 0.381966011250105 / overallscale;
+
+ while (--sampleFrames >= 0)
+ {
+ long double inputSampleL = *in1;
+ long double inputSampleR = *in2;
+ if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
+ if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
+ long double drySampleL = inputSampleL;
+ long double drySampleR = inputSampleR;
+
+ inputSampleL = (inputSampleL+lastSampleL)*0.5;
+ inputSampleR = (inputSampleR+lastSampleR)*0.5; //start the lowpassing with an average
+
+ if (flip) {
+ iirSampleAL = (iirSampleAL * (1 - firstStage)) + (inputSampleL * firstStage); inputSampleL = iirSampleAL;
+ iirSampleCL = (iirSampleCL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleCL;
+ iirSampleEL = (iirSampleEL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleEL;
+ inputSampleL = drySampleL - inputSampleL;
+ //make highpass
+ if (inputSampleL - iirSampleAL > threshold) inputSampleL = iirSampleAL + threshold;
+ if (inputSampleL - iirSampleAL < -threshold) inputSampleL = iirSampleAL - threshold;
+ //slew limit against lowpassed reference point
+
+ iirSampleAR = (iirSampleAR * (1 - firstStage)) + (inputSampleR * firstStage); inputSampleR = iirSampleAR;
+ iirSampleCR = (iirSampleCR * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleCR;
+ iirSampleER = (iirSampleER * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleER;
+ inputSampleR = drySampleR - inputSampleR;
+ //make highpass
+ if (inputSampleR - iirSampleAR > threshold) inputSampleR = iirSampleAR + threshold;
+ if (inputSampleR - iirSampleAR < -threshold) inputSampleR = iirSampleAR - threshold;
+ //slew limit against lowpassed reference point
+ } else {
+ iirSampleBL = (iirSampleBL * (1 - firstStage)) + (inputSampleL * firstStage); inputSampleL = iirSampleBL;
+ iirSampleDL = (iirSampleDL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleDL;
+ iirSampleFL = (iirSampleFL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleFL;
+ inputSampleL = drySampleL - inputSampleL;
+ //make highpass
+ if (inputSampleL - iirSampleBL > threshold) inputSampleL = iirSampleBL + threshold;
+ if (inputSampleL - iirSampleBL < -threshold) inputSampleL = iirSampleBL - threshold;
+ //slew limit against lowpassed reference point
+
+ iirSampleBR = (iirSampleBR * (1 - firstStage)) + (inputSampleR * firstStage); inputSampleR = iirSampleBR;
+ iirSampleDR = (iirSampleDR * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleDR;
+ iirSampleFR = (iirSampleFR * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleFR;
+ inputSampleR = drySampleR - inputSampleR;
+ //make highpass
+ if (inputSampleR - iirSampleBR > threshold) inputSampleR = iirSampleBR + threshold;
+ if (inputSampleR - iirSampleBR < -threshold) inputSampleR = iirSampleBR - threshold;
+ //slew limit against lowpassed reference point
+ }
+ flip = !flip;
+ lastSampleL = inputSampleL;
+ lastSampleR = inputSampleR;
+
+ //begin 32 bit stereo floating point dither
+ int expon; frexpf((float)inputSampleL, &expon);
+ fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
+ inputSampleL += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
+ frexpf((float)inputSampleR, &expon);
+ fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
+ inputSampleR += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
+ //end 32 bit stereo floating point dither
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void Interstage::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ double overallscale = 1.0;
+ overallscale /= 44100.0;
+ overallscale *= getSampleRate();
+
+ double firstStage = 0.381966011250105 / overallscale;
+ double iirAmount = 0.00295 / overallscale;
+ double threshold = 0.381966011250105 / overallscale;
+
+ while (--sampleFrames >= 0)
+ {
+ long double inputSampleL = *in1;
+ long double inputSampleR = *in2;
+ if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
+ if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
+ long double drySampleL = inputSampleL;
+ long double drySampleR = inputSampleR;
+
+ inputSampleL = (inputSampleL+lastSampleL)*0.5;
+ inputSampleR = (inputSampleR+lastSampleR)*0.5; //start the lowpassing with an average
+
+ if (flip) {
+ iirSampleAL = (iirSampleAL * (1 - firstStage)) + (inputSampleL * firstStage); inputSampleL = iirSampleAL;
+ iirSampleCL = (iirSampleCL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleCL;
+ iirSampleEL = (iirSampleEL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleEL;
+ inputSampleL = drySampleL - inputSampleL;
+ //make highpass
+ if (inputSampleL - iirSampleAL > threshold) inputSampleL = iirSampleAL + threshold;
+ if (inputSampleL - iirSampleAL < -threshold) inputSampleL = iirSampleAL - threshold;
+ //slew limit against lowpassed reference point
+
+ iirSampleAR = (iirSampleAR * (1 - firstStage)) + (inputSampleR * firstStage); inputSampleR = iirSampleAR;
+ iirSampleCR = (iirSampleCR * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleCR;
+ iirSampleER = (iirSampleER * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleER;
+ inputSampleR = drySampleR - inputSampleR;
+ //make highpass
+ if (inputSampleR - iirSampleAR > threshold) inputSampleR = iirSampleAR + threshold;
+ if (inputSampleR - iirSampleAR < -threshold) inputSampleR = iirSampleAR - threshold;
+ //slew limit against lowpassed reference point
+ } else {
+ iirSampleBL = (iirSampleBL * (1 - firstStage)) + (inputSampleL * firstStage); inputSampleL = iirSampleBL;
+ iirSampleDL = (iirSampleDL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleDL;
+ iirSampleFL = (iirSampleFL * (1 - iirAmount)) + (inputSampleL * iirAmount); inputSampleL = iirSampleFL;
+ inputSampleL = drySampleL - inputSampleL;
+ //make highpass
+ if (inputSampleL - iirSampleBL > threshold) inputSampleL = iirSampleBL + threshold;
+ if (inputSampleL - iirSampleBL < -threshold) inputSampleL = iirSampleBL - threshold;
+ //slew limit against lowpassed reference point
+
+ iirSampleBR = (iirSampleBR * (1 - firstStage)) + (inputSampleR * firstStage); inputSampleR = iirSampleBR;
+ iirSampleDR = (iirSampleDR * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleDR;
+ iirSampleFR = (iirSampleFR * (1 - iirAmount)) + (inputSampleR * iirAmount); inputSampleR = iirSampleFR;
+ inputSampleR = drySampleR - inputSampleR;
+ //make highpass
+ if (inputSampleR - iirSampleBR > threshold) inputSampleR = iirSampleBR + threshold;
+ if (inputSampleR - iirSampleBR < -threshold) inputSampleR = iirSampleBR - threshold;
+ //slew limit against lowpassed reference point
+ }
+ flip = !flip;
+ lastSampleL = inputSampleL;
+ lastSampleR = inputSampleR;
+
+ //begin 64 bit stereo floating point dither
+ int expon; frexp((double)inputSampleL, &expon);
+ fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
+ inputSampleL += ((double(fpd)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
+ frexp((double)inputSampleR, &expon);
+ fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
+ inputSampleR += ((double(fpd)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
+ //end 64 bit stereo floating point dither
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}