aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/SlewOnly/source
diff options
context:
space:
mode:
authorairwindows <jinx6568@sover.net>2018-04-07 14:59:26 -0400
committerairwindows <jinx6568@sover.net>2018-04-07 14:59:26 -0400
commit31a2f1a4e8f1c4aa7d4b7c36dd32ec5d0298b91b (patch)
tree03ac402bf0c7e988cfc4c10b7b86ad6d846170fb /plugins/MacVST/SlewOnly/source
parent14e001ba28240d6a88045aea801ee8e38c6a235c (diff)
downloadairwindows-lv2-port-31a2f1a4e8f1c4aa7d4b7c36dd32ec5d0298b91b.tar.gz
airwindows-lv2-port-31a2f1a4e8f1c4aa7d4b7c36dd32ec5d0298b91b.tar.bz2
airwindows-lv2-port-31a2f1a4e8f1c4aa7d4b7c36dd32ec5d0298b91b.zip
Slew Variations
Diffstat (limited to 'plugins/MacVST/SlewOnly/source')
-rwxr-xr-xplugins/MacVST/SlewOnly/source/SlewOnly.cpp67
-rwxr-xr-xplugins/MacVST/SlewOnly/source/SlewOnly.h56
-rwxr-xr-xplugins/MacVST/SlewOnly/source/SlewOnlyProc.cpp159
3 files changed, 282 insertions, 0 deletions
diff --git a/plugins/MacVST/SlewOnly/source/SlewOnly.cpp b/plugins/MacVST/SlewOnly/source/SlewOnly.cpp
new file mode 100755
index 0000000..0d9350b
--- /dev/null
+++ b/plugins/MacVST/SlewOnly/source/SlewOnly.cpp
@@ -0,0 +1,67 @@
+/* ========================================
+ * SlewOnly - SlewOnly.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __SlewOnly_H
+#include "SlewOnly.h"
+#endif
+
+AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new SlewOnly(audioMaster);}
+
+SlewOnly::SlewOnly(audioMasterCallback audioMaster) :
+ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
+{
+ lastSampleL = 0.0;
+ lastSampleR = 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
+}
+
+SlewOnly::~SlewOnly() {}
+VstInt32 SlewOnly::getVendorVersion () {return 1000;}
+void SlewOnly::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
+void SlewOnly::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 SlewOnly::setParameter(VstInt32 index, float value) {
+}
+
+float SlewOnly::getParameter(VstInt32 index) {
+ return 0.0; //we only need to update the relevant name, this is simple to manage
+}
+
+void SlewOnly::getParameterName(VstInt32 index, char *text) {
+}
+
+void SlewOnly::getParameterDisplay(VstInt32 index, char *text) {
+}
+
+void SlewOnly::getParameterLabel(VstInt32 index, char *text) {
+}
+
+VstInt32 SlewOnly::canDo(char *text)
+{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
+
+bool SlewOnly::getEffectName(char* name) {
+ vst_strncpy(name, "SlewOnly", kVstMaxProductStrLen); return true;
+}
+
+VstPlugCategory SlewOnly::getPlugCategory() {return kPlugCategEffect;}
+
+bool SlewOnly::getProductString(char* text) {
+ vst_strncpy (text, "airwindows SlewOnly", kVstMaxProductStrLen); return true;
+}
+
+bool SlewOnly::getVendorString(char* text) {
+ vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
+}
diff --git a/plugins/MacVST/SlewOnly/source/SlewOnly.h b/plugins/MacVST/SlewOnly/source/SlewOnly.h
new file mode 100755
index 0000000..0c2d666
--- /dev/null
+++ b/plugins/MacVST/SlewOnly/source/SlewOnly.h
@@ -0,0 +1,56 @@
+/* ========================================
+ * SlewOnly - SlewOnly.h
+ * Created 8/12/11 by SPIAdmin
+ * Copyright (c) 2011 __MyCompanyName__, All rights reserved
+ * ======================================== */
+
+#ifndef __SlewOnly_H
+#define __SlewOnly_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 = 'slon'; //Change this to what the AU identity is!
+
+class SlewOnly :
+ public AudioEffectX
+{
+public:
+ SlewOnly(audioMasterCallback audioMaster);
+ ~SlewOnly();
+ 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 lastSampleL;
+ double lastSampleR;
+};
+
+#endif
diff --git a/plugins/MacVST/SlewOnly/source/SlewOnlyProc.cpp b/plugins/MacVST/SlewOnly/source/SlewOnlyProc.cpp
new file mode 100755
index 0000000..5fc12c3
--- /dev/null
+++ b/plugins/MacVST/SlewOnly/source/SlewOnlyProc.cpp
@@ -0,0 +1,159 @@
+/* ========================================
+ * SlewOnly - SlewOnly.h
+ * Copyright (c) 2016 airwindows, All rights reserved
+ * ======================================== */
+
+#ifndef __SlewOnly_H
+#include "SlewOnly.h"
+#endif
+
+void SlewOnly::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;
+ long double outputSampleL;
+ long double outputSampleR;
+ double trim = 2.302585092994045684017991; //natural logarithm of 10
+
+ 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.
+ }
+
+ 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;
+
+ *out1 = outputSampleL;
+ *out2 = outputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+}
+
+void SlewOnly::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;
+ long double outputSampleL;
+ long double outputSampleR;
+ double trim = 2.302585092994045684017991; //natural logarithm of 10
+
+ 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.
+ }
+
+
+ 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;
+
+ *out1 = outputSampleL;
+ *out2 = outputSampleR;
+
+ *in1++;
+ *in2++;
+ *out1++;
+ *out2++;
+ }
+} \ No newline at end of file