From adb00810e1b8334aada7d07786dce505219eebbb Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 14 Jul 2019 18:24:32 -0400 Subject: BassDrive --- .../BassDrive/.vs/Console4Channel64/v14/.suo | Bin 0 -> 32768 bytes plugins/WinVST/BassDrive/.vs/VSTProject/v14/.suo | Bin 0 -> 23040 bytes plugins/WinVST/BassDrive/BassDrive.cpp | 189 ++++++ plugins/WinVST/BassDrive/BassDrive.h | 105 ++++ plugins/WinVST/BassDrive/BassDriveProc.cpp | 656 +++++++++++++++++++++ plugins/WinVST/BassDrive/VSTProject.sln | 28 + plugins/WinVST/BassDrive/VSTProject.vcxproj | 183 ++++++ .../WinVST/BassDrive/VSTProject.vcxproj.filters | 48 ++ plugins/WinVST/BassDrive/VSTProject.vcxproj.user | 19 + plugins/WinVST/BassDrive/vstplug.def | 3 + 10 files changed, 1231 insertions(+) create mode 100755 plugins/WinVST/BassDrive/.vs/Console4Channel64/v14/.suo create mode 100755 plugins/WinVST/BassDrive/.vs/VSTProject/v14/.suo create mode 100755 plugins/WinVST/BassDrive/BassDrive.cpp create mode 100755 plugins/WinVST/BassDrive/BassDrive.h create mode 100755 plugins/WinVST/BassDrive/BassDriveProc.cpp create mode 100755 plugins/WinVST/BassDrive/VSTProject.sln create mode 100755 plugins/WinVST/BassDrive/VSTProject.vcxproj create mode 100755 plugins/WinVST/BassDrive/VSTProject.vcxproj.filters create mode 100755 plugins/WinVST/BassDrive/VSTProject.vcxproj.user create mode 100755 plugins/WinVST/BassDrive/vstplug.def (limited to 'plugins/WinVST/BassDrive') diff --git a/plugins/WinVST/BassDrive/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/BassDrive/.vs/Console4Channel64/v14/.suo new file mode 100755 index 0000000..777b846 Binary files /dev/null and b/plugins/WinVST/BassDrive/.vs/Console4Channel64/v14/.suo differ diff --git a/plugins/WinVST/BassDrive/.vs/VSTProject/v14/.suo b/plugins/WinVST/BassDrive/.vs/VSTProject/v14/.suo new file mode 100755 index 0000000..a54b864 Binary files /dev/null and b/plugins/WinVST/BassDrive/.vs/VSTProject/v14/.suo differ diff --git a/plugins/WinVST/BassDrive/BassDrive.cpp b/plugins/WinVST/BassDrive/BassDrive.cpp new file mode 100755 index 0000000..81f611e --- /dev/null +++ b/plugins/WinVST/BassDrive/BassDrive.cpp @@ -0,0 +1,189 @@ +/* ======================================== + * BassDrive - BassDrive.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __BassDrive_H +#include "BassDrive.h" +#endif + +AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new BassDrive(audioMaster);} + +BassDrive::BassDrive(audioMasterCallback audioMaster) : + AudioEffectX(audioMaster, kNumPrograms, kNumParameters) +{ + A = 0.5; + B = 0.5; + C = 0.5; + D = 0.5; + E = 0.5; + for (int fcount = 0; fcount < 7; fcount++) + { + presenceInAL[fcount] = 0.0; + presenceOutAL[fcount] = 0.0; + highInAL[fcount] = 0.0; + highOutAL[fcount] = 0.0; + midInAL[fcount] = 0.0; + midOutAL[fcount] = 0.0; + lowInAL[fcount] = 0.0; + lowOutAL[fcount] = 0.0; + presenceInBL[fcount] = 0.0; + presenceOutBL[fcount] = 0.0; + highInBL[fcount] = 0.0; + highOutBL[fcount] = 0.0; + midInBL[fcount] = 0.0; + midOutBL[fcount] = 0.0; + lowInBL[fcount] = 0.0; + lowOutBL[fcount] = 0.0; + + presenceInAR[fcount] = 0.0; + presenceOutAR[fcount] = 0.0; + highInAR[fcount] = 0.0; + highOutAR[fcount] = 0.0; + midInAR[fcount] = 0.0; + midOutAR[fcount] = 0.0; + lowInAR[fcount] = 0.0; + lowOutAR[fcount] = 0.0; + presenceInBR[fcount] = 0.0; + presenceOutBR[fcount] = 0.0; + highInBR[fcount] = 0.0; + highOutBR[fcount] = 0.0; + midInBR[fcount] = 0.0; + midOutBR[fcount] = 0.0; + lowInBR[fcount] = 0.0; + lowOutBR[fcount] = 0.0; + } + flip = false; + + + fpd = 17; + //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 +} + +BassDrive::~BassDrive() {} +VstInt32 BassDrive::getVendorVersion () {return 1000;} +void BassDrive::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);} +void BassDrive::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 BassDrive::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; + /* 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 BassDrive::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]); + /* 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 BassDrive::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; + case kParamE: E = value; break; + default: throw; // unknown parameter, shouldn't happen! + } +} + +float BassDrive::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; + default: break; // unknown parameter, shouldn't happen! + } return 0.0; //we only need to update the relevant name, this is simple to manage +} + +void BassDrive::getParameterName(VstInt32 index, char *text) { + switch (index) { + case kParamA: vst_strncpy (text, "Presnce", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "High", kVstMaxParamStrLen); break; + case kParamC: vst_strncpy (text, "Mid", kVstMaxParamStrLen); break; + case kParamD: vst_strncpy (text, "Low", kVstMaxParamStrLen); break; + case kParamE: vst_strncpy (text, "Drive", kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } //this is our labels for displaying in the VST host +} + +void BassDrive::getParameterDisplay(VstInt32 index, char *text) { + switch (index) { + case kParamA: float2string (A, text, kVstMaxParamStrLen); break; + case kParamB: float2string (B, text, kVstMaxParamStrLen); break; + case kParamC: float2string (C, text, kVstMaxParamStrLen); break; + case kParamD: float2string (D, text, kVstMaxParamStrLen); break; + case kParamE: float2string (E, text, kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } //this displays the values and handles 'popups' where it's discrete choices +} + +void BassDrive::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; + default: break; // unknown parameter, shouldn't happen! + } +} + +VstInt32 BassDrive::canDo(char *text) +{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know + +bool BassDrive::getEffectName(char* name) { + vst_strncpy(name, "BassDrive", kVstMaxProductStrLen); return true; +} + +VstPlugCategory BassDrive::getPlugCategory() {return kPlugCategEffect;} + +bool BassDrive::getProductString(char* text) { + vst_strncpy (text, "airwindows BassDrive", kVstMaxProductStrLen); return true; +} + +bool BassDrive::getVendorString(char* text) { + vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true; +} diff --git a/plugins/WinVST/BassDrive/BassDrive.h b/plugins/WinVST/BassDrive/BassDrive.h new file mode 100755 index 0000000..74af9f6 --- /dev/null +++ b/plugins/WinVST/BassDrive/BassDrive.h @@ -0,0 +1,105 @@ +/* ======================================== + * BassDrive - BassDrive.h + * Created 8/12/11 by SPIAdmin + * Copyright (c) 2011 __MyCompanyName__, All rights reserved + * ======================================== */ + +#ifndef __BassDrive_H +#define __BassDrive_H + +#ifndef __audioeffect__ +#include "audioeffectx.h" +#endif + +#include +#include +#include + +enum { + kParamA = 0, + kParamB = 1, + kParamC = 2, + kParamD = 3, + kParamE = 4, + kNumParameters = 5 +}; // + +const int kNumPrograms = 0; +const int kNumInputs = 2; +const int kNumOutputs = 2; +const unsigned long kUniqueId = 'bsdr'; //Change this to what the AU identity is! + +class BassDrive : + public AudioEffectX +{ +public: + BassDrive(audioMasterCallback audioMaster); + ~BassDrive(); + 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; + + uint32_t fpd; + //default stuff + double presenceInAL[7]; + double presenceOutAL[7]; + double highInAL[7]; + double highOutAL[7]; + double midInAL[7]; + double midOutAL[7]; + double lowInAL[7]; + double lowOutAL[7]; + double presenceInBL[7]; + double presenceOutBL[7]; + double highInBL[7]; + double highOutBL[7]; + double midInBL[7]; + double midOutBL[7]; + double lowInBL[7]; + double lowOutBL[7]; + + double presenceInAR[7]; + double presenceOutAR[7]; + double highInAR[7]; + double highOutAR[7]; + double midInAR[7]; + double midOutAR[7]; + double lowInAR[7]; + double lowOutAR[7]; + double presenceInBR[7]; + double presenceOutBR[7]; + double highInBR[7]; + double highOutBR[7]; + double midInBR[7]; + double midOutBR[7]; + double lowInBR[7]; + double lowOutBR[7]; + + bool flip; + + float A; + float B; + float C; + float D; + float E; //parameters. Always 0-1, and we scale/alter them elsewhere. + +}; + +#endif diff --git a/plugins/WinVST/BassDrive/BassDriveProc.cpp b/plugins/WinVST/BassDrive/BassDriveProc.cpp new file mode 100755 index 0000000..3e199ea --- /dev/null +++ b/plugins/WinVST/BassDrive/BassDriveProc.cpp @@ -0,0 +1,656 @@ +/* ======================================== + * BassDrive - BassDrive.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __BassDrive_H +#include "BassDrive.h" +#endif + +void BassDrive::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames) +{ + float* in1 = inputs[0]; + float* in2 = inputs[1]; + float* out1 = outputs[0]; + float* out2 = outputs[1]; + + double sumL; + double sumR; + double presence = pow(A,5) * 8.0; + double high = pow(B,3) * 4.0; + double mid = pow(C,2); + double low = D / 4.0; + double drive = E * 2.0; + double bridgerectifier; + + while (--sampleFrames >= 0) + { + long double inputSampleL = *in1; + long double inputSampleR = *in2; + if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; + if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; + + sumL = 0.0; + sumR = 0.0; + + + if (flip) + { + presenceInAL[0] = presenceInAL[1]; presenceInAL[1] = presenceInAL[2]; presenceInAL[2] = presenceInAL[3]; + presenceInAL[3] = presenceInAL[4]; presenceInAL[4] = presenceInAL[5]; presenceInAL[5] = presenceInAL[6]; + presenceInAL[6] = inputSampleL * presence; presenceOutAL[2] = presenceOutAL[3]; + presenceOutAL[3] = presenceOutAL[4]; presenceOutAL[4] = presenceOutAL[5]; presenceOutAL[5] = presenceOutAL[6]; + presenceOutAL[6] = (presenceInAL[0] + presenceInAL[6]) + 1.9152966321 * (presenceInAL[1] + presenceInAL[5]) + - (presenceInAL[2] + presenceInAL[4]) - 3.8305932641 * presenceInAL[3] + + ( -0.2828214615 * presenceOutAL[2]) + ( 0.2613069963 * presenceOutAL[3]) + + ( -0.8628193852 * presenceOutAL[4]) + ( 0.5387164389 * presenceOutAL[5]); + bridgerectifier = fabs(presenceOutAL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutAL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //presence section L + presenceInAR[0] = presenceInAR[1]; presenceInAR[1] = presenceInAR[2]; presenceInAR[2] = presenceInAR[3]; + presenceInAR[3] = presenceInAR[4]; presenceInAR[4] = presenceInAR[5]; presenceInAR[5] = presenceInAR[6]; + presenceInAR[6] = inputSampleR * presence; presenceOutAR[2] = presenceOutAR[3]; + presenceOutAR[3] = presenceOutAR[4]; presenceOutAR[4] = presenceOutAR[5]; presenceOutAR[5] = presenceOutAR[6]; + presenceOutAR[6] = (presenceInAR[0] + presenceInAR[6]) + 1.9152966321 * (presenceInAR[1] + presenceInAR[5]) + - (presenceInAR[2] + presenceInAR[4]) - 3.8305932641 * presenceInAR[3] + + ( -0.2828214615 * presenceOutAR[2]) + ( 0.2613069963 * presenceOutAR[3]) + + ( -0.8628193852 * presenceOutAR[4]) + ( 0.5387164389 * presenceOutAR[5]); + bridgerectifier = fabs(presenceOutAR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutAR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //presence section R + + highInAL[0] = highInAL[1]; highInAL[1] = highInAL[2]; highInAL[2] = highInAL[3]; + highInAL[3] = highInAL[4]; highInAL[4] = highInAL[5]; highInAL[5] = highInAL[6]; + bridgerectifier = fabs(inputSampleL) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {highInAL[6] = bridgerectifier;} + else {highInAL[6] = -bridgerectifier;} + highInAL[6] *= high; highOutAL[2] = highOutAL[3]; + highOutAL[3] = highOutAL[4]; highOutAL[4] = highOutAL[5]; highOutAL[5] = highOutAL[6]; + highOutAL[6] = (highInAL[0] + highInAL[6]) - 0.5141967433 * (highInAL[1] + highInAL[5]) + - (highInAL[2] + highInAL[4]) + 1.0283934866 * highInAL[3] + + ( -0.2828214615 * highOutAL[2]) + ( 1.0195930909 * highOutAL[3]) + + ( -1.9633013869 * highOutAL[4]) + ( 2.1020162751 * highOutAL[5]); + bridgerectifier = fabs(highOutAL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutAL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //high section L + highInAR[0] = highInAR[1]; highInAR[1] = highInAR[2]; highInAR[2] = highInAR[3]; + highInAR[3] = highInAR[4]; highInAR[4] = highInAR[5]; highInAR[5] = highInAR[6]; + bridgerectifier = fabs(inputSampleR) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {highInAR[6] = bridgerectifier;} + else {highInAR[6] = -bridgerectifier;} + highInAR[6] *= high; highOutAR[2] = highOutAR[3]; + highOutAR[3] = highOutAR[4]; highOutAR[4] = highOutAR[5]; highOutAR[5] = highOutAR[6]; + highOutAR[6] = (highInAR[0] + highInAR[6]) - 0.5141967433 * (highInAR[1] + highInAR[5]) + - (highInAR[2] + highInAR[4]) + 1.0283934866 * highInAR[3] + + ( -0.2828214615 * highOutAR[2]) + ( 1.0195930909 * highOutAR[3]) + + ( -1.9633013869 * highOutAR[4]) + ( 2.1020162751 * highOutAR[5]); + bridgerectifier = fabs(highOutAR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutAR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //high section R + + midInAL[0] = midInAL[1]; midInAL[1] = midInAL[2]; midInAL[2] = midInAL[3]; + midInAL[3] = midInAL[4]; midInAL[4] = midInAL[5]; midInAL[5] = midInAL[6]; + bridgerectifier = fabs(inputSampleL) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {midInAL[6] = bridgerectifier;} + else {midInAL[6] = -bridgerectifier;} + midInAL[6] *= mid; midOutAL[2] = midOutAL[3]; + midOutAL[3] = midOutAL[4]; midOutAL[4] = midOutAL[5]; midOutAL[5] = midOutAL[6]; + midOutAL[6] = (midInAL[0] + midInAL[6]) - 1.1790257790 * (midInAL[1] + midInAL[5]) + - (midInAL[2] + midInAL[4]) + 2.3580515580 * midInAL[3] + + ( -0.6292082828 * midOutAL[2]) + ( 2.7785843605 * midOutAL[3]) + + ( -4.6638295236 * midOutAL[4]) + ( 3.5142515802 * midOutAL[5]); + sumL += midOutAL[6]; + //mid section L + midInAR[0] = midInAR[1]; midInAR[1] = midInAR[2]; midInAR[2] = midInAR[3]; + midInAR[3] = midInAR[4]; midInAR[4] = midInAR[5]; midInAR[5] = midInAR[6]; + bridgerectifier = fabs(inputSampleR) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {midInAR[6] = bridgerectifier;} + else {midInAR[6] = -bridgerectifier;} + midInAR[6] *= mid; midOutAR[2] = midOutAR[3]; + midOutAR[3] = midOutAR[4]; midOutAR[4] = midOutAR[5]; midOutAR[5] = midOutAR[6]; + midOutAR[6] = (midInAR[0] + midInAR[6]) - 1.1790257790 * (midInAR[1] + midInAR[5]) + - (midInAR[2] + midInAR[4]) + 2.3580515580 * midInAR[3] + + ( -0.6292082828 * midOutAR[2]) + ( 2.7785843605 * midOutAR[3]) + + ( -4.6638295236 * midOutAR[4]) + ( 3.5142515802 * midOutAR[5]); + sumR += midOutAR[6]; + //mid section R + + lowInAL[0] = lowInAL[1]; lowInAL[1] = lowInAL[2]; lowInAL[2] = lowInAL[3]; + lowInAL[3] = lowInAL[4]; lowInAL[4] = lowInAL[5]; lowInAL[5] = lowInAL[6]; + bridgerectifier = fabs(inputSampleL) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {lowInAL[6] = bridgerectifier;} + else {lowInAL[6] = -bridgerectifier;} + lowInAL[6] *= low; lowOutAL[2] = lowOutAL[3]; + lowOutAL[3] = lowOutAL[4]; lowOutAL[4] = lowOutAL[5]; lowOutAL[5] = lowOutAL[6]; + lowOutAL[6] = (lowInAL[0] + lowInAL[6]) - 1.9193504547 * (lowInAL[1] + lowInAL[5]) + - (lowInAL[2] + lowInAL[4]) + 3.8387009093 * lowInAL[3] + + ( -0.9195964462 * lowOutAL[2]) + ( 3.7538173833 * lowOutAL[3]) + + ( -5.7487775603 * lowOutAL[4]) + ( 3.9145559258 * lowOutAL[5]); + sumL += lowOutAL[6]; + //low section L + lowInAR[0] = lowInAR[1]; lowInAR[1] = lowInAR[2]; lowInAR[2] = lowInAR[3]; + lowInAR[3] = lowInAR[4]; lowInAR[4] = lowInAR[5]; lowInAR[5] = lowInAR[6]; + bridgerectifier = fabs(inputSampleR) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {lowInAR[6] = bridgerectifier;} + else {lowInAR[6] = -bridgerectifier;} + lowInAR[6] *= low; lowOutAR[2] = lowOutAR[3]; + lowOutAR[3] = lowOutAR[4]; lowOutAR[4] = lowOutAR[5]; lowOutAR[5] = lowOutAR[6]; + lowOutAR[6] = (lowInAR[0] + lowInAR[6]) - 1.9193504547 * (lowInAR[1] + lowInAR[5]) + - (lowInAR[2] + lowInAR[4]) + 3.8387009093 * lowInAR[3] + + ( -0.9195964462 * lowOutAR[2]) + ( 3.7538173833 * lowOutAR[3]) + + ( -5.7487775603 * lowOutAR[4]) + ( 3.9145559258 * lowOutAR[5]); + sumR += lowOutAR[6]; + //low section R + } + else + { + presenceInBL[0] = presenceInBL[1]; presenceInBL[1] = presenceInBL[2]; presenceInBL[2] = presenceInBL[3]; + presenceInBL[3] = presenceInBL[4]; presenceInBL[4] = presenceInBL[5]; presenceInBL[5] = presenceInBL[6]; + presenceInBL[6] = inputSampleL * presence; presenceOutBL[2] = presenceOutBL[3]; + presenceOutBL[3] = presenceOutBL[4]; presenceOutBL[4] = presenceOutBL[5]; presenceOutBL[5] = presenceOutBL[6]; + presenceOutBL[6] = (presenceInBL[0] + presenceInBL[6]) + 1.9152966321 * (presenceInBL[1] + presenceInBL[5]) + - (presenceInBL[2] + presenceInBL[4]) - 3.8305932641 * presenceInBL[3] + + ( -0.2828214615 * presenceOutBL[2]) + ( 0.2613069963 * presenceOutBL[3]) + + ( -0.8628193852 * presenceOutBL[4]) + ( 0.5387164389 * presenceOutBL[5]); + bridgerectifier = fabs(presenceOutBL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutBL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //presence section L + presenceInBR[0] = presenceInBR[1]; presenceInBR[1] = presenceInBR[2]; presenceInBR[2] = presenceInBR[3]; + presenceInBR[3] = presenceInBR[4]; presenceInBR[4] = presenceInBR[5]; presenceInBR[5] = presenceInBR[6]; + presenceInBR[6] = inputSampleR * presence; presenceOutBR[2] = presenceOutBR[3]; + presenceOutBR[3] = presenceOutBR[4]; presenceOutBR[4] = presenceOutBR[5]; presenceOutBR[5] = presenceOutBR[6]; + presenceOutBR[6] = (presenceInBR[0] + presenceInBR[6]) + 1.9152966321 * (presenceInBR[1] + presenceInBR[5]) + - (presenceInBR[2] + presenceInBR[4]) - 3.8305932641 * presenceInBR[3] + + ( -0.2828214615 * presenceOutBR[2]) + ( 0.2613069963 * presenceOutBR[3]) + + ( -0.8628193852 * presenceOutBR[4]) + ( 0.5387164389 * presenceOutBR[5]); + bridgerectifier = fabs(presenceOutBR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutBR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //presence section R + + highInBL[0] = highInBL[1]; highInBL[1] = highInBL[2]; highInBL[2] = highInBL[3]; + highInBL[3] = highInBL[4]; highInBL[4] = highInBL[5]; highInBL[5] = highInBL[6]; + bridgerectifier = fabs(inputSampleL) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {highInBL[6] = bridgerectifier;} + else {highInBL[6] = -bridgerectifier;} + highInBL[6] *= high; highOutBL[2] = highOutBL[3]; + highOutBL[3] = highOutBL[4]; highOutBL[4] = highOutBL[5]; highOutBL[5] = highOutBL[6]; + highOutBL[6] = (highInBL[0] + highInBL[6]) - 0.5141967433 * (highInBL[1] + highInBL[5]) + - (highInBL[2] + highInBL[4]) + 1.0283934866 * highInBL[3] + + ( -0.2828214615 * highOutBL[2]) + ( 1.0195930909 * highOutBL[3]) + + ( -1.9633013869 * highOutBL[4]) + ( 2.1020162751 * highOutBL[5]); + bridgerectifier = fabs(highOutBL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutBL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //high section L + highInBR[0] = highInBR[1]; highInBR[1] = highInBR[2]; highInBR[2] = highInBR[3]; + highInBR[3] = highInBR[4]; highInBR[4] = highInBR[5]; highInBR[5] = highInBR[6]; + bridgerectifier = fabs(inputSampleR) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {highInBR[6] = bridgerectifier;} + else {highInBR[6] = -bridgerectifier;} + highInBR[6] *= high; highOutBR[2] = highOutBR[3]; + highOutBR[3] = highOutBR[4]; highOutBR[4] = highOutBR[5]; highOutBR[5] = highOutBR[6]; + highOutBR[6] = (highInBR[0] + highInBR[6]) - 0.5141967433 * (highInBR[1] + highInBR[5]) + - (highInBR[2] + highInBR[4]) + 1.0283934866 * highInBR[3] + + ( -0.2828214615 * highOutBR[2]) + ( 1.0195930909 * highOutBR[3]) + + ( -1.9633013869 * highOutBR[4]) + ( 2.1020162751 * highOutBR[5]); + bridgerectifier = fabs(highOutBR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutBR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //high section R + + midInBL[0] = midInBL[1]; midInBL[1] = midInBL[2]; midInBL[2] = midInBL[3]; + midInBL[3] = midInBL[4]; midInBL[4] = midInBL[5]; midInBL[5] = midInBL[6]; + bridgerectifier = fabs(inputSampleL) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {midInBL[6] = bridgerectifier;} + else {midInBL[6] = -bridgerectifier;} + midInBL[6] *= mid; midOutBL[2] = midOutBL[3]; + midOutBL[3] = midOutBL[4]; midOutBL[4] = midOutBL[5]; midOutBL[5] = midOutBL[6]; + midOutBL[6] = (midInBL[0] + midInBL[6]) - 1.1790257790 * (midInBL[1] + midInBL[5]) + - (midInBL[2] + midInBL[4]) + 2.3580515580 * midInBL[3] + + ( -0.6292082828 * midOutBL[2]) + ( 2.7785843605 * midOutBL[3]) + + ( -4.6638295236 * midOutBL[4]) + ( 3.5142515802 * midOutBL[5]); + sumL += midOutBL[6]; + //mid section L + midInBR[0] = midInBR[1]; midInBR[1] = midInBR[2]; midInBR[2] = midInBR[3]; + midInBR[3] = midInBR[4]; midInBR[4] = midInBR[5]; midInBR[5] = midInBR[6]; + bridgerectifier = fabs(inputSampleR) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {midInBR[6] = bridgerectifier;} + else {midInBR[6] = -bridgerectifier;} + midInBR[6] *= mid; midOutBR[2] = midOutBR[3]; + midOutBR[3] = midOutBR[4]; midOutBR[4] = midOutBR[5]; midOutBR[5] = midOutBR[6]; + midOutBR[6] = (midInBR[0] + midInBR[6]) - 1.1790257790 * (midInBR[1] + midInBR[5]) + - (midInBR[2] + midInBR[4]) + 2.3580515580 * midInBR[3] + + ( -0.6292082828 * midOutBR[2]) + ( 2.7785843605 * midOutBR[3]) + + ( -4.6638295236 * midOutBR[4]) + ( 3.5142515802 * midOutBR[5]); + sumR += midOutBR[6]; + //mid section R + + lowInBL[0] = lowInBL[1]; lowInBL[1] = lowInBL[2]; lowInBL[2] = lowInBL[3]; + lowInBL[3] = lowInBL[4]; lowInBL[4] = lowInBL[5]; lowInBL[5] = lowInBL[6]; + bridgerectifier = fabs(inputSampleL) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {lowInBL[6] = bridgerectifier;} + else {lowInBL[6] = -bridgerectifier;} + lowInBL[6] *= low; lowOutBL[2] = lowOutBL[3]; + lowOutBL[3] = lowOutBL[4]; lowOutBL[4] = lowOutBL[5]; lowOutBL[5] = lowOutBL[6]; + lowOutBL[6] = (lowInBL[0] + lowInBL[6]) - 1.9193504547 * (lowInBL[1] + lowInBL[5]) + - (lowInBL[2] + lowInBL[4]) + 3.8387009093 * lowInBL[3] + + ( -0.9195964462 * lowOutBL[2]) + ( 3.7538173833 * lowOutBL[3]) + + ( -5.7487775603 * lowOutBL[4]) + ( 3.9145559258 * lowOutBL[5]); + sumL += lowOutBL[6]; + //low section L + lowInBR[0] = lowInBR[1]; lowInBR[1] = lowInBR[2]; lowInBR[2] = lowInBR[3]; + lowInBR[3] = lowInBR[4]; lowInBR[4] = lowInBR[5]; lowInBR[5] = lowInBR[6]; + bridgerectifier = fabs(inputSampleR) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {lowInBR[6] = bridgerectifier;} + else {lowInBR[6] = -bridgerectifier;} + lowInBR[6] *= low; lowOutBR[2] = lowOutBR[3]; + lowOutBR[3] = lowOutBR[4]; lowOutBR[4] = lowOutBR[5]; lowOutBR[5] = lowOutBR[6]; + lowOutBR[6] = (lowInBR[0] + lowInBR[6]) - 1.9193504547 * (lowInBR[1] + lowInBR[5]) + - (lowInBR[2] + lowInBR[4]) + 3.8387009093 * lowInBR[3] + + ( -0.9195964462 * lowOutBR[2]) + ( 3.7538173833 * lowOutBR[3]) + + ( -5.7487775603 * lowOutBR[4]) + ( 3.9145559258 * lowOutBR[5]); + sumR += lowOutBR[6]; + //low section R + } + + inputSampleL = fabs(sumL) * drive; + if (inputSampleL > 1.57079633) {inputSampleL = 1.57079633;} + inputSampleL = sin(inputSampleL); + if (sumL < 0) inputSampleL = -inputSampleL; + //output L + inputSampleR = fabs(sumR) * drive; + if (inputSampleR > 1.57079633) {inputSampleR = 1.57079633;} + inputSampleR = sin(inputSampleR); + if (sumR < 0) inputSampleR = -inputSampleR; + //output R + + flip = !flip; + + //begin 32 bit stereo floating point dither + int expon; frexpf((float)inputSampleL, &expon); + fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; + inputSampleL += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); + frexpf((float)inputSampleR, &expon); + fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; + inputSampleR += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); + //end 32 bit stereo floating point dither + + *out1 = inputSampleL; + *out2 = inputSampleR; + + *in1++; + *in2++; + *out1++; + *out2++; + } +} + +void BassDrive::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) +{ + double* in1 = inputs[0]; + double* in2 = inputs[1]; + double* out1 = outputs[0]; + double* out2 = outputs[1]; + + double sumL; + double sumR; + double presence = pow(A,5) * 8.0; + double high = pow(B,3) * 4.0; + double mid = pow(C,2); + double low = D / 4.0; + double drive = E * 2.0; + double bridgerectifier; + + while (--sampleFrames >= 0) + { + long double inputSampleL = *in1; + long double inputSampleR = *in2; + if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; + if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; + + sumL = 0.0; + sumR = 0.0; + + + if (flip) + { + presenceInAL[0] = presenceInAL[1]; presenceInAL[1] = presenceInAL[2]; presenceInAL[2] = presenceInAL[3]; + presenceInAL[3] = presenceInAL[4]; presenceInAL[4] = presenceInAL[5]; presenceInAL[5] = presenceInAL[6]; + presenceInAL[6] = inputSampleL * presence; presenceOutAL[2] = presenceOutAL[3]; + presenceOutAL[3] = presenceOutAL[4]; presenceOutAL[4] = presenceOutAL[5]; presenceOutAL[5] = presenceOutAL[6]; + presenceOutAL[6] = (presenceInAL[0] + presenceInAL[6]) + 1.9152966321 * (presenceInAL[1] + presenceInAL[5]) + - (presenceInAL[2] + presenceInAL[4]) - 3.8305932641 * presenceInAL[3] + + ( -0.2828214615 * presenceOutAL[2]) + ( 0.2613069963 * presenceOutAL[3]) + + ( -0.8628193852 * presenceOutAL[4]) + ( 0.5387164389 * presenceOutAL[5]); + bridgerectifier = fabs(presenceOutAL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutAL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //presence section L + presenceInAR[0] = presenceInAR[1]; presenceInAR[1] = presenceInAR[2]; presenceInAR[2] = presenceInAR[3]; + presenceInAR[3] = presenceInAR[4]; presenceInAR[4] = presenceInAR[5]; presenceInAR[5] = presenceInAR[6]; + presenceInAR[6] = inputSampleR * presence; presenceOutAR[2] = presenceOutAR[3]; + presenceOutAR[3] = presenceOutAR[4]; presenceOutAR[4] = presenceOutAR[5]; presenceOutAR[5] = presenceOutAR[6]; + presenceOutAR[6] = (presenceInAR[0] + presenceInAR[6]) + 1.9152966321 * (presenceInAR[1] + presenceInAR[5]) + - (presenceInAR[2] + presenceInAR[4]) - 3.8305932641 * presenceInAR[3] + + ( -0.2828214615 * presenceOutAR[2]) + ( 0.2613069963 * presenceOutAR[3]) + + ( -0.8628193852 * presenceOutAR[4]) + ( 0.5387164389 * presenceOutAR[5]); + bridgerectifier = fabs(presenceOutAR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutAR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //presence section R + + highInAL[0] = highInAL[1]; highInAL[1] = highInAL[2]; highInAL[2] = highInAL[3]; + highInAL[3] = highInAL[4]; highInAL[4] = highInAL[5]; highInAL[5] = highInAL[6]; + bridgerectifier = fabs(inputSampleL) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {highInAL[6] = bridgerectifier;} + else {highInAL[6] = -bridgerectifier;} + highInAL[6] *= high; highOutAL[2] = highOutAL[3]; + highOutAL[3] = highOutAL[4]; highOutAL[4] = highOutAL[5]; highOutAL[5] = highOutAL[6]; + highOutAL[6] = (highInAL[0] + highInAL[6]) - 0.5141967433 * (highInAL[1] + highInAL[5]) + - (highInAL[2] + highInAL[4]) + 1.0283934866 * highInAL[3] + + ( -0.2828214615 * highOutAL[2]) + ( 1.0195930909 * highOutAL[3]) + + ( -1.9633013869 * highOutAL[4]) + ( 2.1020162751 * highOutAL[5]); + bridgerectifier = fabs(highOutAL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutAL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //high section L + highInAR[0] = highInAR[1]; highInAR[1] = highInAR[2]; highInAR[2] = highInAR[3]; + highInAR[3] = highInAR[4]; highInAR[4] = highInAR[5]; highInAR[5] = highInAR[6]; + bridgerectifier = fabs(inputSampleR) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {highInAR[6] = bridgerectifier;} + else {highInAR[6] = -bridgerectifier;} + highInAR[6] *= high; highOutAR[2] = highOutAR[3]; + highOutAR[3] = highOutAR[4]; highOutAR[4] = highOutAR[5]; highOutAR[5] = highOutAR[6]; + highOutAR[6] = (highInAR[0] + highInAR[6]) - 0.5141967433 * (highInAR[1] + highInAR[5]) + - (highInAR[2] + highInAR[4]) + 1.0283934866 * highInAR[3] + + ( -0.2828214615 * highOutAR[2]) + ( 1.0195930909 * highOutAR[3]) + + ( -1.9633013869 * highOutAR[4]) + ( 2.1020162751 * highOutAR[5]); + bridgerectifier = fabs(highOutAR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutAR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //high section R + + midInAL[0] = midInAL[1]; midInAL[1] = midInAL[2]; midInAL[2] = midInAL[3]; + midInAL[3] = midInAL[4]; midInAL[4] = midInAL[5]; midInAL[5] = midInAL[6]; + bridgerectifier = fabs(inputSampleL) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {midInAL[6] = bridgerectifier;} + else {midInAL[6] = -bridgerectifier;} + midInAL[6] *= mid; midOutAL[2] = midOutAL[3]; + midOutAL[3] = midOutAL[4]; midOutAL[4] = midOutAL[5]; midOutAL[5] = midOutAL[6]; + midOutAL[6] = (midInAL[0] + midInAL[6]) - 1.1790257790 * (midInAL[1] + midInAL[5]) + - (midInAL[2] + midInAL[4]) + 2.3580515580 * midInAL[3] + + ( -0.6292082828 * midOutAL[2]) + ( 2.7785843605 * midOutAL[3]) + + ( -4.6638295236 * midOutAL[4]) + ( 3.5142515802 * midOutAL[5]); + sumL += midOutAL[6]; + //mid section L + midInAR[0] = midInAR[1]; midInAR[1] = midInAR[2]; midInAR[2] = midInAR[3]; + midInAR[3] = midInAR[4]; midInAR[4] = midInAR[5]; midInAR[5] = midInAR[6]; + bridgerectifier = fabs(inputSampleR) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {midInAR[6] = bridgerectifier;} + else {midInAR[6] = -bridgerectifier;} + midInAR[6] *= mid; midOutAR[2] = midOutAR[3]; + midOutAR[3] = midOutAR[4]; midOutAR[4] = midOutAR[5]; midOutAR[5] = midOutAR[6]; + midOutAR[6] = (midInAR[0] + midInAR[6]) - 1.1790257790 * (midInAR[1] + midInAR[5]) + - (midInAR[2] + midInAR[4]) + 2.3580515580 * midInAR[3] + + ( -0.6292082828 * midOutAR[2]) + ( 2.7785843605 * midOutAR[3]) + + ( -4.6638295236 * midOutAR[4]) + ( 3.5142515802 * midOutAR[5]); + sumR += midOutAR[6]; + //mid section R + + lowInAL[0] = lowInAL[1]; lowInAL[1] = lowInAL[2]; lowInAL[2] = lowInAL[3]; + lowInAL[3] = lowInAL[4]; lowInAL[4] = lowInAL[5]; lowInAL[5] = lowInAL[6]; + bridgerectifier = fabs(inputSampleL) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {lowInAL[6] = bridgerectifier;} + else {lowInAL[6] = -bridgerectifier;} + lowInAL[6] *= low; lowOutAL[2] = lowOutAL[3]; + lowOutAL[3] = lowOutAL[4]; lowOutAL[4] = lowOutAL[5]; lowOutAL[5] = lowOutAL[6]; + lowOutAL[6] = (lowInAL[0] + lowInAL[6]) - 1.9193504547 * (lowInAL[1] + lowInAL[5]) + - (lowInAL[2] + lowInAL[4]) + 3.8387009093 * lowInAL[3] + + ( -0.9195964462 * lowOutAL[2]) + ( 3.7538173833 * lowOutAL[3]) + + ( -5.7487775603 * lowOutAL[4]) + ( 3.9145559258 * lowOutAL[5]); + sumL += lowOutAL[6]; + //low section L + lowInAR[0] = lowInAR[1]; lowInAR[1] = lowInAR[2]; lowInAR[2] = lowInAR[3]; + lowInAR[3] = lowInAR[4]; lowInAR[4] = lowInAR[5]; lowInAR[5] = lowInAR[6]; + bridgerectifier = fabs(inputSampleR) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {lowInAR[6] = bridgerectifier;} + else {lowInAR[6] = -bridgerectifier;} + lowInAR[6] *= low; lowOutAR[2] = lowOutAR[3]; + lowOutAR[3] = lowOutAR[4]; lowOutAR[4] = lowOutAR[5]; lowOutAR[5] = lowOutAR[6]; + lowOutAR[6] = (lowInAR[0] + lowInAR[6]) - 1.9193504547 * (lowInAR[1] + lowInAR[5]) + - (lowInAR[2] + lowInAR[4]) + 3.8387009093 * lowInAR[3] + + ( -0.9195964462 * lowOutAR[2]) + ( 3.7538173833 * lowOutAR[3]) + + ( -5.7487775603 * lowOutAR[4]) + ( 3.9145559258 * lowOutAR[5]); + sumR += lowOutAR[6]; + //low section R + } + else + { + presenceInBL[0] = presenceInBL[1]; presenceInBL[1] = presenceInBL[2]; presenceInBL[2] = presenceInBL[3]; + presenceInBL[3] = presenceInBL[4]; presenceInBL[4] = presenceInBL[5]; presenceInBL[5] = presenceInBL[6]; + presenceInBL[6] = inputSampleL * presence; presenceOutBL[2] = presenceOutBL[3]; + presenceOutBL[3] = presenceOutBL[4]; presenceOutBL[4] = presenceOutBL[5]; presenceOutBL[5] = presenceOutBL[6]; + presenceOutBL[6] = (presenceInBL[0] + presenceInBL[6]) + 1.9152966321 * (presenceInBL[1] + presenceInBL[5]) + - (presenceInBL[2] + presenceInBL[4]) - 3.8305932641 * presenceInBL[3] + + ( -0.2828214615 * presenceOutBL[2]) + ( 0.2613069963 * presenceOutBL[3]) + + ( -0.8628193852 * presenceOutBL[4]) + ( 0.5387164389 * presenceOutBL[5]); + bridgerectifier = fabs(presenceOutBL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutBL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //presence section L + presenceInBR[0] = presenceInBR[1]; presenceInBR[1] = presenceInBR[2]; presenceInBR[2] = presenceInBR[3]; + presenceInBR[3] = presenceInBR[4]; presenceInBR[4] = presenceInBR[5]; presenceInBR[5] = presenceInBR[6]; + presenceInBR[6] = inputSampleR * presence; presenceOutBR[2] = presenceOutBR[3]; + presenceOutBR[3] = presenceOutBR[4]; presenceOutBR[4] = presenceOutBR[5]; presenceOutBR[5] = presenceOutBR[6]; + presenceOutBR[6] = (presenceInBR[0] + presenceInBR[6]) + 1.9152966321 * (presenceInBR[1] + presenceInBR[5]) + - (presenceInBR[2] + presenceInBR[4]) - 3.8305932641 * presenceInBR[3] + + ( -0.2828214615 * presenceOutBR[2]) + ( 0.2613069963 * presenceOutBR[3]) + + ( -0.8628193852 * presenceOutBR[4]) + ( 0.5387164389 * presenceOutBR[5]); + bridgerectifier = fabs(presenceOutBR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (presenceOutBR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //presence section R + + highInBL[0] = highInBL[1]; highInBL[1] = highInBL[2]; highInBL[2] = highInBL[3]; + highInBL[3] = highInBL[4]; highInBL[4] = highInBL[5]; highInBL[5] = highInBL[6]; + bridgerectifier = fabs(inputSampleL) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {highInBL[6] = bridgerectifier;} + else {highInBL[6] = -bridgerectifier;} + highInBL[6] *= high; highOutBL[2] = highOutBL[3]; + highOutBL[3] = highOutBL[4]; highOutBL[4] = highOutBL[5]; highOutBL[5] = highOutBL[6]; + highOutBL[6] = (highInBL[0] + highInBL[6]) - 0.5141967433 * (highInBL[1] + highInBL[5]) + - (highInBL[2] + highInBL[4]) + 1.0283934866 * highInBL[3] + + ( -0.2828214615 * highOutBL[2]) + ( 1.0195930909 * highOutBL[3]) + + ( -1.9633013869 * highOutBL[4]) + ( 2.1020162751 * highOutBL[5]); + bridgerectifier = fabs(highOutBL[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutBL[6] > 0.0){sumL += bridgerectifier;} + else {sumL -= bridgerectifier;} + //high section L + highInBR[0] = highInBR[1]; highInBR[1] = highInBR[2]; highInBR[2] = highInBR[3]; + highInBR[3] = highInBR[4]; highInBR[4] = highInBR[5]; highInBR[5] = highInBR[6]; + bridgerectifier = fabs(inputSampleR) * high; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {highInBR[6] = bridgerectifier;} + else {highInBR[6] = -bridgerectifier;} + highInBR[6] *= high; highOutBR[2] = highOutBR[3]; + highOutBR[3] = highOutBR[4]; highOutBR[4] = highOutBR[5]; highOutBR[5] = highOutBR[6]; + highOutBR[6] = (highInBR[0] + highInBR[6]) - 0.5141967433 * (highInBR[1] + highInBR[5]) + - (highInBR[2] + highInBR[4]) + 1.0283934866 * highInBR[3] + + ( -0.2828214615 * highOutBR[2]) + ( 1.0195930909 * highOutBR[3]) + + ( -1.9633013869 * highOutBR[4]) + ( 2.1020162751 * highOutBR[5]); + bridgerectifier = fabs(highOutBR[6]); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + bridgerectifier = sin(bridgerectifier); + if (highOutBR[6] > 0.0){sumR += bridgerectifier;} + else {sumR -= bridgerectifier;} + //high section R + + midInBL[0] = midInBL[1]; midInBL[1] = midInBL[2]; midInBL[2] = midInBL[3]; + midInBL[3] = midInBL[4]; midInBL[4] = midInBL[5]; midInBL[5] = midInBL[6]; + bridgerectifier = fabs(inputSampleL) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {midInBL[6] = bridgerectifier;} + else {midInBL[6] = -bridgerectifier;} + midInBL[6] *= mid; midOutBL[2] = midOutBL[3]; + midOutBL[3] = midOutBL[4]; midOutBL[4] = midOutBL[5]; midOutBL[5] = midOutBL[6]; + midOutBL[6] = (midInBL[0] + midInBL[6]) - 1.1790257790 * (midInBL[1] + midInBL[5]) + - (midInBL[2] + midInBL[4]) + 2.3580515580 * midInBL[3] + + ( -0.6292082828 * midOutBL[2]) + ( 2.7785843605 * midOutBL[3]) + + ( -4.6638295236 * midOutBL[4]) + ( 3.5142515802 * midOutBL[5]); + sumL += midOutBL[6]; + //mid section L + midInBR[0] = midInBR[1]; midInBR[1] = midInBR[2]; midInBR[2] = midInBR[3]; + midInBR[3] = midInBR[4]; midInBR[4] = midInBR[5]; midInBR[5] = midInBR[6]; + bridgerectifier = fabs(inputSampleR) * mid; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {midInBR[6] = bridgerectifier;} + else {midInBR[6] = -bridgerectifier;} + midInBR[6] *= mid; midOutBR[2] = midOutBR[3]; + midOutBR[3] = midOutBR[4]; midOutBR[4] = midOutBR[5]; midOutBR[5] = midOutBR[6]; + midOutBR[6] = (midInBR[0] + midInBR[6]) - 1.1790257790 * (midInBR[1] + midInBR[5]) + - (midInBR[2] + midInBR[4]) + 2.3580515580 * midInBR[3] + + ( -0.6292082828 * midOutBR[2]) + ( 2.7785843605 * midOutBR[3]) + + ( -4.6638295236 * midOutBR[4]) + ( 3.5142515802 * midOutBR[5]); + sumR += midOutBR[6]; + //mid section R + + lowInBL[0] = lowInBL[1]; lowInBL[1] = lowInBL[2]; lowInBL[2] = lowInBL[3]; + lowInBL[3] = lowInBL[4]; lowInBL[4] = lowInBL[5]; lowInBL[5] = lowInBL[6]; + bridgerectifier = fabs(inputSampleL) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) {lowInBL[6] = bridgerectifier;} + else {lowInBL[6] = -bridgerectifier;} + lowInBL[6] *= low; lowOutBL[2] = lowOutBL[3]; + lowOutBL[3] = lowOutBL[4]; lowOutBL[4] = lowOutBL[5]; lowOutBL[5] = lowOutBL[6]; + lowOutBL[6] = (lowInBL[0] + lowInBL[6]) - 1.9193504547 * (lowInBL[1] + lowInBL[5]) + - (lowInBL[2] + lowInBL[4]) + 3.8387009093 * lowInBL[3] + + ( -0.9195964462 * lowOutBL[2]) + ( 3.7538173833 * lowOutBL[3]) + + ( -5.7487775603 * lowOutBL[4]) + ( 3.9145559258 * lowOutBL[5]); + sumL += lowOutBL[6]; + //low section L + lowInBR[0] = lowInBR[1]; lowInBR[1] = lowInBR[2]; lowInBR[2] = lowInBR[3]; + lowInBR[3] = lowInBR[4]; lowInBR[4] = lowInBR[5]; lowInBR[5] = lowInBR[6]; + bridgerectifier = fabs(inputSampleR) * low; + if (bridgerectifier > 1.57079633) {bridgerectifier = 1.57079633;} + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) {lowInBR[6] = bridgerectifier;} + else {lowInBR[6] = -bridgerectifier;} + lowInBR[6] *= low; lowOutBR[2] = lowOutBR[3]; + lowOutBR[3] = lowOutBR[4]; lowOutBR[4] = lowOutBR[5]; lowOutBR[5] = lowOutBR[6]; + lowOutBR[6] = (lowInBR[0] + lowInBR[6]) - 1.9193504547 * (lowInBR[1] + lowInBR[5]) + - (lowInBR[2] + lowInBR[4]) + 3.8387009093 * lowInBR[3] + + ( -0.9195964462 * lowOutBR[2]) + ( 3.7538173833 * lowOutBR[3]) + + ( -5.7487775603 * lowOutBR[4]) + ( 3.9145559258 * lowOutBR[5]); + sumR += lowOutBR[6]; + //low section R + } + + inputSampleL = fabs(sumL) * drive; + if (inputSampleL > 1.57079633) {inputSampleL = 1.57079633;} + inputSampleL = sin(inputSampleL); + if (sumL < 0) inputSampleL = -inputSampleL; + //output L + inputSampleR = fabs(sumR) * drive; + if (inputSampleR > 1.57079633) {inputSampleR = 1.57079633;} + inputSampleR = sin(inputSampleR); + if (sumR < 0) inputSampleR = -inputSampleR; + //output R + + flip = !flip; + + //begin 64 bit stereo floating point dither + int expon; frexp((double)inputSampleL, &expon); + fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; + inputSampleL += ((double(fpd)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); + frexp((double)inputSampleR, &expon); + fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; + inputSampleR += ((double(fpd)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); + //end 64 bit stereo floating point dither + + *out1 = inputSampleL; + *out2 = inputSampleR; + + *in1++; + *in2++; + *out1++; + *out2++; + } +} diff --git a/plugins/WinVST/BassDrive/VSTProject.sln b/plugins/WinVST/BassDrive/VSTProject.sln new file mode 100755 index 0000000..694b424 --- /dev/null +++ b/plugins/WinVST/BassDrive/VSTProject.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSTProject", "VSTProject.vcxproj", "{16F7AB3C-1AE0-4574-B60C-7B4DED82938C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Debug|x64.ActiveCfg = Debug|x64 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Debug|x64.Build.0 = Debug|x64 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Debug|x86.ActiveCfg = Debug|Win32 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Debug|x86.Build.0 = Debug|Win32 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Release|x64.ActiveCfg = Release|x64 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Release|x64.Build.0 = Release|x64 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Release|x86.ActiveCfg = Release|Win32 + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/plugins/WinVST/BassDrive/VSTProject.vcxproj b/plugins/WinVST/BassDrive/VSTProject.vcxproj new file mode 100755 index 0000000..6bba48c --- /dev/null +++ b/plugins/WinVST/BassDrive/VSTProject.vcxproj @@ -0,0 +1,183 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + {16F7AB3C-1AE0-4574-B60C-7B4DED82938C} + VSTProject + 8.1 + BassDrive64 + + + + DynamicLibrary + true + v140 + NotSet + + + DynamicLibrary + false + v140 + false + NotSet + + + DynamicLibrary + true + v140 + NotSet + + + DynamicLibrary + false + v140 + false + NotSet + + + + + + + + + + + + + + + + + + + + + .dll + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH) + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH) + + + + Level3 + MaxSpeed + true + C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories) + WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions) + MultiThreadedDebug + Speed + false + Default + false + None + + + vstplug.def + libcmt.dll;libcmtd.dll;msvcrt.lib;%(IgnoreSpecificDefaultLibraries) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories) + Speed + WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions) + false + MultiThreadedDebug + Default + false + None + + + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + libcmt.dll;libcmtd.dll;msvcrt.lib;%(IgnoreSpecificDefaultLibraries) + vstplug.def + + + + + Level3 + MaxSpeed + false + false + true + MultiThreaded + C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories) + None + Speed + WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions) + + + true + true + libcmt.dll;libcmtd.dll;msvcrt.lib;libc.lib;libcd.lib;libcmt.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries) + libcmt.lib;uuid.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + vstplug.def + + + + + Level3 + MaxSpeed + false + false + true + C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories) + None + Speed + WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions) + MultiThreaded + + + true + true + libcmt.dll;libcmtd.dll;msvcrt.lib;libc.lib;libcd.lib;libcmt.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries) + libcmt.lib;uuid.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + vstplug.def + + + + + + \ No newline at end of file diff --git a/plugins/WinVST/BassDrive/VSTProject.vcxproj.filters b/plugins/WinVST/BassDrive/VSTProject.vcxproj.filters new file mode 100755 index 0000000..641a1ac --- /dev/null +++ b/plugins/WinVST/BassDrive/VSTProject.vcxproj.filters @@ -0,0 +1,48 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/plugins/WinVST/BassDrive/VSTProject.vcxproj.user b/plugins/WinVST/BassDrive/VSTProject.vcxproj.user new file mode 100755 index 0000000..2216267 --- /dev/null +++ b/plugins/WinVST/BassDrive/VSTProject.vcxproj.user @@ -0,0 +1,19 @@ + + + + {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} + WindowsLocalDebugger + + + {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} + WindowsLocalDebugger + + + {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} + WindowsLocalDebugger + + + {ADEFF70D-84BF-47A1-91C3-FF6B0FC71218} + WindowsLocalDebugger + + \ No newline at end of file diff --git a/plugins/WinVST/BassDrive/vstplug.def b/plugins/WinVST/BassDrive/vstplug.def new file mode 100755 index 0000000..5bf499a --- /dev/null +++ b/plugins/WinVST/BassDrive/vstplug.def @@ -0,0 +1,3 @@ +EXPORTS + VSTPluginMain + main=VSTPluginMain \ No newline at end of file -- cgit v1.2.3