aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LinuxVST
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2018-08-20 08:48:56 -0400
committerChris Johnson <jinx6568@sover.net>2018-08-20 08:48:56 -0400
commit2384d83b0fe4f455722e47df9315885ba3c74011 (patch)
tree1af69204bf22a8eb0a3b4942a2d120210f6fc82f /plugins/LinuxVST
parenta559d634ab0dcb39b7e71ccbcb0f2098f4f09e67 (diff)
downloadairwindows-lv2-port-2384d83b0fe4f455722e47df9315885ba3c74011.tar.gz
airwindows-lv2-port-2384d83b0fe4f455722e47df9315885ba3c74011.tar.bz2
airwindows-lv2-port-2384d83b0fe4f455722e47df9315885ba3c74011.zip
BitGlitter (and DeRez update)
Diffstat (limited to 'plugins/LinuxVST')
-rwxr-xr-xplugins/LinuxVST/CMakeLists.txt1
-rwxr-xr-xplugins/LinuxVST/src/BitGlitter/BitGlitter.cpp159
-rwxr-xr-xplugins/LinuxVST/src/BitGlitter/BitGlitter.h85
-rwxr-xr-xplugins/LinuxVST/src/BitGlitter/BitGlitterProc.cpp419
-rwxr-xr-xplugins/LinuxVST/src/DeRez/DeRez.cpp4
-rwxr-xr-xplugins/LinuxVST/src/DeRez/DeRezProc.cpp8
6 files changed, 670 insertions, 6 deletions
diff --git a/plugins/LinuxVST/CMakeLists.txt b/plugins/LinuxVST/CMakeLists.txt
index 7c57029..fb896fd 100755
--- a/plugins/LinuxVST/CMakeLists.txt
+++ b/plugins/LinuxVST/CMakeLists.txt
@@ -11,6 +11,7 @@ add_airwindows_plugin(Acceleration)
add_airwindows_plugin(AtmosphereBuss)
add_airwindows_plugin(AtmophereChannel)
add_airwindows_plugin(Aura)
+add_airwindows_plugin(BitGlitter)
add_airwindows_plugin(BitShiftGain)
add_airwindows_plugin(C5RawBuss)
add_airwindows_plugin(C5RawChannel)
diff --git a/plugins/LinuxVST/src/BitGlitter/BitGlitter.cpp b/plugins/LinuxVST/src/BitGlitter/BitGlitter.cpp
new file mode 100755
index 0000000..7e9cfdb
--- /dev/null
+++ b/plugins/LinuxVST/src/BitGlitter/BitGlitter.cpp
@@ -0,0 +1,159 @@
+/* ========================================
+ * BitGlitter - BitGlitter.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __BitGlitter_H
+#include "BitGlitter.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new BitGlitter(audioMaster);}
+
+BitGlitter::BitGlitter(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ A = 0.5;
+ B = 0.0;
+ C = 0.5;
+ D = 1.0;
+
+ ataLastSampleL = 0.0;
+ ataHalfwaySampleL = 0.0;
+ lastSampleL = 0.0;
+ heldSampleAL = 0.0;
+ positionAL = 0.0;
+ heldSampleBL = 0.0;
+ positionBL = 0.0;
+ lastOutputSampleL = 0.0;
+
+ ataLastSampleR = 0.0;
+ ataHalfwaySampleR = 0.0;
+ lastSampleR = 0.0;
+ heldSampleAR = 0.0;
+ positionAR = 0.0;
+ heldSampleBR = 0.0;
+ positionBR = 0.0;
+ lastOutputSampleR = 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
+}
+
+BitGlitter::~BitGlitter() {}
+VstInt32 BitGlitter::getVendorVersion () {return 1000;}
+void BitGlitter::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void BitGlitter::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 BitGlitter::getChunk (void** data, bool isPreset)
+{
+ float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
+ chunkData[0] = A;
+ chunkData[1] = B;
+ chunkData[2] = C;
+ chunkData[3] = D;
+ /* 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 BitGlitter::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]);
+ /* 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 BitGlitter::setParameter(VstInt32 index, float value) {
+ switch (index) {
+ case kParamA: A = value; break;
+ case kParamB: B = value; break;
+ case kParamC: C = value; break;
+ case kParamD: D = value; break;
+ default: throw; // unknown parameter, shouldn't happen!
+ }
+}
+
+float BitGlitter::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;
+ default: break; // unknown parameter, shouldn't happen!
+ } return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void BitGlitter::getParameterName(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: vst_strncpy (text, "Input", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, "Glitter", kVstMaxParamStrLen); break;
+ case kParamC: vst_strncpy (text, "Output", kVstMaxParamStrLen); break;
+ case kParamD: vst_strncpy (text, "Dry/Wet", kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this is our labels for displaying in the VST host
+}
+
+void BitGlitter::getParameterDisplay(VstInt32 index, char *text) {
+ switch (index) {
+ case kParamA: float2string ((A * 36.0)-18.0, text, kVstMaxParamStrLen); break;
+ case kParamB: float2string (B, text, kVstMaxParamStrLen); break;
+ case kParamC: float2string ((C * 36.0)-18.0, text, kVstMaxParamStrLen); break;
+ case kParamD: float2string (D, text, kVstMaxParamStrLen); break;
+ default: break; // unknown parameter, shouldn't happen!
+ } //this displays the values and handles 'popups' where it's discrete choices
+}
+
+void BitGlitter::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;
+ default: break; // unknown parameter, shouldn't happen!
+ }
+}
+
+VstInt32 BitGlitter::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool BitGlitter::getEffectName(char* name) {
+ vst_strncpy(name, "BitGlitter", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory BitGlitter::getPlugCategory() {return kPlugCategEffect;}
+
+bool BitGlitter::getProductString(char* text) {
+ vst_strncpy (text, "airwindows BitGlitter", kVstMaxProductStrLen); return true;
+}
+
+bool BitGlitter::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/LinuxVST/src/BitGlitter/BitGlitter.h b/plugins/LinuxVST/src/BitGlitter/BitGlitter.h
new file mode 100755
index 0000000..d87e277
--- /dev/null
+++ b/plugins/LinuxVST/src/BitGlitter/BitGlitter.h
@@ -0,0 +1,85 @@
+/* ========================================
+ * BitGlitter - BitGlitter.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __BitGlitter_H
+#define __BitGlitter_H
+
+#ifndef __audioeffect__
+#include "audioeffectx.h"
+#endif
+
+#include <set>
+#include <string>
+#include <math.h>
+
+enum {
+ kParamA = 0,
+ kParamB = 1,
+ kParamC = 2,
+ kParamD = 3,
+ kNumParameters = 4
+}; //
+
+const int kNumPrograms = 0;
+const int kNumInputs = 2;
+const int kNumOutputs = 2;
+const unsigned long kUniqueId = 'btgt'; //Change this to what the AU identity is!
+
+class BitGlitter :
+ public AudioEffectX
+{
+public:
+ BitGlitter(audioMasterCallback audioMaster);
+ ~BitGlitter();
+ 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 ataLastSampleL;
+ double ataHalfwaySampleL;
+ double ataDrySampleL;
+ double lastSampleL;
+ double heldSampleAL;
+ double heldSampleBL;
+ double positionAL;
+ double positionBL;
+ double lastOutputSampleL;
+
+ double ataLastSampleR;
+ double ataHalfwaySampleR;
+ double ataDrySampleR;
+ double lastSampleR;
+ double heldSampleAR;
+ double heldSampleBR;
+ double positionAR;
+ double positionBR;
+ double lastOutputSampleR;
+ //there is no noise shaping on this one, it uses all sorts of quantization to get its sound
+
+ float A;
+ float B;
+ float C;
+ float D;
+};
+
+#endif
diff --git a/plugins/LinuxVST/src/BitGlitter/BitGlitterProc.cpp b/plugins/LinuxVST/src/BitGlitter/BitGlitterProc.cpp
new file mode 100755
index 0000000..321d0b6
--- /dev/null
+++ b/plugins/LinuxVST/src/BitGlitter/BitGlitterProc.cpp
@@ -0,0 +1,419 @@
+/* ========================================
+ * BitGlitter - BitGlitter.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __BitGlitter_H
+#include "BitGlitter.h"
+#endif
+
+void BitGlitter::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 factor = B+1.0;
+ factor = pow(factor,7)+2.0;
+ int divvy = (int)(factor*overallscale);
+ double rateA = 1.0 / divvy;
+ double rezA = 0.0016666666666667; //looks to be a fixed bitcrush
+ double rateB = 1.61803398875 / divvy;
+ double rezB = 0.0026666666666667; //looks to be a fixed bitcrush
+ double offset;
+ double ingain = pow(10.0,((A * 36.0)-18.0)/14.0); //add adjustment factor
+ double outgain = pow(10.0,((C * 36.0)-18.0)/14.0); //add adjustment factor
+ double wet = D;
+
+ while (--sampleFrames >= 0)
+ {
+ long double inputSampleL = *in1;
+ long double inputSampleR = *in2;
+ long double drySampleL = inputSampleL;
+ long double drySampleR = inputSampleR;
+
+
+ //first, the distortion section
+ inputSampleL *= ingain;
+ inputSampleR *= ingain;
+
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ inputSampleL *= 1.2533141373155;
+ //clip to 1.2533141373155 to reach maximum output
+ inputSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((inputSampleL == 0.0) ?1:fabs(inputSampleL));
+
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ inputSampleR *= 1.2533141373155;
+ //clip to 1.2533141373155 to reach maximum output
+ inputSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((inputSampleR == 0.0) ?1:fabs(inputSampleR));
+
+ ataDrySampleL = inputSampleL;
+ ataHalfwaySampleL = (inputSampleL + ataLastSampleL ) / 2.0;
+ ataLastSampleL = inputSampleL;
+ //setting up crude oversampling
+
+ ataDrySampleR = inputSampleR;
+ ataHalfwaySampleR = (inputSampleR + ataLastSampleR ) / 2.0;
+ ataLastSampleR = inputSampleR;
+ //setting up crude oversampling
+
+ //begin raw sample L
+ positionAL += rateA;
+ long double outputSampleL = heldSampleAL;
+ if (positionAL > 1.0)
+ {
+ positionAL -= 1.0;
+ heldSampleAL = (lastSampleL * positionAL) + (inputSampleL * (1-positionAL));
+ outputSampleL = (outputSampleL * 0.5) + (heldSampleAL * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleL > 0)
+ {
+ offset = outputSampleL;
+ while (offset > 0) {offset -= rezA;}
+ outputSampleL -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleL < 0)
+ {
+ offset = outputSampleL;
+ while (offset < 0) {offset += rezA;}
+ outputSampleL -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleL *= (1.0 - rezA);
+ if (fabs(outputSampleL) < rezA) outputSampleL = 0.0;
+ inputSampleL = outputSampleL;
+ //end raw sample L
+
+ //begin raw sample R
+ positionAR += rateA;
+ long double outputSampleR = heldSampleAR;
+ if (positionAR > 1.0)
+ {
+ positionAR -= 1.0;
+ heldSampleAR = (lastSampleR * positionAR) + (inputSampleR * (1-positionAR));
+ outputSampleR = (outputSampleR * 0.5) + (heldSampleAR * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleR > 0)
+ {
+ offset = outputSampleR;
+ while (offset > 0) {offset -= rezA;}
+ outputSampleR -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleR < 0)
+ {
+ offset = outputSampleR;
+ while (offset < 0) {offset += rezA;}
+ outputSampleR -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleR *= (1.0 - rezA);
+ if (fabs(outputSampleR) < rezA) outputSampleR = 0.0;
+ inputSampleR = outputSampleR;
+ //end raw sample R
+
+ //begin interpolated sample L
+ positionBL += rateB;
+ outputSampleL = heldSampleBL;
+ if (positionBL > 1.0)
+ {
+ positionBL -= 1.0;
+ heldSampleBL = (lastSampleL * positionBL) + (ataHalfwaySampleL * (1-positionBL));
+ outputSampleL = (outputSampleL * 0.5) + (heldSampleBL * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleL > 0)
+ {
+ offset = outputSampleL;
+ while (offset > 0) {offset -= rezB;}
+ outputSampleL -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleL < 0)
+ {
+ offset = outputSampleL;
+ while (offset < 0) {offset += rezB;}
+ outputSampleL -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleL *= (1.0 - rezB);
+ if (fabs(outputSampleL) < rezB) outputSampleL = 0.0;
+ ataHalfwaySampleL = outputSampleL;
+ //end interpolated sample L
+
+ //begin interpolated sample R
+ positionBR += rateB;
+ outputSampleR = heldSampleBR;
+ if (positionBR > 1.0)
+ {
+ positionBR -= 1.0;
+ heldSampleBR = (lastSampleR * positionBR) + (ataHalfwaySampleR * (1-positionBR));
+ outputSampleR = (outputSampleR * 0.5) + (heldSampleBR * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleR > 0)
+ {
+ offset = outputSampleR;
+ while (offset > 0) {offset -= rezB;}
+ outputSampleR -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleR < 0)
+ {
+ offset = outputSampleR;
+ while (offset < 0) {offset += rezB;}
+ outputSampleR -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleR *= (1.0 - rezB);
+ if (fabs(outputSampleR) < rezB) outputSampleR = 0.0;
+ ataHalfwaySampleR = outputSampleR;
+ //end interpolated sample R
+
+ inputSampleL += ataHalfwaySampleL;
+ inputSampleL /= 2.0;
+ //plain old blend the two
+
+ inputSampleR += ataHalfwaySampleR;
+ inputSampleR /= 2.0;
+ //plain old blend the two
+
+ outputSampleL = (inputSampleL * (1.0-(wet/2))) + (lastOutputSampleL*(wet/2));
+ //darken to extent of wet in wet/dry, maximum 50%
+ lastOutputSampleL = inputSampleL;
+ outputSampleL *= outgain;
+
+ outputSampleR = (inputSampleR * (1.0-(wet/2))) + (lastOutputSampleR*(wet/2));
+ //darken to extent of wet in wet/dry, maximum 50%
+ lastOutputSampleR = inputSampleR;
+ outputSampleR *= outgain;
+
+ if (wet < 1.0) {
+ outputSampleL = (drySampleL * (1.0-wet)) + (outputSampleL * wet);
+ outputSampleR = (drySampleR * (1.0-wet)) + (outputSampleR * wet);
+ }
+
+ *out1 = outputSampleL;
+ *out2 = outputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void BitGlitter::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 factor = B+1.0;
+ factor = pow(factor,7)+2.0;
+ int divvy = (int)(factor*overallscale);
+ double rateA = 1.0 / divvy;
+ double rezA = 0.0016666666666667; //looks to be a fixed bitcrush
+ double rateB = 1.61803398875 / divvy;
+ double rezB = 0.0026666666666667; //looks to be a fixed bitcrush
+ double offset;
+ double ingain = pow(10.0,((A * 36.0)-18.0)/14.0); //add adjustment factor
+ double outgain = pow(10.0,((C * 36.0)-18.0)/14.0); //add adjustment factor
+ double wet = D;
+
+ while (--sampleFrames >= 0)
+ {
+ long double inputSampleL = *in1;
+ long double inputSampleR = *in2;
+ long double drySampleL = inputSampleL;
+ long double drySampleR = inputSampleR;
+
+ //first, the distortion section
+ inputSampleL *= ingain;
+ inputSampleR *= ingain;
+
+ if (inputSampleL > 1.0) inputSampleL = 1.0;
+ if (inputSampleL < -1.0) inputSampleL = -1.0;
+ inputSampleL *= 1.2533141373155;
+ //clip to 1.2533141373155 to reach maximum output
+ inputSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((inputSampleL == 0.0) ?1:fabs(inputSampleL));
+
+ if (inputSampleR > 1.0) inputSampleR = 1.0;
+ if (inputSampleR < -1.0) inputSampleR = -1.0;
+ inputSampleR *= 1.2533141373155;
+ //clip to 1.2533141373155 to reach maximum output
+ inputSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((inputSampleR == 0.0) ?1:fabs(inputSampleR));
+
+ ataDrySampleL = inputSampleL;
+ ataHalfwaySampleL = (inputSampleL + ataLastSampleL ) / 2.0;
+ ataLastSampleL = inputSampleL;
+ //setting up crude oversampling
+
+ ataDrySampleR = inputSampleR;
+ ataHalfwaySampleR = (inputSampleR + ataLastSampleR ) / 2.0;
+ ataLastSampleR = inputSampleR;
+ //setting up crude oversampling
+
+ //begin raw sample L
+ positionAL += rateA;
+ long double outputSampleL = heldSampleAL;
+ if (positionAL > 1.0)
+ {
+ positionAL -= 1.0;
+ heldSampleAL = (lastSampleL * positionAL) + (inputSampleL * (1-positionAL));
+ outputSampleL = (outputSampleL * 0.5) + (heldSampleAL * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleL > 0)
+ {
+ offset = outputSampleL;
+ while (offset > 0) {offset -= rezA;}
+ outputSampleL -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleL < 0)
+ {
+ offset = outputSampleL;
+ while (offset < 0) {offset += rezA;}
+ outputSampleL -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleL *= (1.0 - rezA);
+ if (fabs(outputSampleL) < rezA) outputSampleL = 0.0;
+ inputSampleL = outputSampleL;
+ //end raw sample L
+
+ //begin raw sample R
+ positionAR += rateA;
+ long double outputSampleR = heldSampleAR;
+ if (positionAR > 1.0)
+ {
+ positionAR -= 1.0;
+ heldSampleAR = (lastSampleR * positionAR) + (inputSampleR * (1-positionAR));
+ outputSampleR = (outputSampleR * 0.5) + (heldSampleAR * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleR > 0)
+ {
+ offset = outputSampleR;
+ while (offset > 0) {offset -= rezA;}
+ outputSampleR -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleR < 0)
+ {
+ offset = outputSampleR;
+ while (offset < 0) {offset += rezA;}
+ outputSampleR -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleR *= (1.0 - rezA);
+ if (fabs(outputSampleR) < rezA) outputSampleR = 0.0;
+ inputSampleR = outputSampleR;
+ //end raw sample R
+
+ //begin interpolated sample L
+ positionBL += rateB;
+ outputSampleL = heldSampleBL;
+ if (positionBL > 1.0)
+ {
+ positionBL -= 1.0;
+ heldSampleBL = (lastSampleL * positionBL) + (ataHalfwaySampleL * (1-positionBL));
+ outputSampleL = (outputSampleL * 0.5) + (heldSampleBL * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleL > 0)
+ {
+ offset = outputSampleL;
+ while (offset > 0) {offset -= rezB;}
+ outputSampleL -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleL < 0)
+ {
+ offset = outputSampleL;
+ while (offset < 0) {offset += rezB;}
+ outputSampleL -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleL *= (1.0 - rezB);
+ if (fabs(outputSampleL) < rezB) outputSampleL = 0.0;
+ ataHalfwaySampleL = outputSampleL;
+ //end interpolated sample L
+
+ //begin interpolated sample R
+ positionBR += rateB;
+ outputSampleR = heldSampleBR;
+ if (positionBR > 1.0)
+ {
+ positionBR -= 1.0;
+ heldSampleBR = (lastSampleR * positionBR) + (ataHalfwaySampleR * (1-positionBR));
+ outputSampleR = (outputSampleR * 0.5) + (heldSampleBR * 0.5);
+ //softens the edge of the derez
+ }
+ if (outputSampleR > 0)
+ {
+ offset = outputSampleR;
+ while (offset > 0) {offset -= rezB;}
+ outputSampleR -= offset;
+ //it's below 0 so subtracting adds the remainder
+ }
+ if (outputSampleR < 0)
+ {
+ offset = outputSampleR;
+ while (offset < 0) {offset += rezB;}
+ outputSampleR -= offset;
+ //it's above 0 so subtracting subtracts the remainder
+ }
+ outputSampleR *= (1.0 - rezB);
+ if (fabs(outputSampleR) < rezB) outputSampleR = 0.0;
+ ataHalfwaySampleR = outputSampleR;
+ //end interpolated sample R
+
+ inputSampleL += ataHalfwaySampleL;
+ inputSampleL /= 2.0;
+ //plain old blend the two
+
+ inputSampleR += ataHalfwaySampleR;
+ inputSampleR /= 2.0;
+ //plain old blend the two
+
+ outputSampleL = (inputSampleL * (1.0-(wet/2))) + (lastOutputSampleL*(wet/2));
+ //darken to extent of wet in wet/dry, maximum 50%
+ lastOutputSampleL = inputSampleL;
+ outputSampleL *= outgain;
+
+ outputSampleR = (inputSampleR * (1.0-(wet/2))) + (lastOutputSampleR*(wet/2));
+ //darken to extent of wet in wet/dry, maximum 50%
+ lastOutputSampleR = inputSampleR;
+ outputSampleR *= outgain;
+
+ if (wet < 1.0) {
+ outputSampleL = (drySampleL * (1.0-wet)) + (outputSampleL * wet);
+ outputSampleR = (drySampleR * (1.0-wet)) + (outputSampleR * wet);
+ }
+
+ *out1 = outputSampleL;
+ *out2 = outputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
diff --git a/plugins/LinuxVST/src/DeRez/DeRez.cpp b/plugins/LinuxVST/src/DeRez/DeRez.cpp
index 3bf36eb..404127a 100755
--- a/plugins/LinuxVST/src/DeRez/DeRez.cpp
+++ b/plugins/LinuxVST/src/DeRez/DeRez.cpp
@@ -99,8 +99,8 @@ float DeRez::getParameter(VstInt32 index) {
void DeRez::getParameterName(VstInt32 index, char *text) {
switch (index) {
- case kParamA: vst_strncpy (text, "Freq", kVstMaxParamStrLen); break;
- case kParamB: vst_strncpy (text, "Reso", kVstMaxParamStrLen); break;
+ case kParamA: vst_strncpy (text, "Rate", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, "Rez", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
diff --git a/plugins/LinuxVST/src/DeRez/DeRezProc.cpp b/plugins/LinuxVST/src/DeRez/DeRezProc.cpp
index 0fed9b4..247a364 100755
--- a/plugins/LinuxVST/src/DeRez/DeRezProc.cpp
+++ b/plugins/LinuxVST/src/DeRez/DeRezProc.cpp
@@ -30,7 +30,7 @@ void DeRez::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
{
long double inputSampleL = *in1;
long double inputSampleR = *in2;
- if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38 && (targetB == 0)) {
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,
@@ -49,7 +49,7 @@ void DeRez::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
applyresidue *= 0.00000001;
inputSampleL = applyresidue;
}
- if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38 && (targetB == 0)) {
static int noisesource = 0;
noisesource = noisesource % 1700021; noisesource++;
int residue = noisesource * noisesource;
@@ -186,7 +186,7 @@ void DeRez::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
{
long double inputSampleL = *in1;
long double inputSampleR = *in2;
- if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
+ if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38 && (targetB == 0)) {
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,
@@ -205,7 +205,7 @@ void DeRez::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
applyresidue *= 0.00000001;
inputSampleL = applyresidue;
}
- if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
+ if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38 && (targetB == 0)) {
static int noisesource = 0;
noisesource = noisesource % 1700021; noisesource++;
int residue = noisesource * noisesource;