aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LinuxVST/src
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2018-09-02 22:35:13 -0400
committerChris Johnson <jinx6568@sover.net>2018-09-02 22:35:13 -0400
commitb4f55328448d087a68e6f658638fb3d38d86be12 (patch)
tree217a6d4c9ecc1c34e15e3f9e3774cc9858e39bfa /plugins/LinuxVST/src
parentdea49efc0e05cdd55c00ce701aecef2bd742fc8c (diff)
downloadairwindows-lv2-port-b4f55328448d087a68e6f658638fb3d38d86be12.tar.gz
airwindows-lv2-port-b4f55328448d087a68e6f658638fb3d38d86be12.tar.bz2
airwindows-lv2-port-b4f55328448d087a68e6f658638fb3d38d86be12.zip
Ditherbox… and individual dithers
Diffstat (limited to 'plugins/LinuxVST/src')
-rwxr-xr-xplugins/LinuxVST/src/BuildATPDF/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/BuildATPDF/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/BuildATPDF/BuildATPDF.cpp190
-rwxr-xr-xplugins/LinuxVST/src/BuildATPDF/BuildATPDF.h83
-rwxr-xr-xplugins/LinuxVST/src/BuildATPDF/BuildATPDFProc.cpp242
-rwxr-xr-xplugins/LinuxVST/src/Ditherbox/Ditherbox.cpp285
-rwxr-xr-xplugins/LinuxVST/src/Ditherbox/Ditherbox.h131
-rwxr-xr-xplugins/LinuxVST/src/Ditherbox/DitherboxProc.cpp1766
-rwxr-xr-xplugins/LinuxVST/src/DoublePaul/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/DoublePaul/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/DoublePaul/DoublePaul.cpp79
-rwxr-xr-xplugins/LinuxVST/src/DoublePaul/DoublePaul.h59
-rwxr-xr-xplugins/LinuxVST/src/DoublePaul/DoublePaulProc.cpp246
-rwxr-xr-xplugins/LinuxVST/src/HighGlossDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/HighGlossDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/HighGlossDither/HighGlossDither.cpp80
-rwxr-xr-xplugins/LinuxVST/src/HighGlossDither/HighGlossDither.h58
-rwxr-xr-xplugins/LinuxVST/src/HighGlossDither/HighGlossDitherProc.cpp198
-rwxr-xr-xplugins/LinuxVST/src/NaturalizeDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/NaturalizeDither/.vs/VSTProject/v14/.suobin0 -> 24576 bytes
-rwxr-xr-xplugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.cpp100
-rwxr-xr-xplugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.h59
-rwxr-xr-xplugins/LinuxVST/src/NaturalizeDither/NaturalizeDitherProc.cpp476
-rwxr-xr-xplugins/LinuxVST/src/NodeDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/NodeDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/NodeDither/NodeDither.cpp131
-rwxr-xr-xplugins/LinuxVST/src/NodeDither/NodeDither.h65
-rwxr-xr-xplugins/LinuxVST/src/NodeDither/NodeDitherProc.cpp228
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherCD/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherCD/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.cpp103
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.h61
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCDProc.cpp506
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.cpp103
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.h61
-rwxr-xr-xplugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDitherProc.cpp505
-rwxr-xr-xplugins/LinuxVST/src/PaulDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/PaulDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/PaulDither/PaulDither.cpp79
-rwxr-xr-xplugins/LinuxVST/src/PaulDither/PaulDither.h59
-rwxr-xr-xplugins/LinuxVST/src/PaulDither/PaulDitherProc.cpp202
-rwxr-xr-xplugins/LinuxVST/src/SpatializeDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/SpatializeDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/SpatializeDither/SpatializeDither.cpp80
-rwxr-xr-xplugins/LinuxVST/src/SpatializeDither/SpatializeDither.h59
-rwxr-xr-xplugins/LinuxVST/src/SpatializeDither/SpatializeDitherProc.cpp244
-rwxr-xr-xplugins/LinuxVST/src/SubsOnly/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/SubsOnly/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/SubsOnly/SubsOnly.cpp118
-rwxr-xr-xplugins/LinuxVST/src/SubsOnly/SubsOnly.h108
-rwxr-xr-xplugins/LinuxVST/src/SubsOnly/SubsOnlyProc.cpp576
-rwxr-xr-xplugins/LinuxVST/src/TapeDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/TapeDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/TapeDither/TapeDither.cpp85
-rwxr-xr-xplugins/LinuxVST/src/TapeDither/TapeDither.h65
-rwxr-xr-xplugins/LinuxVST/src/TapeDither/TapeDitherProc.cpp196
-rwxr-xr-xplugins/LinuxVST/src/VinylDither/.vs/Console4Channel64/v14/.suobin0 -> 32768 bytes
-rwxr-xr-xplugins/LinuxVST/src/VinylDither/.vs/VSTProject/v14/.suobin0 -> 23040 bytes
-rwxr-xr-xplugins/LinuxVST/src/VinylDither/VinylDither.cpp113
-rwxr-xr-xplugins/LinuxVST/src/VinylDither/VinylDither.h63
-rwxr-xr-xplugins/LinuxVST/src/VinylDither/VinylDitherProc.cpp340
63 files changed, 8202 insertions, 0 deletions
diff --git a/plugins/LinuxVST/src/BuildATPDF/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/BuildATPDF/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/BuildATPDF/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/BuildATPDF/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/BuildATPDF/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..48c954d
--- /dev/null
+++ b/plugins/LinuxVST/src/BuildATPDF/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/BuildATPDF/BuildATPDF.cpp b/plugins/LinuxVST/src/BuildATPDF/BuildATPDF.cpp
new file mode 100755
index 0000000..e9f01a8
--- /dev/null
+++ b/plugins/LinuxVST/src/BuildATPDF/BuildATPDF.cpp
@@ -0,0 +1,190 @@
+/* ========================================
+ * BuildATPDF - BuildATPDF.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __BuildATPDF_H
+#include "BuildATPDF.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new BuildATPDF(audioMaster);}
+
+BuildATPDF::BuildATPDF(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ A = 0.5;
+ B = 0.5;
+ C = 0.5;
+ D = 0.5;
+ E = 0.5;
+ F = 0.5;
+ G = 0.5;
+ H = 0.5;
+ I = 0.5;
+ J = 0.5;
+ //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
+}
+
+BuildATPDF::~BuildATPDF() {}
+VstInt32 BuildATPDF::getVendorVersion () {return 1000;}
+void BuildATPDF::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void BuildATPDF::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!
+
+static float pinParameter(float data)
+{
+ if (data < 0.0f) return 0.0f;
+ if (data > 1.0f) return 1.0f;
+ return data;
+}
+
+VstInt32 BuildATPDF::getChunk (void** data, bool isPreset)
+{
+ float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
+ chunkData[0] = A;
+ chunkData[1] = B;
+ chunkData[2] = C;
+ chunkData[3] = D;
+ chunkData[4] = E;
+ chunkData[5] = F;
+ chunkData[6] = G;
+ chunkData[7] = H;
+ chunkData[8] = I;
+ chunkData[9] = J;
+ /* Note: The way this is set up, it will break if you manage to save settings on an Intel
+ machine and load them on a PPC Mac. However, it's fine if you stick to the machine you
+ started with. */
+
+ *data = chunkData;
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 BuildATPDF::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ float *chunkData = (float *)data;
+ A = pinParameter(chunkData[0]);
+ B = pinParameter(chunkData[1]);
+ C = pinParameter(chunkData[2]);
+ D = pinParameter(chunkData[3]);
+ E = pinParameter(chunkData[4]);
+ F = pinParameter(chunkData[5]);
+ G = pinParameter(chunkData[6]);
+ H = pinParameter(chunkData[7]);
+ I = pinParameter(chunkData[8]);
+ J = pinParameter(chunkData[9]);
+ /* We're ignoring byteSize as we found it to be a filthy liar */
+
+ /* calculate any other fields you need here - you could copy in
+ code from setParameter() here. */
+ return 0;
+}
+
+void BuildATPDF::setParameter(VstInt32 index, float value) {
+ switch (index) {
+ case kParamA: A = value; break;
+ case kParamB: B = value; break; //percent. Using this value, it'll be 0-100 everywhere
+ case kParamC: C = value; break;
+ case kParamD: D = value; break;
+ case kParamE: E = value; break;
+ case kParamF: F = value; break;
+ case kParamG: G = value; break;
+ case kParamH: H = value; break;
+ case kParamI: I = value; break;
+ case kParamJ: J = value; break;
+ default: throw; // unknown parameter, shouldn't happen!
+ }
+}
+
+float BuildATPDF::getParameter(VstInt32 index) {
+ switch (index) {
+ case kParamA: return A; break;
+ case kParamB: return B; break;
+ case kParamC: return C; break;
+ case kParamD: return D; break;
+ case kParamE: return E; break;
+ case kParamF: return F; break;
+ case kParamG: return G; break;
+ case kParamH: return H; break;
+ case kParamI: return I; break;
+ case kParamJ: return J; break;
+ default: break; // unknown parameter, shouldn't happen!
+ } return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void BuildATPDF::getParameterName(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: vst_strncpy (text, "First", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, "Second", kVstMaxParamStrLen); break;
+ case kParamC: vst_strncpy (text, "Third", kVstMaxParamStrLen); break;
+ case kParamD: vst_strncpy (text, "Fourth", kVstMaxParamStrLen); break;
+ case kParamE: vst_strncpy (text, "Fifth", kVstMaxParamStrLen); break;
+ case kParamF: vst_strncpy (text, "Sixth", kVstMaxParamStrLen); break;
+ case kParamG: vst_strncpy (text, "Seventh", kVstMaxParamStrLen); break;
+ case kParamH: vst_strncpy (text, "Eighth", kVstMaxParamStrLen); break;
+ case kParamI: vst_strncpy (text, "Ninth", kVstMaxParamStrLen); break;
+ case kParamJ: vst_strncpy (text, "Tenth", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this is our labels for displaying in the VST host
+}
+
+void BuildATPDF::getParameterDisplay(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: float2string ((A*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamB: float2string ((B*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamC: float2string ((C*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamD: float2string ((D*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamE: float2string ((E*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamF: float2string ((F*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamG: float2string ((G*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamH: float2string ((H*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamI: float2string ((I*2)-1, text, kVstMaxParamStrLen); break;
+ case kParamJ: float2string ((J*2)-1, text, kVstMaxParamStrLen); break;
+
+ default: break; // unknown parameter, shouldn't happen!
+ } //this displays the values and handles 'popups' where it's discrete choices
+}
+
+void BuildATPDF::getParameterLabel(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamC: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamD: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamE: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamF: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamG: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamH: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamI: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ case kParamJ: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ }
+}
+
+VstInt32 BuildATPDF::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool BuildATPDF::getEffectName(char* name) {
+ vst_strncpy(name, "BuildATPDF", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory BuildATPDF::getPlugCategory() {return kPlugCategEffect;}
+
+bool BuildATPDF::getProductString(char* text) {
+ vst_strncpy (text, "airwindows BuildATPDF", kVstMaxProductStrLen); return true;
+}
+
+bool BuildATPDF::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/BuildATPDF/BuildATPDF.h b/plugins/LinuxVST/src/BuildATPDF/BuildATPDF.h
new file mode 100755
index 0000000..4de6dc8
--- /dev/null
+++ b/plugins/LinuxVST/src/BuildATPDF/BuildATPDF.h
@@ -0,0 +1,83 @@
+/* ========================================
+ * BuildATPDF - BuildATPDF.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __BuildATPDF_H
+#define __BuildATPDF_H
+
+#ifndef __audioeffect__
+#include "audioeffectx.h"
+#endif
+
+#include <set>
+#include <string>
+#include <math.h>
+
+enum {
+ kParamA = 0,
+ kParamB = 1,
+ kParamC = 2,
+ kParamD = 3,
+ kParamE = 4,
+ kParamF = 5,
+ kParamG = 6,
+ kParamH = 7,
+ kParamI = 8,
+ kParamJ = 9,
+ kNumParameters = 10
+}; //
+
+const int kNumPrograms = 0;
+const int kNumInputs = 2;
+const int kNumOutputs = 2;
+const unsigned long kUniqueId = 'bltp'; //Change this to what the AU identity is!
+
+class BuildATPDF :
+ public AudioEffectX
+{
+public:
+ BuildATPDF(audioMasterCallback audioMaster);
+ ~BuildATPDF();
+ 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 bL[11];
+ double bR[11];
+ double f[11];
+ //default stuff
+
+ float A;
+ float B;
+ float C;
+ float D;
+ float E;
+ float F;
+ float G;
+ float H;
+ float I;
+ float J;
+ //parameters. Always 0-1, and we scale/alter them elsewhere.
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/BuildATPDF/BuildATPDFProc.cpp b/plugins/LinuxVST/src/BuildATPDF/BuildATPDFProc.cpp
new file mode 100755
index 0000000..dfea125
--- /dev/null
+++ b/plugins/LinuxVST/src/BuildATPDF/BuildATPDFProc.cpp
@@ -0,0 +1,242 @@
+/* ========================================
+ * BuildATPDF - BuildATPDF.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __BuildATPDF_H
+#include "BuildATPDF.h"
+#endif
+
+void BuildATPDF::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ f[0] = (A*2)-1;
+ f[1] = (B*2)-1;
+ f[2] = (C*2)-1;
+ f[3] = (D*2)-1;
+ f[4] = (E*2)-1;
+ f[5] = (F*2)-1;
+ f[6] = (G*2)-1;
+ f[7] = (H*2)-1;
+ f[8] = (I*2)-1;
+ f[9] = (J*2)-1;
+ double currentDither;
+ double inputSampleL;
+ double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5];
+ bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1];
+ bL[1] = bL[0]; bL[0] = (rand()/(double)RAND_MAX);
+
+ currentDither = (bL[0] * f[0]);
+ currentDither += (bL[1] * f[1]);
+ currentDither += (bL[2] * f[2]);
+ currentDither += (bL[3] * f[3]);
+ currentDither += (bL[4] * f[4]);
+ currentDither += (bL[5] * f[5]);
+ currentDither += (bL[6] * f[6]);
+ currentDither += (bL[7] * f[7]);
+ currentDither += (bL[8] * f[8]);
+ currentDither += (bL[9] * f[9]);
+ inputSampleL += currentDither;
+
+
+ bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5];
+ bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1];
+ bR[1] = bR[0]; bR[0] = (rand()/(double)RAND_MAX);
+
+ currentDither = (bR[0] * f[0]);
+ currentDither += (bR[1] * f[1]);
+ currentDither += (bR[2] * f[2]);
+ currentDither += (bR[3] * f[3]);
+ currentDither += (bR[4] * f[4]);
+ currentDither += (bR[5] * f[5]);
+ currentDither += (bR[6] * f[6]);
+ currentDither += (bR[7] * f[7]);
+ currentDither += (bR[8] * f[8]);
+ currentDither += (bR[9] * f[9]);
+ inputSampleR += currentDither;
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void BuildATPDF::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ f[0] = (A*2)-1;
+ f[1] = (B*2)-1;
+ f[2] = (C*2)-1;
+ f[3] = (D*2)-1;
+ f[4] = (E*2)-1;
+ f[5] = (F*2)-1;
+ f[6] = (G*2)-1;
+ f[7] = (H*2)-1;
+ f[8] = (I*2)-1;
+ f[9] = (J*2)-1;
+ double currentDither;
+ double inputSampleL;
+ double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5];
+ bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1];
+ bL[1] = bL[0]; bL[0] = (rand()/(double)RAND_MAX);
+
+ currentDither = (bL[0] * f[0]);
+ currentDither += (bL[1] * f[1]);
+ currentDither += (bL[2] * f[2]);
+ currentDither += (bL[3] * f[3]);
+ currentDither += (bL[4] * f[4]);
+ currentDither += (bL[5] * f[5]);
+ currentDither += (bL[6] * f[6]);
+ currentDither += (bL[7] * f[7]);
+ currentDither += (bL[8] * f[8]);
+ currentDither += (bL[9] * f[9]);
+ inputSampleL += currentDither;
+
+
+ bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5];
+ bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1];
+ bR[1] = bR[0]; bR[0] = (rand()/(double)RAND_MAX);
+
+ currentDither = (bR[0] * f[0]);
+ currentDither += (bR[1] * f[1]);
+ currentDither += (bR[2] * f[2]);
+ currentDither += (bR[3] * f[3]);
+ currentDither += (bR[4] * f[4]);
+ currentDither += (bR[5] * f[5]);
+ currentDither += (bR[6] * f[6]);
+ currentDither += (bR[7] * f[7]);
+ currentDither += (bR[8] * f[8]);
+ currentDither += (bR[9] * f[9]);
+ inputSampleR += currentDither;
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/Ditherbox/Ditherbox.cpp b/plugins/LinuxVST/src/Ditherbox/Ditherbox.cpp
new file mode 100755
index 0000000..7e57c49
--- /dev/null
+++ b/plugins/LinuxVST/src/Ditherbox/Ditherbox.cpp
@@ -0,0 +1,285 @@
+/* ========================================
+ * Ditherbox - Ditherbox.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __Ditherbox_H
+#include "Ditherbox.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new Ditherbox(audioMaster);}
+
+Ditherbox::Ditherbox(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ A = 0.825;
+
+ Position = 99999999;
+ contingentErrL = 0.0;
+ contingentErrR = 0.0;
+ bynL[0] = 1000;
+ bynL[1] = 301;
+ bynL[2] = 176;
+ bynL[3] = 125;
+ bynL[4] = 97;
+ bynL[5] = 79;
+ bynL[6] = 67;
+ bynL[7] = 58;
+ bynL[8] = 51;
+ bynL[9] = 46;
+ bynL[10] = 1000;
+ noiseShapingL = 0.0;
+ bynR[0] = 1000;
+ bynR[1] = 301;
+ bynR[2] = 176;
+ bynR[3] = 125;
+ bynR[4] = 97;
+ bynR[5] = 79;
+ bynR[6] = 67;
+ bynR[7] = 58;
+ bynR[8] = 51;
+ bynR[9] = 46;
+ bynR[10] = 1000;
+ noiseShapingR = 0.0;
+
+ NSOddL = 0.0;
+ prevL = 0.0;
+ nsL[0] = 0;
+ nsL[1] = 0;
+ nsL[2] = 0;
+ nsL[3] = 0;
+ nsL[4] = 0;
+ nsL[5] = 0;
+ nsL[6] = 0;
+ nsL[7] = 0;
+ nsL[8] = 0;
+ nsL[9] = 0;
+ nsL[10] = 0;
+ nsL[11] = 0;
+ nsL[12] = 0;
+ nsL[13] = 0;
+ nsL[14] = 0;
+ nsL[15] = 0;
+ NSOddR = 0.0;
+ prevR = 0.0;
+ nsR[0] = 0;
+ nsR[1] = 0;
+ nsR[2] = 0;
+ nsR[3] = 0;
+ nsR[4] = 0;
+ nsR[5] = 0;
+ nsR[6] = 0;
+ nsR[7] = 0;
+ nsR[8] = 0;
+ nsR[9] = 0;
+ nsR[10] = 0;
+ nsR[11] = 0;
+ nsR[12] = 0;
+ nsR[13] = 0;
+ nsR[14] = 0;
+ nsR[15] = 0;
+
+ lastSampleL = 0.0;
+ outSampleL = 0.0;
+ lastSampleR = 0.0;
+ outSampleR = 0.0;
+
+ iirSampleAL = 0.0;
+ iirSampleBL = 0.0;
+ iirSampleCL = 0.0;
+ iirSampleDL = 0.0;
+ iirSampleEL = 0.0;
+ iirSampleFL = 0.0;
+ iirSampleGL = 0.0;
+ iirSampleHL = 0.0;
+ iirSampleIL = 0.0;
+ iirSampleJL = 0.0;
+ iirSampleKL = 0.0;
+ iirSampleLL = 0.0;
+ iirSampleML = 0.0;
+ iirSampleNL = 0.0;
+ iirSampleOL = 0.0;
+ iirSamplePL = 0.0;
+ iirSampleQL = 0.0;
+ iirSampleRL = 0.0;
+ iirSampleSL = 0.0;
+ iirSampleTL = 0.0;
+ iirSampleUL = 0.0;
+ iirSampleVL = 0.0;
+ iirSampleWL = 0.0;
+ iirSampleXL = 0.0;
+ iirSampleYL = 0.0;
+ iirSampleZL = 0.0;
+
+ iirSampleAR = 0.0;
+ iirSampleBR = 0.0;
+ iirSampleCR = 0.0;
+ iirSampleDR = 0.0;
+ iirSampleER = 0.0;
+ iirSampleFR = 0.0;
+ iirSampleGR = 0.0;
+ iirSampleHR = 0.0;
+ iirSampleIR = 0.0;
+ iirSampleJR = 0.0;
+ iirSampleKR = 0.0;
+ iirSampleLR = 0.0;
+ iirSampleMR = 0.0;
+ iirSampleNR = 0.0;
+ iirSampleOR = 0.0;
+ iirSamplePR = 0.0;
+ iirSampleQR = 0.0;
+ iirSampleRR = 0.0;
+ iirSampleSR = 0.0;
+ iirSampleTR = 0.0;
+ iirSampleUR = 0.0;
+ iirSampleVR = 0.0;
+ iirSampleWR = 0.0;
+ iirSampleXR = 0.0;
+ iirSampleYR = 0.0;
+ iirSampleZR = 0.0;
+ //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
+}
+
+Ditherbox::~Ditherbox() {}
+VstInt32 Ditherbox::getVendorVersion () {return 1000;}
+void Ditherbox::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void Ditherbox::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!
+
+static float pinParameter(float data)
+{
+ if (data < 0.0f) return 0.0f;
+ if (data > 1.0f) return 1.0f;
+ return data;
+}
+
+VstInt32 Ditherbox::getChunk (void** data, bool isPreset)
+{
+ float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
+ chunkData[0] = A;
+ /* Note: The way this is set up, it will break if you manage to save settings on an Intel
+ machine and load them on a PPC Mac. However, it's fine if you stick to the machine you
+ started with. */
+
+ *data = chunkData;
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 Ditherbox::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ float *chunkData = (float *)data;
+ A = pinParameter(chunkData[0]);
+ /* We're ignoring byteSize as we found it to be a filthy liar */
+
+ /* calculate any other fields you need here - you could copy in
+ code from setParameter() here. */
+ return 0;
+}
+
+void Ditherbox::setParameter(VstInt32 index, float value) {
+ switch (index) {
+ case kParamA: A = value; break;
+ default: throw; // unknown parameter, shouldn't happen!
+ }
+}
+
+float Ditherbox::getParameter(VstInt32 index) {
+ switch (index) {
+ case kParamA: return A; break;
+ default: break; // unknown parameter, shouldn't happen!
+ } return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void Ditherbox::getParameterName(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: vst_strncpy (text, "Type", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this is our labels for displaying in the VST host
+}
+
+void Ditherbox::getParameterDisplay(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: switch((VstInt32)( A * 19.999 )) //0 to almost edge of # of params
+ {
+ case 0: vst_strncpy (text, "Trunc", kVstMaxParamStrLen); break;
+ case 1: vst_strncpy (text, "Flat", kVstMaxParamStrLen); break;
+ case 2: vst_strncpy (text, "TPDF", kVstMaxParamStrLen); break;
+ case 4: vst_strncpy (text, "HiGloss", kVstMaxParamStrLen); break;
+ case 5: vst_strncpy (text, "Vinyl", kVstMaxParamStrLen); break;
+ case 6: vst_strncpy (text, "Spatial", kVstMaxParamStrLen); break;
+ case 7: vst_strncpy (text, "Natural", kVstMaxParamStrLen); break;
+ case 8: vst_strncpy (text, "NJAD", kVstMaxParamStrLen); break;
+ case 9: vst_strncpy (text, "Trunc", kVstMaxParamStrLen); break;
+ case 10: vst_strncpy (text, "Flat", kVstMaxParamStrLen); break;
+ case 11: vst_strncpy (text, "TPDF", kVstMaxParamStrLen); break;
+ case 12: vst_strncpy (text, "HiGloss", kVstMaxParamStrLen); break;
+ case 13: vst_strncpy (text, "Vinyl", kVstMaxParamStrLen); break;
+ case 14: vst_strncpy (text, "Spatial", kVstMaxParamStrLen); break;
+ case 15: vst_strncpy (text, "Natural", kVstMaxParamStrLen); break;
+ case 16: vst_strncpy (text, "NJAD", kVstMaxParamStrLen); break;
+ case 17: vst_strncpy (text, "SlewOnl", kVstMaxParamStrLen); break;
+ case 18: vst_strncpy (text, "SubsOnl", kVstMaxParamStrLen); break;
+ case 19: vst_strncpy (text, "Silhoue", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this displays the values and handles 'popups' where it's discrete choices
+}
+
+void Ditherbox::getParameterLabel(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: switch((VstInt32)( A * 19.999 )) //0 to almost edge of # of params
+ {
+ case 0: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 1: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 2: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 4: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 5: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 6: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 7: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 8: vst_strncpy (text, "16", kVstMaxParamStrLen); break;
+ case 9: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 10: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 11: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 12: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 13: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 14: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 15: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 16: vst_strncpy (text, "24", kVstMaxParamStrLen); break;
+ case 17: vst_strncpy (text, "y", kVstMaxParamStrLen); break;
+ case 18: vst_strncpy (text, "y", kVstMaxParamStrLen); break;
+ case 19: vst_strncpy (text, "tte", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this displays the values and handles 'popups' where it's discrete choices
+}
+
+VstInt32 Ditherbox::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool Ditherbox::getEffectName(char* name) {
+ vst_strncpy(name, "Ditherbox", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory Ditherbox::getPlugCategory() {return kPlugCategEffect;}
+
+bool Ditherbox::getProductString(char* text) {
+ vst_strncpy (text, "airwindows Ditherbox", kVstMaxProductStrLen); return true;
+}
+
+bool Ditherbox::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/Ditherbox/Ditherbox.h b/plugins/LinuxVST/src/Ditherbox/Ditherbox.h
new file mode 100755
index 0000000..baf5bb1
--- /dev/null
+++ b/plugins/LinuxVST/src/Ditherbox/Ditherbox.h
@@ -0,0 +1,131 @@
+/* ========================================
+ * Ditherbox - Ditherbox.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __Ditherbox_H
+#define __Ditherbox_H
+
+#ifndef __audioeffect__
+#include "audioeffectx.h"
+#endif
+
+#include <set>
+#include <string>
+#include <math.h>
+
+enum {
+ kParamA = 0,
+ kNumParameters = 1
+}; //
+
+const int kNumPrograms = 0;
+const int kNumInputs = 2;
+const int kNumOutputs = 2;
+const unsigned long kUniqueId = 'dith'; //Change this to what the AU identity is!
+
+class Ditherbox :
+ public AudioEffectX
+{
+public:
+ Ditherbox(audioMasterCallback audioMaster);
+ ~Ditherbox();
+ 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 bynL[13];
+ double bynR[13];
+ long double noiseShapingL;
+ long double noiseShapingR;
+ double contingentErrL;
+ double contingentErrR;
+ int Position;
+ bool flip;
+ double NSOddL;
+ double prevL;
+ double nsL[16];
+ double NSOddR;
+ double prevR;
+ double nsR[16];
+ long double lastSampleL;
+ long double outSampleL;
+ long double lastSampleR;
+ long double outSampleR;
+
+ double iirSampleAL;
+ double iirSampleBL;
+ double iirSampleCL;
+ double iirSampleDL;
+ double iirSampleEL;
+ double iirSampleFL;
+ double iirSampleGL;
+ double iirSampleHL;
+ double iirSampleIL;
+ double iirSampleJL;
+ double iirSampleKL;
+ double iirSampleLL;
+ double iirSampleML;
+ double iirSampleNL;
+ double iirSampleOL;
+ double iirSamplePL;
+ double iirSampleQL;
+ double iirSampleRL;
+ double iirSampleSL;
+ double iirSampleTL;
+ double iirSampleUL;
+ double iirSampleVL;
+ double iirSampleWL;
+ double iirSampleXL;
+ double iirSampleYL;
+ double iirSampleZL;
+
+ double iirSampleAR;
+ double iirSampleBR;
+ double iirSampleCR;
+ double iirSampleDR;
+ double iirSampleER;
+ double iirSampleFR;
+ double iirSampleGR;
+ double iirSampleHR;
+ double iirSampleIR;
+ double iirSampleJR;
+ double iirSampleKR;
+ double iirSampleLR;
+ double iirSampleMR;
+ double iirSampleNR;
+ double iirSampleOR;
+ double iirSamplePR;
+ double iirSampleQR;
+ double iirSampleRR;
+ double iirSampleSR;
+ double iirSampleTR;
+ double iirSampleUR;
+ double iirSampleVR;
+ double iirSampleWR;
+ double iirSampleXR;
+ double iirSampleYR;
+ double iirSampleZR;
+
+ float A;
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/Ditherbox/DitherboxProc.cpp b/plugins/LinuxVST/src/Ditherbox/DitherboxProc.cpp
new file mode 100755
index 0000000..feb5874
--- /dev/null
+++ b/plugins/LinuxVST/src/Ditherbox/DitherboxProc.cpp
@@ -0,0 +1,1766 @@
+/* ========================================
+ * Ditherbox - Ditherbox.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __Ditherbox_H
+#include "Ditherbox.h"
+#endif
+
+void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ int dtype = (int)(A * 19.999); // +1 for Reaper bug workaround
+ long double overallscale = 1.0;
+ overallscale /= 44100.0;
+ overallscale *= getSampleRate();
+ long double iirAmount = 2250/44100.0;
+ long double gaintarget = 1.42;
+ long double gain;
+ iirAmount /= overallscale;
+ long double altAmount = 1.0 - iirAmount;
+ long double outputSampleL;
+ long double outputSampleR;
+ long double silhouette;
+ long double smoother;
+ long double bridgerectifier;
+ long double benfordize;
+ int hotbinA;
+ int hotbinB;
+ long double totalA;
+ long double totalB;
+ long double contingentRnd;
+ long double absSample;
+ long double contingent;
+ long double randyConstant = 1.61803398874989484820458683436563811772030917980576;
+ long double omegaConstant = 0.56714329040978387299996866221035554975381578718651;
+ long double expConstant = 0.06598803584531253707679018759684642493857704825279;
+ long double trim = 2.302585092994045684017991; //natural logarithm of 10
+ bool highRes = false;
+ bool dithering = true;
+ if (dtype > 8){highRes = true; dtype -= 8;}
+ if (dtype > 8){dithering = false; highRes = false;}
+ //follow up by switching high res back off for the monitoring
+
+ while (--sampleFrames >= 0)
+ {
+ long double inputSampleL = *in1;
+ long double inputSampleR = *in2;
+ float drySampleL = inputSampleL;
+ float drySampleR = inputSampleR;
+
+ if (dtype == 8) {inputSampleL -= noiseShapingL; inputSampleR -= noiseShapingR;}
+
+ if (dithering) {inputSampleL *= 32768.0; inputSampleR *= 32768.0;}
+ //denormalizing as way of controlling insane detail boosting
+ if (highRes) {inputSampleL *= 256.0; inputSampleR *= 256.0;} //256 for 16/24 version
+
+ switch (dtype)
+ {
+ case 1:
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ //truncate
+ break;
+
+ case 2:
+ inputSampleL += (rand()/(double)RAND_MAX);
+ inputSampleL -= 0.5;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR += (rand()/(double)RAND_MAX);
+ inputSampleR -= 0.5;
+ inputSampleR = floor(inputSampleR);
+ //flat dither
+ break;
+
+ case 3:
+ inputSampleL += (rand()/(double)RAND_MAX);
+ inputSampleL += (rand()/(double)RAND_MAX);
+ inputSampleL -= 1.0;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR += (rand()/(double)RAND_MAX);
+ inputSampleR += (rand()/(double)RAND_MAX);
+ inputSampleR -= 1.0;
+ inputSampleR = floor(inputSampleR);
+ //TPDF dither
+ break;
+
+ case 4:
+ Position += 1;
+ //Note- uses integer overflow as a 'mod' operator
+ hotbinA = Position * Position;
+ hotbinA = hotbinA % 170003; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17011; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 1709; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 173; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17;
+ hotbinA *= 0.0635;
+ if (flip) hotbinA = -hotbinA;
+ inputSampleL += hotbinA;
+ inputSampleR += hotbinA;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ //Quadratic dither
+ break;
+
+ case 5:
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
+ //install noise and then shape it
+ absSample += inputSampleL;
+
+ if (NSOddL > 0) NSOddL -= 0.97;
+ if (NSOddL < 0) NSOddL += 0.97;
+
+ NSOddL -= (NSOddL * NSOddL * NSOddL * 0.475);
+
+ NSOddL += prevL;
+ absSample += (NSOddL*0.475);
+ prevL = floor(absSample) - inputSampleL;
+ inputSampleL = floor(absSample);
+ //TenNines dither L
+
+
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
+ //install noise and then shape it
+ absSample += inputSampleR;
+
+ if (NSOddR > 0) NSOddR -= 0.97;
+ if (NSOddR < 0) NSOddR += 0.97;
+
+ NSOddR -= (NSOddR * NSOddR * NSOddR * 0.475);
+
+ NSOddR += prevR;
+ absSample += (NSOddR*0.475);
+ prevR = floor(absSample) - inputSampleR;
+ inputSampleR = floor(absSample);
+ //TenNines dither R
+ break;
+
+ case 6:
+ if (inputSampleL > 0) inputSampleL += 0.383;
+ if (inputSampleL < 0) inputSampleL -= 0.383;
+ if (inputSampleR > 0) inputSampleR += 0.383;
+ if (inputSampleR < 0) inputSampleR -= 0.383;
+ //adjusting to permit more information drug outta the noisefloor
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrL*omegaConstant; //include err
+ absSample = fabs(inputSampleL);
+ contingentErrL = absSample - floor(absSample); //get next err
+ contingent = contingentErrL * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleL += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleL = floor(inputSampleL);
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrR*omegaConstant; //include err
+ absSample = fabs(inputSampleR);
+ contingentErrR = absSample - floor(absSample); //get next err
+ contingent = contingentErrR * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleR += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleR = floor(inputSampleR);
+
+ //note: this does not dither for values exactly the same as 16 bit values-
+ //which forces the dither to gate at 0.0. It goes to digital black,
+ //and does a teeny parallel-compression thing when almost at digital black.
+ break;
+
+ case 7: //this one is the original Naturalize
+ if (inputSampleL > 0) inputSampleL += (0.3333333333);
+ if (inputSampleL < 0) inputSampleL -= (0.3333333333);
+ inputSampleL += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ if (inputSampleR > 0) inputSampleR += (0.3333333333);
+ if (inputSampleR < 0) inputSampleR -= (0.3333333333);
+ inputSampleR += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+ break;
+
+ case 8: //this one is the Not Just Another Dither
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+ break;
+
+ case 9:
+ //slew only
+ outputSampleL = (inputSampleL - lastSampleL)*trim;
+ outputSampleR = (inputSampleR - lastSampleR)*trim;
+ lastSampleL = inputSampleL;
+ lastSampleR = inputSampleR;
+ if (outputSampleL > 1.0) outputSampleL = 1.0;
+ if (outputSampleR > 1.0) outputSampleR = 1.0;
+ if (outputSampleL < -1.0) outputSampleL = -1.0;
+ if (outputSampleR < -1.0) outputSampleR = -1.0;
+ inputSampleL = outputSampleL;
+ inputSampleR = outputSampleR;
+ break;
+
+ case 10:
+ //subs only
+ gain = gaintarget;
+
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAL = (iirSampleAL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleAL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleBL = (iirSampleBL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleBL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleCL = (iirSampleCL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleCL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleDL = (iirSampleDL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleDL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleEL = (iirSampleEL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleEL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleFL = (iirSampleFL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleFL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleGL = (iirSampleGL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleGL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleHL = (iirSampleHL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleHL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleIL = (iirSampleIL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleIL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleJL = (iirSampleJL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleJL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleKL = (iirSampleKL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleKL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleLL = (iirSampleLL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleLL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleML = (iirSampleML * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleML;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleNL = (iirSampleNL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleNL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleOL = (iirSampleOL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleOL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSamplePL = (iirSamplePL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSamplePL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleQL = (iirSampleQL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleQL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleRL = (iirSampleRL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleRL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleSL = (iirSampleSL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleSL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleTL = (iirSampleTL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleTL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleUL = (iirSampleUL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleUL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleVL = (iirSampleVL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleVL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleWL = (iirSampleWL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleWL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleXL = (iirSampleXL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleXL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleYL = (iirSampleYL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleYL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleZL = (iirSampleZL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleZL;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ gain = gaintarget;
+
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAR = (iirSampleAR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleAR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleBR = (iirSampleBR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleBR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleCR = (iirSampleCR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleCR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleDR = (iirSampleDR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleDR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleER = (iirSampleER * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleER;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleFR = (iirSampleFR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleFR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleGR = (iirSampleGR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleGR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleHR = (iirSampleHR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleHR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleIR = (iirSampleIR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleIR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleJR = (iirSampleJR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleJR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleKR = (iirSampleKR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleKR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleLR = (iirSampleLR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleLR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleMR = (iirSampleMR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleMR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleNR = (iirSampleNR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleNR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleOR = (iirSampleOR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleOR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSamplePR = (iirSamplePR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSamplePR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleQR = (iirSampleQR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleQR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleRR = (iirSampleRR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleRR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleSR = (iirSampleSR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleSR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleTR = (iirSampleTR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleTR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleUR = (iirSampleUR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleUR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleVR = (iirSampleVR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleVR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleWR = (iirSampleWR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleWR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleXR = (iirSampleXR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleXR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleYR = (iirSampleYR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleYR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleZR = (iirSampleZR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleZR;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ break;
+
+ case 11:
+ //silhouette
+ //begin L
+ bridgerectifier = fabs(inputSampleL)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = 1.0-cos(bridgerectifier);
+ if (inputSampleL > 0.0) inputSampleL = bridgerectifier;
+ else inputSampleL = -bridgerectifier;
+
+ silhouette = rand()/(double)RAND_MAX;
+ silhouette -= 0.5;
+ silhouette *= 2.0;
+ silhouette *= fabs(inputSampleL);
+
+ smoother = rand()/(double)RAND_MAX;
+ smoother -= 0.5;
+ smoother *= 2.0;
+ smoother *= fabs(lastSampleL);
+ lastSampleL = inputSampleL;
+
+ silhouette += smoother;
+
+ bridgerectifier = fabs(silhouette)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = sin(bridgerectifier);
+ if (silhouette > 0.0) silhouette = bridgerectifier;
+ else silhouette = -bridgerectifier;
+
+ inputSampleL = (silhouette + outSampleL) / 2.0;
+ outSampleL = silhouette;
+ //end L
+
+ //begin R
+ bridgerectifier = fabs(inputSampleR)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = 1.0-cos(bridgerectifier);
+ if (inputSampleR > 0.0) inputSampleR = bridgerectifier;
+ else inputSampleR = -bridgerectifier;
+
+ silhouette = rand()/(double)RAND_MAX;
+ silhouette -= 0.5;
+ silhouette *= 2.0;
+ silhouette *= fabs(inputSampleR);
+
+ smoother = rand()/(double)RAND_MAX;
+ smoother -= 0.5;
+ smoother *= 2.0;
+ smoother *= fabs(lastSampleR);
+ lastSampleR = inputSampleR;
+
+ silhouette += smoother;
+
+ bridgerectifier = fabs(silhouette)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = sin(bridgerectifier);
+ if (silhouette > 0.0) silhouette = bridgerectifier;
+ else silhouette = -bridgerectifier;
+
+ inputSampleR = (silhouette + outSampleR) / 2.0;
+ outSampleR = silhouette;
+ //end R
+ break;
+ }
+
+ flip = !flip;
+ //several dithers use this
+
+ if (highRes) {inputSampleL /= 256.0; inputSampleR /= 256.0;} //256 for 16/24 version
+ if (dithering) {inputSampleL /= 32768.0; inputSampleR /= 32768.0;}
+
+ if (dtype == 8) {
+ noiseShapingL += inputSampleL - drySampleL;
+ noiseShapingR += inputSampleR - drySampleR;
+ }
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ int dtype = (int)(A * 19.999); // +1 for Reaper bug workaround
+ long double overallscale = 1.0;
+ overallscale /= 44100.0;
+ overallscale *= getSampleRate();
+ long double iirAmount = 2250/44100.0;
+ long double gaintarget = 1.42;
+ long double gain;
+ iirAmount /= overallscale;
+ long double altAmount = 1.0 - iirAmount;
+ long double outputSampleL;
+ long double outputSampleR;
+ long double silhouette;
+ long double smoother;
+ long double bridgerectifier;
+ long double benfordize;
+ int hotbinA;
+ int hotbinB;
+ long double totalA;
+ long double totalB;
+ long double contingentRnd;
+ long double absSample;
+ long double contingent;
+ long double randyConstant = 1.61803398874989484820458683436563811772030917980576;
+ long double omegaConstant = 0.56714329040978387299996866221035554975381578718651;
+ long double expConstant = 0.06598803584531253707679018759684642493857704825279;
+ long double trim = 2.302585092994045684017991; //natural logarithm of 10
+ bool highRes = false;
+ bool dithering = true;
+ if (dtype > 8){highRes = true; dtype -= 8;}
+ if (dtype > 8){dithering = false; highRes = false;}
+ //follow up by switching high res back off for the monitoring
+
+ while (--sampleFrames >= 0)
+ {
+ long double inputSampleL = *in1;
+ long double inputSampleR = *in2;
+ double drySampleL = inputSampleL;
+ double drySampleR = inputSampleR;
+
+ if (dtype == 8) {inputSampleL -= noiseShapingL; inputSampleR -= noiseShapingR;}
+
+ if (dithering) {inputSampleL *= 32768.0; inputSampleR *= 32768.0;}
+ //denormalizing as way of controlling insane detail boosting
+ if (highRes) {inputSampleL *= 256.0; inputSampleR *= 256.0;} //256 for 16/24 version
+
+ switch (dtype)
+ {
+ case 1:
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ //truncate
+ break;
+
+ case 2:
+ inputSampleL += (rand()/(double)RAND_MAX);
+ inputSampleL -= 0.5;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR += (rand()/(double)RAND_MAX);
+ inputSampleR -= 0.5;
+ inputSampleR = floor(inputSampleR);
+ //flat dither
+ break;
+
+ case 3:
+ inputSampleL += (rand()/(double)RAND_MAX);
+ inputSampleL += (rand()/(double)RAND_MAX);
+ inputSampleL -= 1.0;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR += (rand()/(double)RAND_MAX);
+ inputSampleR += (rand()/(double)RAND_MAX);
+ inputSampleR -= 1.0;
+ inputSampleR = floor(inputSampleR);
+ //TPDF dither
+ break;
+
+ case 4:
+ Position += 1;
+ //Note- uses integer overflow as a 'mod' operator
+ hotbinA = Position * Position;
+ hotbinA = hotbinA % 170003; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17011; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 1709; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 173; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17;
+ hotbinA *= 0.0635;
+ if (flip) hotbinA = -hotbinA;
+ inputSampleL += hotbinA;
+ inputSampleR += hotbinA;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ //Quadratic dither
+ break;
+
+ case 5:
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
+ //install noise and then shape it
+ absSample += inputSampleL;
+
+ if (NSOddL > 0) NSOddL -= 0.97;
+ if (NSOddL < 0) NSOddL += 0.97;
+
+ NSOddL -= (NSOddL * NSOddL * NSOddL * 0.475);
+
+ NSOddL += prevL;
+ absSample += (NSOddL*0.475);
+ prevL = floor(absSample) - inputSampleL;
+ inputSampleL = floor(absSample);
+ //TenNines dither L
+
+
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
+ //install noise and then shape it
+ absSample += inputSampleR;
+
+ if (NSOddR > 0) NSOddR -= 0.97;
+ if (NSOddR < 0) NSOddR += 0.97;
+
+ NSOddR -= (NSOddR * NSOddR * NSOddR * 0.475);
+
+ NSOddR += prevR;
+ absSample += (NSOddR*0.475);
+ prevR = floor(absSample) - inputSampleR;
+ inputSampleR = floor(absSample);
+ //TenNines dither R
+ break;
+
+ case 6:
+ if (inputSampleL > 0) inputSampleL += 0.383;
+ if (inputSampleL < 0) inputSampleL -= 0.383;
+ if (inputSampleR > 0) inputSampleR += 0.383;
+ if (inputSampleR < 0) inputSampleR -= 0.383;
+ //adjusting to permit more information drug outta the noisefloor
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrL*omegaConstant; //include err
+ absSample = fabs(inputSampleL);
+ contingentErrL = absSample - floor(absSample); //get next err
+ contingent = contingentErrL * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleL += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleL = floor(inputSampleL);
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrR*omegaConstant; //include err
+ absSample = fabs(inputSampleR);
+ contingentErrR = absSample - floor(absSample); //get next err
+ contingent = contingentErrR * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleR += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleR = floor(inputSampleR);
+
+ //note: this does not dither for values exactly the same as 16 bit values-
+ //which forces the dither to gate at 0.0. It goes to digital black,
+ //and does a teeny parallel-compression thing when almost at digital black.
+ break;
+
+ case 7: //this one is the original Naturalize
+ if (inputSampleL > 0) inputSampleL += (0.3333333333);
+ if (inputSampleL < 0) inputSampleL -= (0.3333333333);
+ inputSampleL += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ if (inputSampleR > 0) inputSampleR += (0.3333333333);
+ if (inputSampleR < 0) inputSampleR -= (0.3333333333);
+ inputSampleR += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+ break;
+
+ case 8: //this one is the Not Just Another Dither
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+ break;
+
+ case 9:
+ //slew only
+ outputSampleL = (inputSampleL - lastSampleL)*trim;
+ outputSampleR = (inputSampleR - lastSampleR)*trim;
+ lastSampleL = inputSampleL;
+ lastSampleR = inputSampleR;
+ if (outputSampleL > 1.0) outputSampleL = 1.0;
+ if (outputSampleR > 1.0) outputSampleR = 1.0;
+ if (outputSampleL < -1.0) outputSampleL = -1.0;
+ if (outputSampleR < -1.0) outputSampleR = -1.0;
+ inputSampleL = outputSampleL;
+ inputSampleR = outputSampleR;
+ break;
+
+ case 10:
+ //subs only
+ gain = gaintarget;
+
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAL = (iirSampleAL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleAL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleBL = (iirSampleBL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleBL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleCL = (iirSampleCL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleCL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleDL = (iirSampleDL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleDL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleEL = (iirSampleEL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleEL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleFL = (iirSampleFL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleFL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleGL = (iirSampleGL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleGL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleHL = (iirSampleHL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleHL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleIL = (iirSampleIL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleIL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleJL = (iirSampleJL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleJL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleKL = (iirSampleKL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleKL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleLL = (iirSampleLL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleLL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleML = (iirSampleML * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleML;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleNL = (iirSampleNL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleNL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleOL = (iirSampleOL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleOL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSamplePL = (iirSamplePL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSamplePL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleQL = (iirSampleQL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleQL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleRL = (iirSampleRL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleRL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleSL = (iirSampleSL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleSL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleTL = (iirSampleTL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleTL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleUL = (iirSampleUL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleUL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleVL = (iirSampleVL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleVL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleWL = (iirSampleWL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleWL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleXL = (iirSampleXL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleXL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleYL = (iirSampleYL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleYL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleZL = (iirSampleZL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleZL;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ gain = gaintarget;
+
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAR = (iirSampleAR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleAR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleBR = (iirSampleBR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleBR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleCR = (iirSampleCR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleCR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleDR = (iirSampleDR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleDR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleER = (iirSampleER * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleER;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleFR = (iirSampleFR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleFR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleGR = (iirSampleGR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleGR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleHR = (iirSampleHR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleHR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleIR = (iirSampleIR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleIR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleJR = (iirSampleJR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleJR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleKR = (iirSampleKR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleKR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleLR = (iirSampleLR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleLR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleMR = (iirSampleMR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleMR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleNR = (iirSampleNR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleNR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleOR = (iirSampleOR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleOR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSamplePR = (iirSamplePR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSamplePR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleQR = (iirSampleQR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleQR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleRR = (iirSampleRR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleRR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleSR = (iirSampleSR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleSR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleTR = (iirSampleTR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleTR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleUR = (iirSampleUR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleUR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleVR = (iirSampleVR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleVR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleWR = (iirSampleWR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleWR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleXR = (iirSampleXR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleXR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleYR = (iirSampleYR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleYR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleZR = (iirSampleZR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleZR;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ break;
+
+ case 11:
+ //silhouette
+ //begin L
+ bridgerectifier = fabs(inputSampleL)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = 1.0-cos(bridgerectifier);
+ if (inputSampleL > 0.0) inputSampleL = bridgerectifier;
+ else inputSampleL = -bridgerectifier;
+
+ silhouette = rand()/(double)RAND_MAX;
+ silhouette -= 0.5;
+ silhouette *= 2.0;
+ silhouette *= fabs(inputSampleL);
+
+ smoother = rand()/(double)RAND_MAX;
+ smoother -= 0.5;
+ smoother *= 2.0;
+ smoother *= fabs(lastSampleL);
+ lastSampleL = inputSampleL;
+
+ silhouette += smoother;
+
+ bridgerectifier = fabs(silhouette)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = sin(bridgerectifier);
+ if (silhouette > 0.0) silhouette = bridgerectifier;
+ else silhouette = -bridgerectifier;
+
+ inputSampleL = (silhouette + outSampleL) / 2.0;
+ outSampleL = silhouette;
+ //end L
+
+ //begin R
+ bridgerectifier = fabs(inputSampleR)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = 1.0-cos(bridgerectifier);
+ if (inputSampleR > 0.0) inputSampleR = bridgerectifier;
+ else inputSampleR = -bridgerectifier;
+
+ silhouette = rand()/(double)RAND_MAX;
+ silhouette -= 0.5;
+ silhouette *= 2.0;
+ silhouette *= fabs(inputSampleR);
+
+ smoother = rand()/(double)RAND_MAX;
+ smoother -= 0.5;
+ smoother *= 2.0;
+ smoother *= fabs(lastSampleR);
+ lastSampleR = inputSampleR;
+
+ silhouette += smoother;
+
+ bridgerectifier = fabs(silhouette)*1.57079633;
+ if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
+ bridgerectifier = sin(bridgerectifier);
+ if (silhouette > 0.0) silhouette = bridgerectifier;
+ else silhouette = -bridgerectifier;
+
+ inputSampleR = (silhouette + outSampleR) / 2.0;
+ outSampleR = silhouette;
+ //end R
+ break;
+ }
+
+ flip = !flip;
+ //several dithers use this
+
+ if (highRes) {inputSampleL /= 256.0; inputSampleR /= 256.0;} //256 for 16/24 version
+ if (dithering) {inputSampleL /= 32768.0; inputSampleR /= 32768.0;}
+
+ if (dtype == 8) {
+ noiseShapingL += inputSampleL - drySampleL;
+ noiseShapingR += inputSampleR - drySampleR;
+ }
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
diff --git a/plugins/LinuxVST/src/DoublePaul/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/DoublePaul/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/DoublePaul/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/DoublePaul/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/DoublePaul/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..94ab336
--- /dev/null
+++ b/plugins/LinuxVST/src/DoublePaul/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/DoublePaul/DoublePaul.cpp b/plugins/LinuxVST/src/DoublePaul/DoublePaul.cpp
new file mode 100755
index 0000000..a5d374d
--- /dev/null
+++ b/plugins/LinuxVST/src/DoublePaul/DoublePaul.cpp
@@ -0,0 +1,79 @@
+/* ========================================
+ * DoublePaul - DoublePaul.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __DoublePaul_H
+#include "DoublePaul.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new DoublePaul(audioMaster);}
+
+DoublePaul::DoublePaul(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ for(int count = 0; count < 11; count++) {bL[count] = 0.0;bR[count] = 0.0;}
+ //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
+}
+
+DoublePaul::~DoublePaul() {}
+VstInt32 DoublePaul::getVendorVersion () {return 1000;}
+void DoublePaul::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void DoublePaul::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 DoublePaul::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 DoublePaul::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void DoublePaul::setParameter(VstInt32 index, float value) {
+}
+
+float DoublePaul::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void DoublePaul::getParameterName(VstInt32 index, char *text) {
+}
+
+void DoublePaul::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void DoublePaul::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 DoublePaul::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool DoublePaul::getEffectName(char* name) {
+ vst_strncpy(name, "DoublePaul", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory DoublePaul::getPlugCategory() {return kPlugCategEffect;}
+
+bool DoublePaul::getProductString(char* text) {
+ vst_strncpy (text, "airwindows DoublePaul", kVstMaxProductStrLen); return true;
+}
+
+bool DoublePaul::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/DoublePaul/DoublePaul.h b/plugins/LinuxVST/src/DoublePaul/DoublePaul.h
new file mode 100755
index 0000000..4cb0b88
--- /dev/null
+++ b/plugins/LinuxVST/src/DoublePaul/DoublePaul.h
@@ -0,0 +1,59 @@
+/* ========================================
+ * DoublePaul - DoublePaul.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __DoublePaul_H
+#define __DoublePaul_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 = 'dbpa'; //Change this to what the AU identity is!
+
+class DoublePaul :
+ public AudioEffectX
+{
+public:
+ DoublePaul(audioMasterCallback audioMaster);
+ ~DoublePaul();
+ 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 bL[11];
+ double bR[11];
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/DoublePaul/DoublePaulProc.cpp b/plugins/LinuxVST/src/DoublePaul/DoublePaulProc.cpp
new file mode 100755
index 0000000..66de94f
--- /dev/null
+++ b/plugins/LinuxVST/src/DoublePaul/DoublePaulProc.cpp
@@ -0,0 +1,246 @@
+/* ========================================
+ * DoublePaul - DoublePaul.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __DoublePaul_H
+#include "DoublePaul.h"
+#endif
+
+void DoublePaul::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ double currentDitherL;
+ double currentDitherR;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5];
+ bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1];
+ bL[1] = bL[0]; bL[0] = (rand()/(double)RAND_MAX);
+
+ currentDitherL = (bL[0] * 0.061);
+ currentDitherL -= (bL[1] * 0.11);
+ currentDitherL += (bL[8] * 0.126);
+ currentDitherL -= (bL[7] * 0.23);
+ currentDitherL += (bL[2] * 0.25);
+ currentDitherL -= (bL[3] * 0.43);
+ currentDitherL += (bL[6] * 0.5);
+ currentDitherL -= bL[5];
+ currentDitherL += bL[4];
+ //this sounds different from doing it in order of sample position
+ //cumulative tiny errors seem to build up even at this buss depth
+ //considerably more pronounced at 32 bit float.
+ //Therefore we add the most significant components LAST.
+ //trying to keep values on like exponents of the floating point value.
+ inputSampleL += currentDitherL;
+
+ inputSampleL = floor(inputSampleL);
+ //done with L
+
+ bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5];
+ bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1];
+ bR[1] = bR[0]; bR[0] = (rand()/(double)RAND_MAX);
+
+ currentDitherR = (bR[0] * 0.061);
+ currentDitherR -= (bR[1] * 0.11);
+ currentDitherR += (bR[8] * 0.126);
+ currentDitherR -= (bR[7] * 0.23);
+ currentDitherR += (bR[2] * 0.25);
+ currentDitherR -= (bR[3] * 0.43);
+ currentDitherR += (bR[6] * 0.5);
+ currentDitherR -= bR[5];
+ currentDitherR += bR[4];
+ //this sounds different from doing it in order of sample position
+ //cumulative tiny errors seem to build up even at this buss depth
+ //considerably more pronounced at 32 bit float.
+ //Therefore we add the most significant components LAST.
+ //trying to keep values on like exponents of the floating point value.
+ inputSampleR += currentDitherR;
+
+ inputSampleR = floor(inputSampleR);
+ //done with R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void DoublePaul::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ double currentDitherL;
+ double currentDitherR;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5];
+ bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1];
+ bL[1] = bL[0]; bL[0] = (rand()/(double)RAND_MAX);
+
+ currentDitherL = (bL[0] * 0.061);
+ currentDitherL -= (bL[1] * 0.11);
+ currentDitherL += (bL[8] * 0.126);
+ currentDitherL -= (bL[7] * 0.23);
+ currentDitherL += (bL[2] * 0.25);
+ currentDitherL -= (bL[3] * 0.43);
+ currentDitherL += (bL[6] * 0.5);
+ currentDitherL -= bL[5];
+ currentDitherL += bL[4];
+ //this sounds different from doing it in order of sample position
+ //cumulative tiny errors seem to build up even at this buss depth
+ //considerably more pronounced at 32 bit float.
+ //Therefore we add the most significant components LAST.
+ //trying to keep values on like exponents of the floating point value.
+ inputSampleL += currentDitherL;
+
+ inputSampleL = floor(inputSampleL);
+ //done with L
+
+ bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5];
+ bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1];
+ bR[1] = bR[0]; bR[0] = (rand()/(double)RAND_MAX);
+
+ currentDitherR = (bR[0] * 0.061);
+ currentDitherR -= (bR[1] * 0.11);
+ currentDitherR += (bR[8] * 0.126);
+ currentDitherR -= (bR[7] * 0.23);
+ currentDitherR += (bR[2] * 0.25);
+ currentDitherR -= (bR[3] * 0.43);
+ currentDitherR += (bR[6] * 0.5);
+ currentDitherR -= bR[5];
+ currentDitherR += bR[4];
+ //this sounds different from doing it in order of sample position
+ //cumulative tiny errors seem to build up even at this buss depth
+ //considerably more pronounced at 32 bit float.
+ //Therefore we add the most significant components LAST.
+ //trying to keep values on like exponents of the floating point value.
+ inputSampleR += currentDitherR;
+
+ inputSampleR = floor(inputSampleR);
+ //done with R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/HighGlossDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/HighGlossDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/HighGlossDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/HighGlossDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/HighGlossDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..e773d40
--- /dev/null
+++ b/plugins/LinuxVST/src/HighGlossDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/HighGlossDither/HighGlossDither.cpp b/plugins/LinuxVST/src/HighGlossDither/HighGlossDither.cpp
new file mode 100755
index 0000000..6122107
--- /dev/null
+++ b/plugins/LinuxVST/src/HighGlossDither/HighGlossDither.cpp
@@ -0,0 +1,80 @@
+/* ========================================
+ * HighGlossDither - HighGlossDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __HighGlossDither_H
+#include "HighGlossDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new HighGlossDither(audioMaster);}
+
+HighGlossDither::HighGlossDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ Position = 99999999;
+ flip = false;
+ //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
+}
+
+HighGlossDither::~HighGlossDither() {}
+VstInt32 HighGlossDither::getVendorVersion () {return 1000;}
+void HighGlossDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void HighGlossDither::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 HighGlossDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 HighGlossDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void HighGlossDither::setParameter(VstInt32 index, float value) {
+}
+
+float HighGlossDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void HighGlossDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void HighGlossDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void HighGlossDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 HighGlossDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool HighGlossDither::getEffectName(char* name) {
+ vst_strncpy(name, "HighGlossDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory HighGlossDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool HighGlossDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows HighGlossDither", kVstMaxProductStrLen); return true;
+}
+
+bool HighGlossDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/HighGlossDither/HighGlossDither.h b/plugins/LinuxVST/src/HighGlossDither/HighGlossDither.h
new file mode 100755
index 0000000..8bce906
--- /dev/null
+++ b/plugins/LinuxVST/src/HighGlossDither/HighGlossDither.h
@@ -0,0 +1,58 @@
+/* ========================================
+ * HighGlossDither - HighGlossDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __HighGlossDither_H
+#define __HighGlossDither_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 = 'hgdh'; //Change this to what the AU identity is!
+
+class HighGlossDither :
+ public AudioEffectX
+{
+public:
+ HighGlossDither(audioMasterCallback audioMaster);
+ ~HighGlossDither();
+ 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;
+
+ int Position;
+ bool flip;
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/HighGlossDither/HighGlossDitherProc.cpp b/plugins/LinuxVST/src/HighGlossDither/HighGlossDitherProc.cpp
new file mode 100755
index 0000000..2529939
--- /dev/null
+++ b/plugins/LinuxVST/src/HighGlossDither/HighGlossDitherProc.cpp
@@ -0,0 +1,198 @@
+/* ========================================
+ * HighGlossDither - HighGlossDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __HighGlossDither_H
+#include "HighGlossDither.h"
+#endif
+
+void HighGlossDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ int hotbinA;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ Position += 1;
+ //Note- uses integer overflow as a 'mod' operator
+ hotbinA = Position * Position;
+ hotbinA = hotbinA % 170003; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17011; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 1709; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 173; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17;
+ hotbinA *= 0.0635;
+ if (flip) hotbinA = -hotbinA;
+
+ inputSampleL += hotbinA;
+ inputSampleR += hotbinA;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ //Quadratic dither
+
+ flip = !flip;
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void HighGlossDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ int hotbinA;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ Position += 1;
+ //Note- uses integer overflow as a 'mod' operator
+ hotbinA = Position * Position;
+ hotbinA = hotbinA % 170003; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17011; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 1709; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 173; //% is C++ mod operator
+ hotbinA *= hotbinA;
+ hotbinA = hotbinA % 17;
+ hotbinA *= 0.0635;
+ if (flip) hotbinA = -hotbinA;
+
+ inputSampleL += hotbinA;
+ inputSampleR += hotbinA;
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ //Quadratic dither
+
+ flip = !flip;
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/NaturalizeDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/NaturalizeDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/NaturalizeDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NaturalizeDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/NaturalizeDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..bf72d3b
--- /dev/null
+++ b/plugins/LinuxVST/src/NaturalizeDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.cpp b/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.cpp
new file mode 100755
index 0000000..700c2f4
--- /dev/null
+++ b/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.cpp
@@ -0,0 +1,100 @@
+/* ========================================
+ * NaturalizeDither - NaturalizeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NaturalizeDither_H
+#include "NaturalizeDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new NaturalizeDither(audioMaster);}
+
+NaturalizeDither::NaturalizeDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ bynL[0] = 1000;
+ bynL[1] = 301;
+ bynL[2] = 176;
+ bynL[3] = 125;
+ bynL[4] = 97;
+ bynL[5] = 79;
+ bynL[6] = 67;
+ bynL[7] = 58;
+ bynL[8] = 51;
+ bynL[9] = 46;
+ bynL[10] = 1000;
+
+ bynR[0] = 1000;
+ bynR[1] = 301;
+ bynR[2] = 176;
+ bynR[3] = 125;
+ bynR[4] = 97;
+ bynR[5] = 79;
+ bynR[6] = 67;
+ bynR[7] = 58;
+ bynR[8] = 51;
+ bynR[9] = 46;
+ bynR[10] = 1000;
+ //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
+}
+
+NaturalizeDither::~NaturalizeDither() {}
+VstInt32 NaturalizeDither::getVendorVersion () {return 1000;}
+void NaturalizeDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void NaturalizeDither::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 NaturalizeDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 NaturalizeDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void NaturalizeDither::setParameter(VstInt32 index, float value) {
+}
+
+float NaturalizeDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void NaturalizeDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void NaturalizeDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void NaturalizeDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 NaturalizeDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool NaturalizeDither::getEffectName(char* name) {
+ vst_strncpy(name, "NaturalizeDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory NaturalizeDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool NaturalizeDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows NaturalizeDither", kVstMaxProductStrLen); return true;
+}
+
+bool NaturalizeDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.h b/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.h
new file mode 100755
index 0000000..47044a9
--- /dev/null
+++ b/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDither.h
@@ -0,0 +1,59 @@
+/* ========================================
+ * NaturalizeDither - NaturalizeDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __NaturalizeDither_H
+#define __NaturalizeDither_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 = 'ndth'; //Change this to what the AU identity is!
+
+class NaturalizeDither :
+ public AudioEffectX
+{
+public:
+ NaturalizeDither(audioMasterCallback audioMaster);
+ ~NaturalizeDither();
+ 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 bynL[13];
+ double bynR[13];
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDitherProc.cpp b/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDitherProc.cpp
new file mode 100755
index 0000000..7bd2210
--- /dev/null
+++ b/plugins/LinuxVST/src/NaturalizeDither/NaturalizeDitherProc.cpp
@@ -0,0 +1,476 @@
+/* ========================================
+ * NaturalizeDither - NaturalizeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NaturalizeDither_H
+#include "NaturalizeDither.h"
+#endif
+
+void NaturalizeDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double benfordize;
+ int hotbinA;
+ int hotbinB;
+ double totalA;
+ double totalB;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ if (inputSampleL > 0) inputSampleL += (0.3333333333);
+ if (inputSampleL < 0) inputSampleL -= (0.3333333333);
+ inputSampleL += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ if (inputSampleR > 0) inputSampleR += (0.3333333333);
+ if (inputSampleR < 0) inputSampleR -= (0.3333333333);
+ inputSampleR += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void NaturalizeDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double benfordize;
+ int hotbinA;
+ int hotbinB;
+ double totalA;
+ double totalB;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ if (inputSampleL > 0) inputSampleL += (0.3333333333);
+ if (inputSampleL < 0) inputSampleL -= (0.3333333333);
+ inputSampleL += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ if (inputSampleR > 0) inputSampleR += (0.3333333333);
+ if (inputSampleR < 0) inputSampleR -= (0.3333333333);
+ inputSampleR += (rand()/(double)RAND_MAX)*0.6666666666;
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/NodeDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/NodeDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/NodeDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NodeDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/NodeDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..97158ed
--- /dev/null
+++ b/plugins/LinuxVST/src/NodeDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NodeDither/NodeDither.cpp b/plugins/LinuxVST/src/NodeDither/NodeDither.cpp
new file mode 100755
index 0000000..663b608
--- /dev/null
+++ b/plugins/LinuxVST/src/NodeDither/NodeDither.cpp
@@ -0,0 +1,131 @@
+/* ========================================
+ * NodeDither - NodeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NodeDither_H
+#include "NodeDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new NodeDither(audioMaster);}
+
+NodeDither::NodeDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ A = 0.04;
+ B = 0.0;
+ for(int count = 0; count < 4999; count++) {dL[count] = 0; dR[count] = 0;}
+ gcount = 0;
+ //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
+}
+
+NodeDither::~NodeDither() {}
+VstInt32 NodeDither::getVendorVersion () {return 1000;}
+void NodeDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void NodeDither::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!
+
+static float pinParameter(float data)
+{
+ if (data < 0.0f) return 0.0f;
+ if (data > 1.0f) return 1.0f;
+ return data;
+}
+
+VstInt32 NodeDither::getChunk (void** data, bool isPreset)
+{
+ float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
+ chunkData[0] = A;
+ chunkData[1] = B;
+ /* Note: The way this is set up, it will break if you manage to save settings on an Intel
+ machine and load them on a PPC Mac. However, it's fine if you stick to the machine you
+ started with. */
+
+ *data = chunkData;
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 NodeDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ float *chunkData = (float *)data;
+ A = pinParameter(chunkData[0]);
+ B = pinParameter(chunkData[1]);
+ /* We're ignoring byteSize as we found it to be a filthy liar */
+
+ /* calculate any other fields you need here - you could copy in
+ code from setParameter() here. */
+ return 0;
+}
+
+void NodeDither::setParameter(VstInt32 index, float value) {
+ switch (index) {
+ case kParamA: A = value; break;
+ case kParamB: B = value; break;
+ default: throw; // unknown parameter, shouldn't happen!
+ }
+}
+
+float NodeDither::getParameter(VstInt32 index) {
+ switch (index) {
+ case kParamA: return A; break;
+ case kParamB: return B; break;
+ default: break; // unknown parameter, shouldn't happen!
+ } return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void NodeDither::getParameterName(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: vst_strncpy (text, "Node", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, "Phase", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this is our labels for displaying in the VST host
+}
+
+void NodeDither::getParameterDisplay(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: int2string ((VstInt32) floor(A * 100), text, kVstMaxParamStrLen); break;
+ case kParamB: switch((VstInt32)( B * 1.999 )) //0 to almost edge of # of params
+ {case 0: vst_strncpy (text, "Out", kVstMaxParamStrLen); break;
+ case 1: vst_strncpy (text, "In", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } break; //completed D 'popup' parameter, exit
+ default: break; // unknown parameter, shouldn't happen!
+ } //this displays the values and handles 'popups' where it's discrete choices
+}
+
+void NodeDither::getParameterLabel(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: vst_strncpy (text, "samples", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, " ", kVstMaxParamStrLen); break; //the percent
+ default: break; // unknown parameter, shouldn't happen!
+ }
+}
+
+VstInt32 NodeDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool NodeDither::getEffectName(char* name) {
+ vst_strncpy(name, "NodeDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory NodeDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool NodeDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows NodeDither", kVstMaxProductStrLen); return true;
+}
+
+bool NodeDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/NodeDither/NodeDither.h b/plugins/LinuxVST/src/NodeDither/NodeDither.h
new file mode 100755
index 0000000..240a8d9
--- /dev/null
+++ b/plugins/LinuxVST/src/NodeDither/NodeDither.h
@@ -0,0 +1,65 @@
+/* ========================================
+ * NodeDither - NodeDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __NodeDither_H
+#define __NodeDither_H
+
+#ifndef __audioeffect__
+#include "audioeffectx.h"
+#endif
+
+#include <set>
+#include <string>
+#include <math.h>
+
+enum {
+ kParamA = 0,
+ kParamB = 1,
+ kNumParameters = 2
+}; //
+
+const int kNumPrograms = 0;
+const int kNumInputs = 2;
+const int kNumOutputs = 2;
+const unsigned long kUniqueId = 'node'; //Change this to what the AU identity is!
+
+class NodeDither :
+ public AudioEffectX
+{
+public:
+ NodeDither(audioMasterCallback audioMaster);
+ ~NodeDither();
+ 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 dL[5000];
+ double dR[5000];
+ int gcount;
+ //default stuff
+
+ float A;
+ float B;
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/NodeDither/NodeDitherProc.cpp b/plugins/LinuxVST/src/NodeDither/NodeDitherProc.cpp
new file mode 100755
index 0000000..3d60464
--- /dev/null
+++ b/plugins/LinuxVST/src/NodeDither/NodeDitherProc.cpp
@@ -0,0 +1,228 @@
+/* ========================================
+ * NodeDither - NodeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NodeDither_H
+#include "NodeDither.h"
+#endif
+
+void NodeDither::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();
+
+ int offsetA = (int)((A*100) * overallscale);
+ if (offsetA < 1) offsetA = 1;
+ if (offsetA > 2440) offsetA = 2440;
+
+ int phase = floor(B*1.999);
+ //0 default is out of phase, 1 is in phase
+
+ long double inputSampleL;
+ long double inputSampleR;
+ double currentDitherL;
+ double currentDitherR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ if (gcount < 0 || gcount > 2450) {gcount = 2450;}
+
+ currentDitherL = (rand()/(double)RAND_MAX);
+ inputSampleL += currentDitherL;
+
+ currentDitherR = (rand()/(double)RAND_MAX);
+ inputSampleR += currentDitherR;
+
+ if (phase == 1) {
+ inputSampleL -= 1.0;
+ inputSampleL += dL[gcount+offsetA];
+ inputSampleR -= 1.0;
+ inputSampleR += dR[gcount+offsetA];
+ } else {
+ inputSampleL -= dL[gcount+offsetA];
+ inputSampleR -= dR[gcount+offsetA];
+ }
+ //in phase means adding, otherwise we subtract
+
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ dL[gcount+2450] = dL[gcount] = currentDitherL;
+ dR[gcount+2450] = dR[gcount] = currentDitherR;
+
+ gcount--;
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void NodeDither::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();
+
+ int offsetA = (int)((A*100) * overallscale);
+ if (offsetA < 1) offsetA = 1;
+ if (offsetA > 2440) offsetA = 2440;
+
+ int phase = floor(B*1.999);
+ //0 default is out of phase, 1 is in phase
+
+ long double inputSampleL;
+ long double inputSampleR;
+ double currentDitherL;
+ double currentDitherR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ if (gcount < 0 || gcount > 2450) {gcount = 2450;}
+
+ currentDitherL = (rand()/(double)RAND_MAX);
+ inputSampleL += currentDitherL;
+
+ currentDitherR = (rand()/(double)RAND_MAX);
+ inputSampleR += currentDitherR;
+
+ if (phase == 1) {
+ inputSampleL -= 1.0;
+ inputSampleL += dL[gcount+offsetA];
+ inputSampleR -= 1.0;
+ inputSampleR += dR[gcount+offsetA];
+ } else {
+ inputSampleL -= dL[gcount+offsetA];
+ inputSampleR -= dR[gcount+offsetA];
+ }
+ //in phase means adding, otherwise we subtract
+
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+ dL[gcount+2450] = dL[gcount] = currentDitherL;
+ dR[gcount+2450] = dR[gcount] = currentDitherR;
+
+ gcount--;
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/NotJustAnotherCD/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/NotJustAnotherCD/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherCD/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NotJustAnotherCD/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/NotJustAnotherCD/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..35fcac6
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherCD/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.cpp b/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.cpp
new file mode 100755
index 0000000..497c1e8
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.cpp
@@ -0,0 +1,103 @@
+/* ========================================
+ * NotJustAnotherCD - NotJustAnotherCD.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NotJustAnotherCD_H
+#include "NotJustAnotherCD.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new NotJustAnotherCD(audioMaster);}
+
+NotJustAnotherCD::NotJustAnotherCD(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ bynL[0] = 1000;
+ bynL[1] = 301;
+ bynL[2] = 176;
+ bynL[3] = 125;
+ bynL[4] = 97;
+ bynL[5] = 79;
+ bynL[6] = 67;
+ bynL[7] = 58;
+ bynL[8] = 51;
+ bynL[9] = 46;
+ bynL[10] = 1000;
+ noiseShapingL = 0.0;
+
+ bynR[0] = 1000;
+ bynR[1] = 301;
+ bynR[2] = 176;
+ bynR[3] = 125;
+ bynR[4] = 97;
+ bynR[5] = 79;
+ bynR[6] = 67;
+ bynR[7] = 58;
+ bynR[8] = 51;
+ bynR[9] = 46;
+ bynR[10] = 1000;
+ noiseShapingR = 0.0;
+ //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
+}
+
+NotJustAnotherCD::~NotJustAnotherCD() {}
+VstInt32 NotJustAnotherCD::getVendorVersion () {return 1000;}
+void NotJustAnotherCD::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void NotJustAnotherCD::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 NotJustAnotherCD::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 NotJustAnotherCD::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void NotJustAnotherCD::setParameter(VstInt32 index, float value) {
+}
+
+float NotJustAnotherCD::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void NotJustAnotherCD::getParameterName(VstInt32 index, char *text) {
+}
+
+void NotJustAnotherCD::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void NotJustAnotherCD::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 NotJustAnotherCD::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool NotJustAnotherCD::getEffectName(char* name) {
+ vst_strncpy(name, "NotJustAnotherCD", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory NotJustAnotherCD::getPlugCategory() {return kPlugCategEffect;}
+
+bool NotJustAnotherCD::getProductString(char* text) {
+ vst_strncpy (text, "airwindows NotJustAnotherCD", kVstMaxProductStrLen); return true;
+}
+
+bool NotJustAnotherCD::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.h b/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.h
new file mode 100755
index 0000000..39f785e
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCD.h
@@ -0,0 +1,61 @@
+/* ========================================
+ * NotJustAnotherCD - NotJustAnotherCD.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __NotJustAnotherCD_H
+#define __NotJustAnotherCD_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 = 'njac'; //Change this to what the AU identity is!
+
+class NotJustAnotherCD :
+ public AudioEffectX
+{
+public:
+ NotJustAnotherCD(audioMasterCallback audioMaster);
+ ~NotJustAnotherCD();
+ 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 bynL[13];
+ double bynR[13];
+ long double noiseShapingL;
+ long double noiseShapingR;
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCDProc.cpp b/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCDProc.cpp
new file mode 100755
index 0000000..28c4385
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherCD/NotJustAnotherCDProc.cpp
@@ -0,0 +1,506 @@
+/* ========================================
+ * NotJustAnotherCD - NotJustAnotherCD.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NotJustAnotherCD_H
+#include "NotJustAnotherCD.h"
+#endif
+
+void NotJustAnotherCD::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double benfordize;
+ int hotbinA;
+ int hotbinB;
+ double totalA;
+ double totalB;
+ float drySampleL;
+ float drySampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+ drySampleL = inputSampleL;
+ drySampleR = inputSampleR;
+
+ inputSampleL -= noiseShapingL;
+ inputSampleR -= noiseShapingR;
+
+ inputSampleL *= 32768.0;
+ inputSampleR *= 32768.0;
+ //0-1 is now one bit, now we dither
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+
+ inputSampleL /= 32768.0;
+ inputSampleR /= 32768.0;
+
+ noiseShapingL += inputSampleL - drySampleL;
+ noiseShapingR += inputSampleR - drySampleR;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void NotJustAnotherCD::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double benfordize;
+ int hotbinA;
+ int hotbinB;
+ double totalA;
+ double totalB;
+ double drySampleL;
+ double drySampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+ drySampleL = inputSampleL;
+ drySampleR = inputSampleR;
+
+
+ inputSampleL -= noiseShapingL;
+ inputSampleR -= noiseShapingR;
+
+ inputSampleL *= 32768.0;
+ inputSampleR *= 32768.0;
+ //0-1 is now one bit, now we dither
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+
+ inputSampleL /= 32768.0;
+ inputSampleR /= 32768.0;
+
+ noiseShapingL += inputSampleL - drySampleL;
+ noiseShapingR += inputSampleR - drySampleR;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/NotJustAnotherDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/NotJustAnotherDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NotJustAnotherDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/NotJustAnotherDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..0b83621
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.cpp b/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.cpp
new file mode 100755
index 0000000..22a3cc7
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.cpp
@@ -0,0 +1,103 @@
+/* ========================================
+ * NotJustAnotherDither - NotJustAnotherDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NotJustAnotherDither_H
+#include "NotJustAnotherDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new NotJustAnotherDither(audioMaster);}
+
+NotJustAnotherDither::NotJustAnotherDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ bynL[0] = 1000;
+ bynL[1] = 301;
+ bynL[2] = 176;
+ bynL[3] = 125;
+ bynL[4] = 97;
+ bynL[5] = 79;
+ bynL[6] = 67;
+ bynL[7] = 58;
+ bynL[8] = 51;
+ bynL[9] = 46;
+ bynL[10] = 1000;
+ noiseShapingL = 0.0;
+
+ bynR[0] = 1000;
+ bynR[1] = 301;
+ bynR[2] = 176;
+ bynR[3] = 125;
+ bynR[4] = 97;
+ bynR[5] = 79;
+ bynR[6] = 67;
+ bynR[7] = 58;
+ bynR[8] = 51;
+ bynR[9] = 46;
+ bynR[10] = 1000;
+ noiseShapingR = 0.0;
+ //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
+}
+
+NotJustAnotherDither::~NotJustAnotherDither() {}
+VstInt32 NotJustAnotherDither::getVendorVersion () {return 1000;}
+void NotJustAnotherDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void NotJustAnotherDither::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 NotJustAnotherDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 NotJustAnotherDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void NotJustAnotherDither::setParameter(VstInt32 index, float value) {
+ }
+
+float NotJustAnotherDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void NotJustAnotherDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void NotJustAnotherDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void NotJustAnotherDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 NotJustAnotherDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool NotJustAnotherDither::getEffectName(char* name) {
+ vst_strncpy(name, "NotJustAnotherDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory NotJustAnotherDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool NotJustAnotherDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows NotJustAnotherDither", kVstMaxProductStrLen); return true;
+}
+
+bool NotJustAnotherDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.h b/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.h
new file mode 100755
index 0000000..37abf4c
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDither.h
@@ -0,0 +1,61 @@
+/* ========================================
+ * NotJustAnotherDither - NotJustAnotherDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __NotJustAnotherDither_H
+#define __NotJustAnotherDither_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 = 'njad'; //Change this to what the AU identity is!
+
+class NotJustAnotherDither :
+ public AudioEffectX
+{
+public:
+ NotJustAnotherDither(audioMasterCallback audioMaster);
+ ~NotJustAnotherDither();
+ 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 bynL[13];
+ double bynR[13];
+ long double noiseShapingL;
+ long double noiseShapingR;
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDitherProc.cpp b/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDitherProc.cpp
new file mode 100755
index 0000000..46a073e
--- /dev/null
+++ b/plugins/LinuxVST/src/NotJustAnotherDither/NotJustAnotherDitherProc.cpp
@@ -0,0 +1,505 @@
+/* ========================================
+ * NotJustAnotherDither - NotJustAnotherDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __NotJustAnotherDither_H
+#include "NotJustAnotherDither.h"
+#endif
+
+void NotJustAnotherDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double benfordize;
+ int hotbinA;
+ int hotbinB;
+ double totalA;
+ double totalB;
+ float drySampleL;
+ float drySampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+ drySampleL = inputSampleL;
+ drySampleR = inputSampleR;
+
+ inputSampleL -= noiseShapingL;
+ inputSampleR -= noiseShapingR;
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ noiseShapingL += inputSampleL - drySampleL;
+ noiseShapingR += inputSampleR - drySampleR;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void NotJustAnotherDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double benfordize;
+ int hotbinA;
+ int hotbinB;
+ double totalA;
+ double totalB;
+ double drySampleL;
+ double drySampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+ drySampleL = inputSampleL;
+ drySampleR = inputSampleR;
+
+ inputSampleL -= noiseShapingL;
+ inputSampleR -= noiseShapingR;
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ //begin L
+ benfordize = floor(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynL[hotbinA] += 1;
+ totalA += (301-bynL[1]);
+ totalA += (176-bynL[2]);
+ totalA += (125-bynL[3]);
+ totalA += (97-bynL[4]);
+ totalA += (79-bynL[5]);
+ totalA += (67-bynL[6]);
+ totalA += (58-bynL[7]);
+ totalA += (51-bynL[8]);
+ totalA += (46-bynL[9]);
+ bynL[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleL);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynL[hotbinB] += 1;
+ totalB += (301-bynL[1]);
+ totalB += (176-bynL[2]);
+ totalB += (125-bynL[3]);
+ totalB += (97-bynL[4]);
+ totalB += (79-bynL[5]);
+ totalB += (67-bynL[6]);
+ totalB += (58-bynL[7]);
+ totalB += (51-bynL[8]);
+ totalB += (46-bynL[9]);
+ bynL[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynL[hotbinA] += 1;
+ inputSampleL = floor(inputSampleL);
+ }
+ else
+ {
+ bynL[hotbinB] += 1;
+ inputSampleL = ceil(inputSampleL);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynL[1] + bynL[2] + bynL[3] + bynL[4] + bynL[5] + bynL[6] + bynL[7] + bynL[8] + bynL[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynL[1] /= totalA;
+ bynL[2] /= totalA;
+ bynL[3] /= totalA;
+ bynL[4] /= totalA;
+ bynL[5] /= totalA;
+ bynL[6] /= totalA;
+ bynL[7] /= totalA;
+ bynL[8] /= totalA;
+ bynL[9] /= totalA;
+ bynL[10] /= 2; //catchall for garbage data
+ //end L
+
+ //begin R
+ benfordize = floor(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinA = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number floored
+ totalA = 0;
+ if ((hotbinA > 0) && (hotbinA < 10))
+ {
+ bynR[hotbinA] += 1;
+ totalA += (301-bynR[1]);
+ totalA += (176-bynR[2]);
+ totalA += (125-bynR[3]);
+ totalA += (97-bynR[4]);
+ totalA += (79-bynR[5]);
+ totalA += (67-bynR[6]);
+ totalA += (58-bynR[7]);
+ totalA += (51-bynR[8]);
+ totalA += (46-bynR[9]);
+ bynR[hotbinA] -= 1;
+ } else {hotbinA = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ benfordize = ceil(inputSampleR);
+ while (benfordize >= 1.0) {benfordize /= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ if (benfordize < 1.0) {benfordize *= 10;}
+ hotbinB = floor(benfordize);
+ //hotbin becomes the Benford bin value for this number ceiled
+ totalB = 0;
+ if ((hotbinB > 0) && (hotbinB < 10))
+ {
+ bynR[hotbinB] += 1;
+ totalB += (301-bynR[1]);
+ totalB += (176-bynR[2]);
+ totalB += (125-bynR[3]);
+ totalB += (97-bynR[4]);
+ totalB += (79-bynR[5]);
+ totalB += (67-bynR[6]);
+ totalB += (58-bynR[7]);
+ totalB += (51-bynR[8]);
+ totalB += (46-bynR[9]);
+ bynR[hotbinB] -= 1;
+ } else {hotbinB = 10;}
+ //produce total number- smaller is closer to Benford real
+
+ if (totalA < totalB)
+ {
+ bynR[hotbinA] += 1;
+ inputSampleR = floor(inputSampleR);
+ }
+ else
+ {
+ bynR[hotbinB] += 1;
+ inputSampleR = ceil(inputSampleR);
+ }
+ //assign the relevant one to the delay line
+ //and floor/ceil signal accordingly
+
+ totalA = bynR[1] + bynR[2] + bynR[3] + bynR[4] + bynR[5] + bynR[6] + bynR[7] + bynR[8] + bynR[9];
+ totalA /= 1000;
+ if (totalA = 0) totalA = 1;
+ bynR[1] /= totalA;
+ bynR[2] /= totalA;
+ bynR[3] /= totalA;
+ bynR[4] /= totalA;
+ bynR[5] /= totalA;
+ bynR[6] /= totalA;
+ bynR[7] /= totalA;
+ bynR[8] /= totalA;
+ bynR[9] /= totalA;
+ bynR[10] /= 2; //catchall for garbage data
+ //end R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ noiseShapingL += inputSampleL - drySampleL;
+ noiseShapingR += inputSampleR - drySampleR;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/PaulDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/PaulDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/PaulDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/PaulDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/PaulDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..b1167da
--- /dev/null
+++ b/plugins/LinuxVST/src/PaulDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/PaulDither/PaulDither.cpp b/plugins/LinuxVST/src/PaulDither/PaulDither.cpp
new file mode 100755
index 0000000..c9d1189
--- /dev/null
+++ b/plugins/LinuxVST/src/PaulDither/PaulDither.cpp
@@ -0,0 +1,79 @@
+/* ========================================
+ * PaulDither - PaulDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __PaulDither_H
+#include "PaulDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new PaulDither(audioMaster);}
+
+PaulDither::PaulDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ previousDitherL = 0.0;
+ previousDitherR = 0.0;
+ //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
+}
+
+PaulDither::~PaulDither() {}
+VstInt32 PaulDither::getVendorVersion () {return 1000;}
+void PaulDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void PaulDither::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 PaulDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 PaulDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void PaulDither::setParameter(VstInt32 index, float value) {
+}
+
+float PaulDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void PaulDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void PaulDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void PaulDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 PaulDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool PaulDither::getEffectName(char* name) {
+ vst_strncpy(name, "PaulDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory PaulDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool PaulDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows PaulDither", kVstMaxProductStrLen); return true;
+}
+
+bool PaulDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/PaulDither/PaulDither.h b/plugins/LinuxVST/src/PaulDither/PaulDither.h
new file mode 100755
index 0000000..2b14a7a
--- /dev/null
+++ b/plugins/LinuxVST/src/PaulDither/PaulDither.h
@@ -0,0 +1,59 @@
+/* ========================================
+ * PaulDither - PaulDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __PaulDither_H
+#define __PaulDither_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 = 'paul'; //Change this to what the AU identity is!
+
+class PaulDither :
+ public AudioEffectX
+{
+public:
+ PaulDither(audioMasterCallback audioMaster);
+ ~PaulDither();
+ 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 previousDitherL;
+ double previousDitherR;
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/PaulDither/PaulDitherProc.cpp b/plugins/LinuxVST/src/PaulDither/PaulDitherProc.cpp
new file mode 100755
index 0000000..508b00b
--- /dev/null
+++ b/plugins/LinuxVST/src/PaulDither/PaulDitherProc.cpp
@@ -0,0 +1,202 @@
+/* ========================================
+ * PaulDither - PaulDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __PaulDither_H
+#include "PaulDither.h"
+#endif
+
+void PaulDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ double currentDitherL;
+ double currentDitherR;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ currentDitherL = (rand()/(double)RAND_MAX);
+ currentDitherR = (rand()/(double)RAND_MAX);
+
+ inputSampleL += currentDitherL;
+ inputSampleR += currentDitherR;
+
+ inputSampleL -= previousDitherL;
+ inputSampleR -= previousDitherR;
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+
+ previousDitherL = currentDitherL;
+ previousDitherR = currentDitherR;
+
+ //Paul Frindle: It's true that the dither itself can sound different
+ //if it's given a different freq response and you get to hear it.
+ //The one we use most is triangular single pole high pass dither.
+ //It not freq bent enough sound odd, but is slightly less audible than
+ //flat dither. It can also be easily made by taking one sample of dither
+ //away from the previous one - this gives you the triangular PDF and the
+ //filtering in one go :-)
+
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void PaulDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ double currentDitherL;
+ double currentDitherR;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ currentDitherL = (rand()/(double)RAND_MAX);
+ currentDitherR = (rand()/(double)RAND_MAX);
+
+ inputSampleL += currentDitherL;
+ inputSampleR += currentDitherR;
+
+ inputSampleL -= previousDitherL;
+ inputSampleR -= previousDitherR;
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+
+ previousDitherL = currentDitherL;
+ previousDitherR = currentDitherR;
+
+ //Paul Frindle: It's true that the dither itself can sound different
+ //if it's given a different freq response and you get to hear it.
+ //The one we use most is triangular single pole high pass dither.
+ //It not freq bent enough sound odd, but is slightly less audible than
+ //flat dither. It can also be easily made by taking one sample of dither
+ //away from the previous one - this gives you the triangular PDF and the
+ //filtering in one go :-)
+
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/SpatializeDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/SpatializeDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/SpatializeDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/SpatializeDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/SpatializeDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..cf790c5
--- /dev/null
+++ b/plugins/LinuxVST/src/SpatializeDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/SpatializeDither/SpatializeDither.cpp b/plugins/LinuxVST/src/SpatializeDither/SpatializeDither.cpp
new file mode 100755
index 0000000..c265704
--- /dev/null
+++ b/plugins/LinuxVST/src/SpatializeDither/SpatializeDither.cpp
@@ -0,0 +1,80 @@
+/* ========================================
+ * SpatializeDither - SpatializeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __SpatializeDither_H
+#include "SpatializeDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new SpatializeDither(audioMaster);}
+
+SpatializeDither::SpatializeDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ contingentErrL = 0.0;
+ contingentErrR = 0.0;
+ flip = false;
+ //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
+}
+
+SpatializeDither::~SpatializeDither() {}
+VstInt32 SpatializeDither::getVendorVersion () {return 1000;}
+void SpatializeDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void SpatializeDither::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 SpatializeDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 SpatializeDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void SpatializeDither::setParameter(VstInt32 index, float value) {
+ }
+
+float SpatializeDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void SpatializeDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void SpatializeDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void SpatializeDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 SpatializeDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool SpatializeDither::getEffectName(char* name) {
+ vst_strncpy(name, "SpatializeDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory SpatializeDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool SpatializeDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows SpatializeDither", kVstMaxProductStrLen); return true;
+}
+
+bool SpatializeDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/SpatializeDither/SpatializeDither.h b/plugins/LinuxVST/src/SpatializeDither/SpatializeDither.h
new file mode 100755
index 0000000..1a5213a
--- /dev/null
+++ b/plugins/LinuxVST/src/SpatializeDither/SpatializeDither.h
@@ -0,0 +1,59 @@
+/* ========================================
+ * SpatializeDither - SpatializeDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __SpatializeDither_H
+#define __SpatializeDither_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 = 'sdtr'; //Change this to what the AU identity is!
+
+class SpatializeDither :
+ public AudioEffectX
+{
+public:
+ SpatializeDither(audioMasterCallback audioMaster);
+ ~SpatializeDither();
+ 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 contingentErrL;
+ double contingentErrR;
+ bool flip;
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/SpatializeDither/SpatializeDitherProc.cpp b/plugins/LinuxVST/src/SpatializeDither/SpatializeDitherProc.cpp
new file mode 100755
index 0000000..aa092f0
--- /dev/null
+++ b/plugins/LinuxVST/src/SpatializeDither/SpatializeDitherProc.cpp
@@ -0,0 +1,244 @@
+/* ========================================
+ * SpatializeDither - SpatializeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __SpatializeDither_H
+#include "SpatializeDither.h"
+#endif
+
+void SpatializeDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double contingentRnd;
+ double absSample;
+ double contingent;
+ double randyConstant = 1.61803398874989484820458683436563811772030917980576;
+ double omegaConstant = 0.56714329040978387299996866221035554975381578718651;
+ double expConstant = 0.06598803584531253707679018759684642493857704825279;
+
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ if (inputSampleL > 0) inputSampleL += 0.383;
+ if (inputSampleL < 0) inputSampleL -= 0.383;
+ if (inputSampleR > 0) inputSampleR += 0.383;
+ if (inputSampleR < 0) inputSampleR -= 0.383;
+ //adjusting to permit more information drug outta the noisefloor
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrL*omegaConstant; //include err
+ absSample = fabs(inputSampleL);
+ contingentErrL = absSample - floor(absSample); //get next err
+ contingent = contingentErrL * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleL += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleL = floor(inputSampleL);
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrR*omegaConstant; //include err
+ absSample = fabs(inputSampleR);
+ contingentErrR = absSample - floor(absSample); //get next err
+ contingent = contingentErrR * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleR += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleR = floor(inputSampleR);
+
+ //note: this does not dither for values exactly the same as 16 bit values-
+ //which forces the dither to gate at 0.0. It goes to digital black,
+ //and does a teeny parallel-compression thing when almost at digital black.
+ flip = !flip;
+
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void SpatializeDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double contingentRnd;
+ double absSample;
+ double contingent;
+ double randyConstant = 1.61803398874989484820458683436563811772030917980576;
+ double omegaConstant = 0.56714329040978387299996866221035554975381578718651;
+ double expConstant = 0.06598803584531253707679018759684642493857704825279;
+
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ if (inputSampleL > 0) inputSampleL += 0.383;
+ if (inputSampleL < 0) inputSampleL -= 0.383;
+ if (inputSampleR > 0) inputSampleR += 0.383;
+ if (inputSampleR < 0) inputSampleR -= 0.383;
+ //adjusting to permit more information drug outta the noisefloor
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrL*omegaConstant; //include err
+ absSample = fabs(inputSampleL);
+ contingentErrL = absSample - floor(absSample); //get next err
+ contingent = contingentErrL * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleL += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleL = floor(inputSampleL);
+
+ contingentRnd = (((rand()/(double)RAND_MAX)+(rand()/(double)RAND_MAX))-1.0) * randyConstant; //produce TPDF dist, scale
+ contingentRnd -= contingentErrR*omegaConstant; //include err
+ absSample = fabs(inputSampleR);
+ contingentErrR = absSample - floor(absSample); //get next err
+ contingent = contingentErrR * 2.0; //scale of quantization levels
+ if (contingent > 1.0) contingent = ((-contingent+2.0)*omegaConstant) + expConstant;
+ else contingent = (contingent * omegaConstant) + expConstant;
+ //zero is next to a quantization level, one is exactly between them
+ if (flip) contingentRnd = (contingentRnd * (1.0-contingent)) + contingent + 0.5;
+ else contingentRnd = (contingentRnd * (1.0-contingent)) - contingent + 0.5;
+ inputSampleR += (contingentRnd * contingent);
+ //Contingent Dither
+ inputSampleR = floor(inputSampleR);
+
+ //note: this does not dither for values exactly the same as 16 bit values-
+ //which forces the dither to gate at 0.0. It goes to digital black,
+ //and does a teeny parallel-compression thing when almost at digital black.
+ flip = !flip;
+
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/SubsOnly/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/SubsOnly/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/SubsOnly/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/SubsOnly/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/SubsOnly/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..62beaf4
--- /dev/null
+++ b/plugins/LinuxVST/src/SubsOnly/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/SubsOnly/SubsOnly.cpp b/plugins/LinuxVST/src/SubsOnly/SubsOnly.cpp
new file mode 100755
index 0000000..ca64de5
--- /dev/null
+++ b/plugins/LinuxVST/src/SubsOnly/SubsOnly.cpp
@@ -0,0 +1,118 @@
+/* ========================================
+ * SubsOnly - SubsOnly.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __SubsOnly_H
+#include "SubsOnly.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new SubsOnly(audioMaster);}
+
+SubsOnly::SubsOnly(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ iirSampleAL = 0.0;
+ iirSampleBL = 0.0;
+ iirSampleCL = 0.0;
+ iirSampleDL = 0.0;
+ iirSampleEL = 0.0;
+ iirSampleFL = 0.0;
+ iirSampleGL = 0.0;
+ iirSampleHL = 0.0;
+ iirSampleIL = 0.0;
+ iirSampleJL = 0.0;
+ iirSampleKL = 0.0;
+ iirSampleLL = 0.0;
+ iirSampleML = 0.0;
+ iirSampleNL = 0.0;
+ iirSampleOL = 0.0;
+ iirSamplePL = 0.0;
+ iirSampleQL = 0.0;
+ iirSampleRL = 0.0;
+ iirSampleSL = 0.0;
+ iirSampleTL = 0.0;
+ iirSampleUL = 0.0;
+ iirSampleVL = 0.0;
+ iirSampleWL = 0.0;
+ iirSampleXL = 0.0;
+ iirSampleYL = 0.0;
+ iirSampleZL = 0.0;
+
+ iirSampleAR = 0.0;
+ iirSampleBR = 0.0;
+ iirSampleCR = 0.0;
+ iirSampleDR = 0.0;
+ iirSampleER = 0.0;
+ iirSampleFR = 0.0;
+ iirSampleGR = 0.0;
+ iirSampleHR = 0.0;
+ iirSampleIR = 0.0;
+ iirSampleJR = 0.0;
+ iirSampleKR = 0.0;
+ iirSampleLR = 0.0;
+ iirSampleMR = 0.0;
+ iirSampleNR = 0.0;
+ iirSampleOR = 0.0;
+ iirSamplePR = 0.0;
+ iirSampleQR = 0.0;
+ iirSampleRR = 0.0;
+ iirSampleSR = 0.0;
+ iirSampleTR = 0.0;
+ iirSampleUR = 0.0;
+ iirSampleVR = 0.0;
+ iirSampleWR = 0.0;
+ iirSampleXR = 0.0;
+ iirSampleYR = 0.0;
+ iirSampleZR = 0.0;
+
+ _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
+ vst_strncpy (_programName, "Default", kVstMaxProgNameLen); // default program name
+}
+
+SubsOnly::~SubsOnly() {}
+VstInt32 SubsOnly::getVendorVersion () {return 1000;}
+void SubsOnly::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void SubsOnly::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!
+
+void SubsOnly::setParameter(VstInt32 index, float value) {
+}
+
+float SubsOnly::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void SubsOnly::getParameterName(VstInt32 index, char *text) {
+}
+
+void SubsOnly::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void SubsOnly::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 SubsOnly::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool SubsOnly::getEffectName(char* name) {
+ vst_strncpy(name, "SubsOnly", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory SubsOnly::getPlugCategory() {return kPlugCategEffect;}
+
+bool SubsOnly::getProductString(char* text) {
+ vst_strncpy (text, "airwindows SubsOnly", kVstMaxProductStrLen); return true;
+}
+
+bool SubsOnly::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/SubsOnly/SubsOnly.h b/plugins/LinuxVST/src/SubsOnly/SubsOnly.h
new file mode 100755
index 0000000..316a446
--- /dev/null
+++ b/plugins/LinuxVST/src/SubsOnly/SubsOnly.h
@@ -0,0 +1,108 @@
+/* ========================================
+ * SubsOnly - SubsOnly.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __SubsOnly_H
+#define __SubsOnly_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 = 'sbon'; //Change this to what the AU identity is!
+
+class SubsOnly :
+ public AudioEffectX
+{
+public:
+ SubsOnly(audioMasterCallback audioMaster);
+ ~SubsOnly();
+ 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 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;
+ double iirSampleGL;
+ double iirSampleHL;
+ double iirSampleIL;
+ double iirSampleJL;
+ double iirSampleKL;
+ double iirSampleLL;
+ double iirSampleML;
+ double iirSampleNL;
+ double iirSampleOL;
+ double iirSamplePL;
+ double iirSampleQL;
+ double iirSampleRL;
+ double iirSampleSL;
+ double iirSampleTL;
+ double iirSampleUL;
+ double iirSampleVL;
+ double iirSampleWL;
+ double iirSampleXL;
+ double iirSampleYL;
+ double iirSampleZL;
+
+ double iirSampleAR;
+ double iirSampleBR;
+ double iirSampleCR;
+ double iirSampleDR;
+ double iirSampleER;
+ double iirSampleFR;
+ double iirSampleGR;
+ double iirSampleHR;
+ double iirSampleIR;
+ double iirSampleJR;
+ double iirSampleKR;
+ double iirSampleLR;
+ double iirSampleMR;
+ double iirSampleNR;
+ double iirSampleOR;
+ double iirSamplePR;
+ double iirSampleQR;
+ double iirSampleRR;
+ double iirSampleSR;
+ double iirSampleTR;
+ double iirSampleUR;
+ double iirSampleVR;
+ double iirSampleWR;
+ double iirSampleXR;
+ double iirSampleYR;
+ double iirSampleZR;
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/SubsOnly/SubsOnlyProc.cpp b/plugins/LinuxVST/src/SubsOnly/SubsOnlyProc.cpp
new file mode 100755
index 0000000..23e7923
--- /dev/null
+++ b/plugins/LinuxVST/src/SubsOnly/SubsOnlyProc.cpp
@@ -0,0 +1,576 @@
+/* ========================================
+ * SubsOnly - SubsOnly.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __SubsOnly_H
+#include "SubsOnly.h"
+#endif
+
+void SubsOnly::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 iirAmount = 2250/44100.0;
+ double gaintarget = 1.42;
+ double gain;
+ iirAmount /= overallscale;
+ double altAmount = 1.0 - iirAmount;
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ gain = gaintarget;
+
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAL = (iirSampleAL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleAL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleBL = (iirSampleBL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleBL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleCL = (iirSampleCL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleCL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleDL = (iirSampleDL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleDL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleEL = (iirSampleEL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleEL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleFL = (iirSampleFL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleFL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleGL = (iirSampleGL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleGL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleHL = (iirSampleHL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleHL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleIL = (iirSampleIL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleIL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleJL = (iirSampleJL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleJL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleKL = (iirSampleKL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleKL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleLL = (iirSampleLL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleLL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleML = (iirSampleML * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleML;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleNL = (iirSampleNL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleNL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleOL = (iirSampleOL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleOL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSamplePL = (iirSamplePL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSamplePL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleQL = (iirSampleQL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleQL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleRL = (iirSampleRL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleRL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleSL = (iirSampleSL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleSL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleTL = (iirSampleTL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleTL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleUL = (iirSampleUL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleUL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleVL = (iirSampleVL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleVL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleWL = (iirSampleWL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleWL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleXL = (iirSampleXL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleXL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleYL = (iirSampleYL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleYL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleZL = (iirSampleZL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleZL;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ gain = gaintarget;
+
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAR = (iirSampleAR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleAR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleBR = (iirSampleBR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleBR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleCR = (iirSampleCR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleCR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleDR = (iirSampleDR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleDR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleER = (iirSampleER * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleER;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleFR = (iirSampleFR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleFR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleGR = (iirSampleGR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleGR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleHR = (iirSampleHR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleHR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleIR = (iirSampleIR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleIR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleJR = (iirSampleJR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleJR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleKR = (iirSampleKR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleKR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleLR = (iirSampleLR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleLR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleMR = (iirSampleMR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleMR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleNR = (iirSampleNR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleNR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleOR = (iirSampleOR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleOR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSamplePR = (iirSamplePR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSamplePR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleQR = (iirSampleQR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleQR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleRR = (iirSampleRR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleRR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleSR = (iirSampleSR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleSR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleTR = (iirSampleTR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleTR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleUR = (iirSampleUR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleUR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleVR = (iirSampleVR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleVR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleWR = (iirSampleWR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleWR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleXR = (iirSampleXR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleXR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleYR = (iirSampleYR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleYR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleZR = (iirSampleZR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleZR;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void SubsOnly::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 iirAmount = 2250/44100.0;
+ double gaintarget = 1.42;
+ double gain;
+ iirAmount /= overallscale;
+ double altAmount = 1.0 - iirAmount;
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ gain = gaintarget;
+
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAL = (iirSampleAL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleAL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleBL = (iirSampleBL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleBL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleCL = (iirSampleCL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleCL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleDL = (iirSampleDL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleDL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleEL = (iirSampleEL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleEL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleFL = (iirSampleFL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleFL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleGL = (iirSampleGL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleGL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleHL = (iirSampleHL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleHL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleIL = (iirSampleIL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleIL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleJL = (iirSampleJL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleJL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleKL = (iirSampleKL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleKL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleLL = (iirSampleLL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleLL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleML = (iirSampleML * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleML;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleNL = (iirSampleNL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleNL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleOL = (iirSampleOL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleOL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSamplePL = (iirSamplePL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSamplePL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleQL = (iirSampleQL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleQL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleRL = (iirSampleRL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleRL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleSL = (iirSampleSL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleSL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleTL = (iirSampleTL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleTL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleUL = (iirSampleUL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleUL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleVL = (iirSampleVL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleVL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleWL = (iirSampleWL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleWL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleXL = (iirSampleXL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleXL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleYL = (iirSampleYL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleYL;
+ inputSampleL *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ iirSampleZL = (iirSampleZL * altAmount) + (inputSampleL * iirAmount); inputSampleL = iirSampleZL;
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ gain = gaintarget;
+
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ iirSampleAR = (iirSampleAR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleAR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleBR = (iirSampleBR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleBR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleCR = (iirSampleCR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleCR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleDR = (iirSampleDR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleDR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleER = (iirSampleER * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleER;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleFR = (iirSampleFR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleFR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleGR = (iirSampleGR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleGR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleHR = (iirSampleHR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleHR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleIR = (iirSampleIR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleIR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleJR = (iirSampleJR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleJR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleKR = (iirSampleKR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleKR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleLR = (iirSampleLR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleLR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleMR = (iirSampleMR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleMR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleNR = (iirSampleNR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleNR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleOR = (iirSampleOR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleOR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSamplePR = (iirSamplePR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSamplePR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleQR = (iirSampleQR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleQR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleRR = (iirSampleRR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleRR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleSR = (iirSampleSR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleSR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleTR = (iirSampleTR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleTR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleUR = (iirSampleUR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleUR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleVR = (iirSampleVR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleVR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleWR = (iirSampleWR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleWR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleXR = (iirSampleXR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleXR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleYR = (iirSampleYR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleYR;
+ inputSampleR *= gain; gain = ((gain-1)*0.75)+1;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ iirSampleZR = (iirSampleZR * altAmount) + (inputSampleR * iirAmount); inputSampleR = iirSampleZR;
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/TapeDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/TapeDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/TapeDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/TapeDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/TapeDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..9317cc9
--- /dev/null
+++ b/plugins/LinuxVST/src/TapeDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/TapeDither/TapeDither.cpp b/plugins/LinuxVST/src/TapeDither/TapeDither.cpp
new file mode 100755
index 0000000..220c911
--- /dev/null
+++ b/plugins/LinuxVST/src/TapeDither/TapeDither.cpp
@@ -0,0 +1,85 @@
+/* ========================================
+ * TapeDither - TapeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __TapeDither_H
+#include "TapeDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new TapeDither(audioMaster);}
+
+TapeDither::TapeDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ previousDither1L = 0.0;
+ previousDither2L = 0.0;
+ previousDither3L = 0.0;
+ previousDither4L = 0.0;
+ previousDither1R = 0.0;
+ previousDither2R = 0.0;
+ previousDither3R = 0.0;
+ previousDither4R = 0.0;
+ //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
+}
+
+TapeDither::~TapeDither() {}
+VstInt32 TapeDither::getVendorVersion () {return 1000;}
+void TapeDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void TapeDither::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 TapeDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 TapeDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void TapeDither::setParameter(VstInt32 index, float value) {
+}
+
+float TapeDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void TapeDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void TapeDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void TapeDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 TapeDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool TapeDither::getEffectName(char* name) {
+ vst_strncpy(name, "TapeDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory TapeDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool TapeDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows TapeDither", kVstMaxProductStrLen); return true;
+}
+
+bool TapeDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/TapeDither/TapeDither.h b/plugins/LinuxVST/src/TapeDither/TapeDither.h
new file mode 100755
index 0000000..a2ed603
--- /dev/null
+++ b/plugins/LinuxVST/src/TapeDither/TapeDither.h
@@ -0,0 +1,65 @@
+/* ========================================
+ * TapeDither - TapeDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __TapeDither_H
+#define __TapeDither_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 = 'tdth'; //Change this to what the AU identity is!
+
+class TapeDither :
+ public AudioEffectX
+{
+public:
+ TapeDither(audioMasterCallback audioMaster);
+ ~TapeDither();
+ 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 previousDither1L;
+ double previousDither2L;
+ double previousDither3L;
+ double previousDither4L;
+ double previousDither1R;
+ double previousDither2R;
+ double previousDither3R;
+ double previousDither4R;
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/TapeDither/TapeDitherProc.cpp b/plugins/LinuxVST/src/TapeDither/TapeDitherProc.cpp
new file mode 100755
index 0000000..b45702c
--- /dev/null
+++ b/plugins/LinuxVST/src/TapeDither/TapeDitherProc.cpp
@@ -0,0 +1,196 @@
+/* ========================================
+ * TapeDither - TapeDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __TapeDither_H
+#include "TapeDither.h"
+#endif
+
+void TapeDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double currentDitherL;
+ double currentDitherR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ currentDitherL = (rand()/(double)RAND_MAX);
+ currentDitherR = (rand()/(double)RAND_MAX);
+
+ inputSampleL += currentDitherL;
+ inputSampleR += currentDitherR;
+ inputSampleL -= previousDither4L;
+ inputSampleR -= previousDither4R;
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+
+ previousDither4L = previousDither3L;
+ previousDither3L = previousDither2L;
+ previousDither2L = previousDither1L;
+ previousDither1L = currentDitherL;
+
+ previousDither4R = previousDither3R;
+ previousDither3R = previousDither2R;
+ previousDither2R = previousDither1R;
+ previousDither1R = currentDitherR;
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void TapeDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ double currentDitherL;
+ double currentDitherR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ currentDitherL = (rand()/(double)RAND_MAX);
+ currentDitherR = (rand()/(double)RAND_MAX);
+
+ inputSampleL += currentDitherL;
+ inputSampleR += currentDitherR;
+ inputSampleL -= previousDither4L;
+ inputSampleR -= previousDither4R;
+
+ inputSampleL = floor(inputSampleL);
+ inputSampleR = floor(inputSampleR);
+
+ previousDither4L = previousDither3L;
+ previousDither3L = previousDither2L;
+ previousDither2L = previousDither1L;
+ previousDither1L = currentDitherL;
+
+ previousDither4R = previousDither3R;
+ previousDither3R = previousDither2R;
+ previousDither2R = previousDither1R;
+ previousDither1R = currentDitherR;
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file
diff --git a/plugins/LinuxVST/src/VinylDither/.vs/Console4Channel64/v14/.suo b/plugins/LinuxVST/src/VinylDither/.vs/Console4Channel64/v14/.suo
new file mode 100755
index 0000000..777b846
--- /dev/null
+++ b/plugins/LinuxVST/src/VinylDither/.vs/Console4Channel64/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/VinylDither/.vs/VSTProject/v14/.suo b/plugins/LinuxVST/src/VinylDither/.vs/VSTProject/v14/.suo
new file mode 100755
index 0000000..02fd648
--- /dev/null
+++ b/plugins/LinuxVST/src/VinylDither/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/LinuxVST/src/VinylDither/VinylDither.cpp b/plugins/LinuxVST/src/VinylDither/VinylDither.cpp
new file mode 100755
index 0000000..3b197b5
--- /dev/null
+++ b/plugins/LinuxVST/src/VinylDither/VinylDither.cpp
@@ -0,0 +1,113 @@
+/* ========================================
+ * VinylDither - VinylDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __VinylDither_H
+#include "VinylDither.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new VinylDither(audioMaster);}
+
+VinylDither::VinylDither(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ NSOddL = 0.0;
+ prevL = 0.0;
+ nsL[0] = 0;
+ nsL[1] = 0;
+ nsL[2] = 0;
+ nsL[3] = 0;
+ nsL[4] = 0;
+ nsL[5] = 0;
+ nsL[6] = 0;
+ nsL[7] = 0;
+ nsL[8] = 0;
+ nsL[9] = 0;
+ nsL[10] = 0;
+ nsL[11] = 0;
+ nsL[12] = 0;
+ nsL[13] = 0;
+ nsL[14] = 0;
+ nsL[15] = 0;
+ NSOddR = 0.0;
+ prevR = 0.0;
+ nsR[0] = 0;
+ nsR[1] = 0;
+ nsR[2] = 0;
+ nsR[3] = 0;
+ nsR[4] = 0;
+ nsR[5] = 0;
+ nsR[6] = 0;
+ nsR[7] = 0;
+ nsR[8] = 0;
+ nsR[9] = 0;
+ nsR[10] = 0;
+ nsR[11] = 0;
+ nsR[12] = 0;
+ nsR[13] = 0;
+ nsR[14] = 0;
+ nsR[15] = 0;
+ //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
+}
+
+VinylDither::~VinylDither() {}
+VstInt32 VinylDither::getVendorVersion () {return 1000;}
+void VinylDither::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void VinylDither::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 VinylDither::getChunk (void** data, bool isPreset)
+{
+ return kNumParameters * sizeof(float);
+}
+
+VstInt32 VinylDither::setChunk (void* data, VstInt32 byteSize, bool isPreset)
+{
+ return 0;
+}
+
+void VinylDither::setParameter(VstInt32 index, float value) {
+}
+
+float VinylDither::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void VinylDither::getParameterName(VstInt32 index, char *text) {
+}
+
+void VinylDither::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void VinylDither::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 VinylDither::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool VinylDither::getEffectName(char* name) {
+ vst_strncpy(name, "VinylDither", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory VinylDither::getPlugCategory() {return kPlugCategEffect;}
+
+bool VinylDither::getProductString(char* text) {
+ vst_strncpy (text, "airwindows VinylDither", kVstMaxProductStrLen); return true;
+}
+
+bool VinylDither::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/VinylDither/VinylDither.h b/plugins/LinuxVST/src/VinylDither/VinylDither.h
new file mode 100755
index 0000000..6ffe619
--- /dev/null
+++ b/plugins/LinuxVST/src/VinylDither/VinylDither.h
@@ -0,0 +1,63 @@
+/* ========================================
+ * VinylDither - VinylDither.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __VinylDither_H
+#define __VinylDither_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 = 'vdth'; //Change this to what the AU identity is!
+
+class VinylDither :
+ public AudioEffectX
+{
+public:
+ VinylDither(audioMasterCallback audioMaster);
+ ~VinylDither();
+ 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 NSOddL;
+ double prevL;
+ double nsL[16];
+ double NSOddR;
+ double prevR;
+ double nsR[16];
+
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/VinylDither/VinylDitherProc.cpp b/plugins/LinuxVST/src/VinylDither/VinylDitherProc.cpp
new file mode 100755
index 0000000..099560f
--- /dev/null
+++ b/plugins/LinuxVST/src/VinylDither/VinylDitherProc.cpp
@@ -0,0 +1,340 @@
+/* ========================================
+ * VinylDither - VinylDither.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __VinylDither_H
+#include "VinylDither.h"
+#endif
+
+void VinylDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
+{
+ float* in1 = inputs[0];
+ float* in2 = inputs[1];
+ float* out1 = outputs[0];
+ float* out2 = outputs[1];
+
+ double absSample;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
+ //install noise and then shape it
+ absSample += inputSampleL;
+
+ if (NSOddL > 0) NSOddL -= 0.97;
+ if (NSOddL < 0) NSOddL += 0.97;
+
+ NSOddL -= (NSOddL * NSOddL * NSOddL * 0.475);
+
+ NSOddL += prevL;
+ absSample += (NSOddL*0.475);
+ prevL = floor(absSample) - inputSampleL;
+ inputSampleL = floor(absSample);
+ //TenNines dither L
+
+
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
+ //install noise and then shape it
+ absSample += inputSampleR;
+
+ if (NSOddR > 0) NSOddR -= 0.97;
+ if (NSOddR < 0) NSOddR += 0.97;
+
+ NSOddR -= (NSOddR * NSOddR * NSOddR * 0.475);
+
+ NSOddR += prevR;
+ absSample += (NSOddR*0.475);
+ prevR = floor(absSample) - inputSampleR;
+ inputSampleR = floor(absSample);
+ //TenNines dither R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void VinylDither::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
+{
+ double* in1 = inputs[0];
+ double* in2 = inputs[1];
+ double* out1 = outputs[0];
+ double* out2 = outputs[1];
+
+ double absSample;
+
+ long double inputSampleL;
+ long double inputSampleR;
+
+ while (--sampleFrames >= 0)
+ {
+ inputSampleL = *in1;
+ inputSampleR = *in2;
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ static int noisesource = 0;
+ //this declares a variable before anything else is compiled. It won't keep assigning
+ //it to 0 for every sample, it's as if the declaration doesn't exist in this context,
+ //but it lets me add this denormalization fix in a single place rather than updating
+ //it in three different locations. The variable isn't thread-safe but this is only
+ //a random seed and we can share it with whatever.
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleL = applyresidue;
+ }
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ static int noisesource = 0;
+ noisesource = noisesource % 1700021; noisesource++;
+ int residue = noisesource * noisesource;
+ residue = residue % 170003; residue *= residue;
+ residue = residue % 17011; residue *= residue;
+ residue = residue % 1709; residue *= residue;
+ residue = residue % 173; residue *= residue;
+ residue = residue % 17;
+ double applyresidue = residue;
+ applyresidue *= 0.00000001;
+ applyresidue *= 0.00000001;
+ inputSampleR = applyresidue;
+ //this denormalization routine produces a white noise at -300 dB which the noise
+ //shaping will interact with to produce a bipolar output, but the noise is actually
+ //all positive. That should stop any variables from going denormal, and the routine
+ //only kicks in if digital black is input. As a final touch, if you save to 24-bit
+ //the silence will return to being digital black again.
+ }
+
+ inputSampleL *= 8388608.0;
+ inputSampleR *= 8388608.0;
+ //0-1 is now one bit, now we dither
+
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
+ //install noise and then shape it
+ absSample += inputSampleL;
+
+ if (NSOddL > 0) NSOddL -= 0.97;
+ if (NSOddL < 0) NSOddL += 0.97;
+
+ NSOddL -= (NSOddL * NSOddL * NSOddL * 0.475);
+
+ NSOddL += prevL;
+ absSample += (NSOddL*0.475);
+ prevL = floor(absSample) - inputSampleL;
+ inputSampleL = floor(absSample);
+ //TenNines dither L
+
+
+ absSample = ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
+ absSample += ((rand()/(double)RAND_MAX) - 0.5);
+ nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
+ //install noise and then shape it
+ absSample += inputSampleR;
+
+ if (NSOddR > 0) NSOddR -= 0.97;
+ if (NSOddR < 0) NSOddR += 0.97;
+
+ NSOddR -= (NSOddR * NSOddR * NSOddR * 0.475);
+
+ NSOddR += prevR;
+ absSample += (NSOddR*0.475);
+ prevR = floor(absSample) - inputSampleR;
+ inputSampleR = floor(absSample);
+ //TenNines dither R
+
+ inputSampleL /= 8388608.0;
+ inputSampleR /= 8388608.0;
+
+
+ *out1 = inputSampleL;
+ *out2 = inputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file