From 4ffdaa2da3b79898540ce4dab4adf1de3142ef67 Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 30 Sep 2021 11:37:02 -0400 Subject: [PATCH] Remove the AirWindows Tube effect (#5178) The discontinuous response to the input in the algorithm means modulating makes clicks in a way which isn't resolvable Closes #5126 --- libs/airwindows/CMakeLists.txt | 356 +++++++++--------- .../src/AirWinBaseClass_pluginRegistry.cpp | 4 +- libs/airwindows/src/Tube.cpp | 177 --------- libs/airwindows/src/Tube.h | 73 ---- libs/airwindows/src/TubeProc.cpp | 225 ----------- .../Airwindows/Saturation And More/Tube.srgfx | 3 - 6 files changed, 179 insertions(+), 659 deletions(-) delete mode 100644 libs/airwindows/src/Tube.cpp delete mode 100644 libs/airwindows/src/Tube.h delete mode 100644 libs/airwindows/src/TubeProc.cpp delete mode 100644 resources/data/fx_presets/Airwindows/Saturation And More/Tube.srgfx diff --git a/libs/airwindows/CMakeLists.txt b/libs/airwindows/CMakeLists.txt index c78cd7b8db5..137b3e7bdd9 100644 --- a/libs/airwindows/CMakeLists.txt +++ b/libs/airwindows/CMakeLists.txt @@ -1,185 +1,183 @@ project(airwindows VERSION 0.0.0 LANGUAGES CXX) add_library(${PROJECT_NAME} - src/ADClip7.cpp - src/ADClip7.h - src/ADClip7Proc.cpp - src/Air.cpp - src/Air.h - src/AirProc.cpp - src/Apicolypse.cpp - src/Apicolypse.h - src/ApicolypseProc.cpp - src/BassDrive.cpp - src/BassDrive.h - src/BassDriveProc.cpp - src/BitGlitter.cpp - src/BitGlitter.h - src/BitGlitterProc.cpp - src/BlockParty.cpp - src/BlockParty.h - src/BlockPartyProc.cpp - src/BrightAmbience2.cpp - src/BrightAmbience2.h - src/BrightAmbience2Proc.cpp - src/BussColors4.cpp - src/BussColors4.h - src/BussColors4Proc.cpp - src/ButterComp2.cpp - src/ButterComp2.h - src/ButterComp2Proc.cpp - src/Capacitor.cpp - src/Capacitor.h - src/CapacitorProc.cpp - src/Chamber.cpp - src/ChamberProc.cpp - src/Cojones.cpp - src/Cojones.h - src/CojonesProc.cpp - src/Compresaturator.cpp - src/Compresaturator.h - src/CompresaturatorProc.cpp - src/CrunchyGrooveWear.cpp - src/CrunchyGrooveWear.h - src/CrunchyGrooveWearProc.cpp - src/DeBess.cpp - src/DeBess.h - src/DeBessProc.cpp - src/DeEss.cpp - src/DeEss.h - src/DeEssProc.cpp - src/DeRez2.cpp - src/DeRez2.h - src/DeRez2Proc.cpp - src/DeckWrecka.cpp - src/DeckWrecka.h - src/DeckWreckaProc.cpp - src/Density.cpp - src/Density.h - src/DensityProc.cpp - src/Drive.cpp - src/Drive.h - src/DriveProc.cpp - src/DrumSlam.cpp - src/DrumSlam.h - src/DrumSlamProc.cpp - src/DustBunny.cpp - src/DustBunny.h - src/DustBunnyProc.cpp - src/Focus.cpp - src/Focus.h - src/FocusProc.cpp - src/Fracture.cpp - src/Fracture.h - src/FractureProc.cpp - src/Galactic.cpp - src/Galactic.h - src/GalacticProc.cpp - src/GrooveWear.cpp - src/GrooveWear.h - src/GrooveWearProc.cpp - src/HardVacuum.cpp - src/HardVacuum.h - src/HardVacuumProc.cpp - src/Hombre.cpp - src/Hombre.h - src/HombreProc.cpp - src/Infinity.cpp - src/Infinity.h - src/InfinityProc.cpp - src/IronOxide5.cpp - src/IronOxide5.h - src/IronOxide5Proc.cpp - src/Logical4.cpp - src/Logical4.h - src/Logical4Proc.cpp - src/Loud.cpp - src/Loud.h - src/LoudProc.cpp - src/Mackity.cpp - src/Mackity.h - src/MackityProc.cpp - src/MackEQ.cpp - src/MackEQ.h - src/MackEQProc.cpp - src/MatrixVerb.cpp - src/MatrixVerb.h - src/MatrixVerbProc.cpp - src/Melt.cpp - src/Melt.h - src/MeltProc.cpp - src/Mojo.cpp - src/Mojo.h - src/MojoProc.cpp - src/NCSeventeen.cpp - src/NCSeventeen.h - src/NCSeventeenProc.cpp - src/Noise.cpp - src/Noise.h - src/NoiseProc.cpp - src/OneCornerClip.cpp - src/OneCornerClip.h - src/OneCornerClipProc.cpp - src/PocketVerbs.cpp - src/PocketVerbs.h - src/PocketVerbsProc.cpp - src/Point.cpp - src/Point.h - src/PointProc.cpp - src/Pop.cpp - src/Pop.h - src/PopProc.cpp - src/Pressure4.cpp - src/Pressure4.h - src/Pressure4Proc.cpp - src/PyeWacket.cpp - src/PyeWacket.h - src/PyeWacketProc.cpp - src/SingleEndedTriode.cpp - src/SingleEndedTriode.h - src/SingleEndedTriodeProc.cpp - src/Slew.cpp - src/Slew.h - src/Slew2.cpp - src/Slew2.h - src/Slew2Proc.cpp - src/SlewProc.cpp - src/Spiral2.cpp - src/Spiral2.h - src/Spiral2Proc.cpp - src/StarChild.cpp - src/StarChild.h - src/StarChildProc.cpp - src/Surge.cpp - src/Surge.h - src/SurgeProc.cpp - src/ToTape6.cpp - src/ToTape6.h - src/ToTape6Proc.cpp - src/TripleSpread.cpp - src/TripleSpread.h - src/TripleSpreadProc.cpp - src/Tube.cpp - src/TubeProc.cpp - src/UnBox.cpp - src/UnBox.h - src/UnBoxProc.cpp - src/Verbity.cpp - src/Verbity.h - src/VerbityProc.cpp - src/VariMu.cpp - src/VariMu.h - src/VariMuProc.cpp - src/VoiceOfTheStarship.cpp - src/VoiceOfTheStarship.h - src/VoiceOfTheStarshipProc.cpp - src/AirWinBaseClass_pluginRegistry.cpp - include/${PROJECT_NAME}/AirWinBaseClass.h - ) + src/ADClip7.cpp + src/ADClip7.h + src/ADClip7Proc.cpp + src/Air.cpp + src/Air.h + src/AirProc.cpp + src/Apicolypse.cpp + src/Apicolypse.h + src/ApicolypseProc.cpp + src/BassDrive.cpp + src/BassDrive.h + src/BassDriveProc.cpp + src/BitGlitter.cpp + src/BitGlitter.h + src/BitGlitterProc.cpp + src/BlockParty.cpp + src/BlockParty.h + src/BlockPartyProc.cpp + src/BrightAmbience2.cpp + src/BrightAmbience2.h + src/BrightAmbience2Proc.cpp + src/BussColors4.cpp + src/BussColors4.h + src/BussColors4Proc.cpp + src/ButterComp2.cpp + src/ButterComp2.h + src/ButterComp2Proc.cpp + src/Capacitor.cpp + src/Capacitor.h + src/CapacitorProc.cpp + src/Chamber.cpp + src/ChamberProc.cpp + src/Cojones.cpp + src/Cojones.h + src/CojonesProc.cpp + src/Compresaturator.cpp + src/Compresaturator.h + src/CompresaturatorProc.cpp + src/CrunchyGrooveWear.cpp + src/CrunchyGrooveWear.h + src/CrunchyGrooveWearProc.cpp + src/DeBess.cpp + src/DeBess.h + src/DeBessProc.cpp + src/DeEss.cpp + src/DeEss.h + src/DeEssProc.cpp + src/DeRez2.cpp + src/DeRez2.h + src/DeRez2Proc.cpp + src/DeckWrecka.cpp + src/DeckWrecka.h + src/DeckWreckaProc.cpp + src/Density.cpp + src/Density.h + src/DensityProc.cpp + src/Drive.cpp + src/Drive.h + src/DriveProc.cpp + src/DrumSlam.cpp + src/DrumSlam.h + src/DrumSlamProc.cpp + src/DustBunny.cpp + src/DustBunny.h + src/DustBunnyProc.cpp + src/Focus.cpp + src/Focus.h + src/FocusProc.cpp + src/Fracture.cpp + src/Fracture.h + src/FractureProc.cpp + src/Galactic.cpp + src/Galactic.h + src/GalacticProc.cpp + src/GrooveWear.cpp + src/GrooveWear.h + src/GrooveWearProc.cpp + src/HardVacuum.cpp + src/HardVacuum.h + src/HardVacuumProc.cpp + src/Hombre.cpp + src/Hombre.h + src/HombreProc.cpp + src/Infinity.cpp + src/Infinity.h + src/InfinityProc.cpp + src/IronOxide5.cpp + src/IronOxide5.h + src/IronOxide5Proc.cpp + src/Logical4.cpp + src/Logical4.h + src/Logical4Proc.cpp + src/Loud.cpp + src/Loud.h + src/LoudProc.cpp + src/Mackity.cpp + src/Mackity.h + src/MackityProc.cpp + src/MackEQ.cpp + src/MackEQ.h + src/MackEQProc.cpp + src/MatrixVerb.cpp + src/MatrixVerb.h + src/MatrixVerbProc.cpp + src/Melt.cpp + src/Melt.h + src/MeltProc.cpp + src/Mojo.cpp + src/Mojo.h + src/MojoProc.cpp + src/NCSeventeen.cpp + src/NCSeventeen.h + src/NCSeventeenProc.cpp + src/Noise.cpp + src/Noise.h + src/NoiseProc.cpp + src/OneCornerClip.cpp + src/OneCornerClip.h + src/OneCornerClipProc.cpp + src/PocketVerbs.cpp + src/PocketVerbs.h + src/PocketVerbsProc.cpp + src/Point.cpp + src/Point.h + src/PointProc.cpp + src/Pop.cpp + src/Pop.h + src/PopProc.cpp + src/Pressure4.cpp + src/Pressure4.h + src/Pressure4Proc.cpp + src/PyeWacket.cpp + src/PyeWacket.h + src/PyeWacketProc.cpp + src/SingleEndedTriode.cpp + src/SingleEndedTriode.h + src/SingleEndedTriodeProc.cpp + src/Slew.cpp + src/Slew.h + src/Slew2.cpp + src/Slew2.h + src/Slew2Proc.cpp + src/SlewProc.cpp + src/Spiral2.cpp + src/Spiral2.h + src/Spiral2Proc.cpp + src/StarChild.cpp + src/StarChild.h + src/StarChildProc.cpp + src/Surge.cpp + src/Surge.h + src/SurgeProc.cpp + src/ToTape6.cpp + src/ToTape6.h + src/ToTape6Proc.cpp + src/TripleSpread.cpp + src/TripleSpread.h + src/TripleSpreadProc.cpp + src/UnBox.cpp + src/UnBox.h + src/UnBoxProc.cpp + src/Verbity.cpp + src/Verbity.h + src/VerbityProc.cpp + src/VariMu.cpp + src/VariMu.h + src/VariMuProc.cpp + src/VoiceOfTheStarship.cpp + src/VoiceOfTheStarship.h + src/VoiceOfTheStarshipProc.cpp + src/AirWinBaseClass_pluginRegistry.cpp + include/${PROJECT_NAME}/AirWinBaseClass.h + ) target_compile_definitions(${PROJECT_NAME} PRIVATE - AudioEffectX=AirWinBaseClass - VstPlugCategory=long - $<$:_USE_MATH_DEFINES> - ) + AudioEffectX=AirWinBaseClass + VstPlugCategory=long + $<$:_USE_MATH_DEFINES> + ) target_include_directories(${PROJECT_NAME} PUBLIC include) add_library(surge::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) diff --git a/libs/airwindows/src/AirWinBaseClass_pluginRegistry.cpp b/libs/airwindows/src/AirWinBaseClass_pluginRegistry.cpp index 55f3cddbd20..784741f2921 100644 --- a/libs/airwindows/src/AirWinBaseClass_pluginRegistry.cpp +++ b/libs/airwindows/src/AirWinBaseClass_pluginRegistry.cpp @@ -51,7 +51,6 @@ #include "Surge.h" #include "TripleSpread.h" #include "ToTape6.h" -#include "Tube.h" #include "UnBox.h" #include "Verbity.h" #include "VariMu.h" @@ -182,7 +181,8 @@ std::vector AirWinBaseClass::pluginRegistry() reg.emplace_back(create, id++, 355, gnSaturation, "Mackity"); reg.emplace_back(create, id++, 430, gnFilter, "MackEQ"); - reg.emplace_back(create, id++, 395, gnSaturation, "Tube" ); + reg.emplace_back(create, id++, -1, gnSaturation, "NoOp (Was: Tube)"); + return reg; } diff --git a/libs/airwindows/src/Tube.cpp b/libs/airwindows/src/Tube.cpp deleted file mode 100644 index df6e32bc4cd..00000000000 --- a/libs/airwindows/src/Tube.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* ======================================== - * Tube - Tube.h - * Copyright (c) 2016 airwindows, All rights reserved - * ======================================== */ - -#ifndef __Tube_H -#include "Tube.h" -#endif - -namespace Tube -{ - -// AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new -// Tube(audioMaster);} - -Tube::Tube(audioMasterCallback audioMaster) - : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) -{ - A = 0.0; - previousSampleA = 0.0; - previousSampleB = 0.0; - previousSampleC = 0.0; - previousSampleD = 0.0; - fpdL = 1.0; - while (fpdL < 16386) - fpdL = rand() * UINT32_MAX; - fpdR = 1.0; - while (fpdR < 16386) - fpdR = rand() * UINT32_MAX; - // 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 -} - -Tube::~Tube() {} -VstInt32 Tube::getVendorVersion() { return 1000; } -void Tube::setProgramName(char *name) { vst_strncpy(_programName, name, kVstMaxProgNameLen); } -void Tube::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 Tube::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 Tube::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 Tube::setParameter(VstInt32 index, float value) -{ - switch (index) - { - case kParamA: - A = value; - break; - default: - throw; // unknown parameter, shouldn't happen! - } -} - -float Tube::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 Tube::getParameterName(VstInt32 index, char *text) -{ - switch (index) - { - case kParamA: - vst_strncpy(text, "TUBE", kVstMaxParamStrLen); - break; - default: - break; // unknown parameter, shouldn't happen! - } // this is our labels for displaying in the VST host -} - -void Tube::getParameterDisplay(VstInt32 index, char *text, float extVal, bool isExternal) -{ - switch (index) - { - case kParamA: - float2string(EXTV(A) * 100, text, kVstMaxParamStrLen); - break; - default: - break; // unknown parameter, shouldn't happen! - } // this displays the values and handles 'popups' where it's discrete choices -} - -void Tube::getParameterLabel(VstInt32 index, char *text) -{ - switch (index) - { - case kParamA: - vst_strncpy(text, "%", kVstMaxParamStrLen); - break; - default: - break; // unknown parameter, shouldn't happen! - } -} - -bool Tube::parseParameterValueFromString(VstInt32 index, const char *str, float &f) -{ - auto v = std::atof(str); - f = v / 100.0; - return true; -} - -VstInt32 Tube::canDo(char *text) -{ - return (_canDo.find(text) == _canDo.end()) ? -1 : 1; -} // 1 = yes, -1 = no, 0 = don't know - -bool Tube::getEffectName(char *name) -{ - vst_strncpy(name, "Tube", kVstMaxProductStrLen); - return true; -} - -VstPlugCategory Tube::getPlugCategory() { return kPlugCategEffect; } - -bool Tube::getProductString(char *text) -{ - vst_strncpy(text, "airwindows Tube", kVstMaxProductStrLen); - return true; -} - -bool Tube::getVendorString(char *text) -{ - vst_strncpy(text, "airwindows", kVstMaxVendorStrLen); - return true; -} - -} // end namespace Tube diff --git a/libs/airwindows/src/Tube.h b/libs/airwindows/src/Tube.h deleted file mode 100644 index 34873bdb75b..00000000000 --- a/libs/airwindows/src/Tube.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ======================================== - * Tube - Tube.h - * Created 8/12/11 by SPIAdmin - * Copyright (c) 2011 __MyCompanyName__, All rights reserved - * ======================================== */ - -#ifndef __Tube_H -#define __Tube_H - -#ifndef __audioeffect__ -#include "airwindows/AirWinBaseClass.h" -#endif - -#include -#include -#include - -namespace Tube { - -enum { - kParamA = 0, - kNumParameters = 1 -}; // - -const int kNumPrograms = 0; -const int kNumInputs = 2; -const int kNumOutputs = 2; -const unsigned long kUniqueId = 'tube'; //Change this to what the AU identity is! - -class Tube : - public AudioEffectX -{ -public: - Tube(audioMasterCallback audioMaster); - ~Tube(); - 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, float extVal = 0, bool isExternal = false); // text description of the current value - virtual bool parseParameterValueFromString( VstInt32 index, const char* str, float &f ); - - virtual VstInt32 canDo(char *text); -private: - char _programName[kVstMaxProgNameLen + 1]; - std::set< std::string > _canDo; - - long double previousSampleA; - long double previousSampleB; - long double previousSampleC; - long double previousSampleD; - - uint32_t fpdL; - uint32_t fpdR; - //default stuff - - float A; -}; - -} // end namespace Tube - -#endif diff --git a/libs/airwindows/src/TubeProc.cpp b/libs/airwindows/src/TubeProc.cpp deleted file mode 100644 index f266e746360..00000000000 --- a/libs/airwindows/src/TubeProc.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* ======================================== - * Tube - Tube.h - * Copyright (c) 2016 airwindows, All rights reserved - * ======================================== */ - -#ifndef __Tube_H -#include "Tube.h" -#endif - -namespace Tube { - - -void Tube::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 gain = 1.0+(A*0.2246161992650486); - //this maxes out at +1.76dB, which is the exact difference between what a triangle/saw wave - //would be, and a sine (the fullest possible wave at the same peak amplitude). Why do this? - //Because the nature of this plugin is the 'more FAT TUUUUBE fatness!' knob, and because - //sticking to this amount maximizes that effect on a 'normal' sound that is itself unclipped - //while confining the resulting 'clipped' area to what is already 'fattened' into a flat - //and distorted region. You can always put a gain trim in front of it for more distortion, - //or cascade them in the DAW for more distortion. - double iterations = 1.0-A; - int powerfactor = (5.0*iterations)+1; - double gainscaling = 1.0/(double)(powerfactor+1); - double outputscaling = 1.0 + (1.0/(double)(powerfactor)); - - while (--sampleFrames >= 0) - { - long double inputSampleL = *in1; - long double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37; - if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37; - - if (overallscale > 1.9) { - long double stored = inputSampleL; - inputSampleL += previousSampleA; previousSampleA = stored; inputSampleL *= 0.5; - stored = inputSampleR; - inputSampleR += previousSampleB; previousSampleB = stored; inputSampleR *= 0.5; - } //for high sample rates on this plugin we are going to do a simple average - - inputSampleL *= gain; - inputSampleR *= gain; - - if (inputSampleL > 1.0) inputSampleL = 1.0; - if (inputSampleL < -1.0) inputSampleL = -1.0; - if (inputSampleR > 1.0) inputSampleR = 1.0; - if (inputSampleR < -1.0) inputSampleR = -1.0; - - double factor = inputSampleL; //Left channel - - for (int x = 0; x < powerfactor; x++) factor *= inputSampleL; - //this applies more and more of a 'curve' to the transfer function - - if (powerfactor % 2 == 1) factor = (factor/inputSampleL)*fabs(inputSampleL); - //if we would've got an asymmetrical effect this undoes the last step, and then - //redoes it using an absolute value to make the effect symmetrical again - - factor *= gainscaling; - inputSampleL -= factor; - inputSampleL *= outputscaling; - - factor = inputSampleR; //Right channel - - for (int x = 0; x < powerfactor; x++) factor *= inputSampleR; - //this applies more and more of a 'curve' to the transfer function - - if (powerfactor % 2 == 1) factor = (factor/inputSampleR)*fabs(inputSampleR); - //if we would've got an asymmetrical effect this undoes the last step, and then - //redoes it using an absolute value to make the effect symmetrical again - - factor *= gainscaling; - inputSampleR -= factor; - inputSampleR *= outputscaling; - - /* This is the simplest raw form of the 'fattest' TUBE boost between -1.0 and 1.0 - - if (inputSample > 1.0) inputSample = 1.0; if (inputSample < -1.0) inputSample = -1.0; - inputSample = (inputSample-(inputSample*fabs(inputSample)*0.5))*2.0; - - */ - - if (overallscale > 1.9) { - long double stored = inputSampleL; - inputSampleL += previousSampleC; previousSampleC = stored; inputSampleL *= 0.5; - stored = inputSampleR; - inputSampleR += previousSampleD; previousSampleD = stored; inputSampleR *= 0.5; - } //for high sample rates on this plugin we are going to do a simple average - - //begin 32 bit stereo floating point dither - int expon; frexpf((float)inputSampleL, &expon); - fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; - inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); - frexpf((float)inputSampleR, &expon); - fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; - inputSampleR += ((double(fpdR)-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 Tube::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 gain = 1.0+(A*0.2246161992650486); - //this maxes out at +1.76dB, which is the exact difference between what a triangle/saw wave - //would be, and a sine (the fullest possible wave at the same peak amplitude). Why do this? - //Because the nature of this plugin is the 'more FAT TUUUUBE fatness!' knob, and because - //sticking to this amount maximizes that effect on a 'normal' sound that is itself unclipped - //while confining the resulting 'clipped' area to what is already 'fattened' into a flat - //and distorted region. You can always put a gain trim in front of it for more distortion, - //or cascade them in the DAW for more distortion. - double iterations = 1.0-A; - int powerfactor = (5.0*iterations)+1; - double gainscaling = 1.0/(double)(powerfactor+1); - double outputscaling = 1.0 + (1.0/(double)(powerfactor)); - - while (--sampleFrames >= 0) - { - long double inputSampleL = *in1; - long double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43; - if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43; - - if (overallscale > 1.9) { - long double stored = inputSampleL; - inputSampleL += previousSampleA; previousSampleA = stored; inputSampleL *= 0.5; - stored = inputSampleR; - inputSampleR += previousSampleB; previousSampleB = stored; inputSampleR *= 0.5; - } //for high sample rates on this plugin we are going to do a simple average - - inputSampleL *= gain; - inputSampleR *= gain; - - if (inputSampleL > 1.0) inputSampleL = 1.0; - if (inputSampleL < -1.0) inputSampleL = -1.0; - if (inputSampleR > 1.0) inputSampleR = 1.0; - if (inputSampleR < -1.0) inputSampleR = -1.0; - - double factor = inputSampleL; //Left channel - - for (int x = 0; x < powerfactor; x++) factor *= inputSampleL; - //this applies more and more of a 'curve' to the transfer function - - if (powerfactor % 2 == 1) factor = (factor/inputSampleL)*fabs(inputSampleL); - //if we would've got an asymmetrical effect this undoes the last step, and then - //redoes it using an absolute value to make the effect symmetrical again - - factor *= gainscaling; - inputSampleL -= factor; - inputSampleL *= outputscaling; - - factor = inputSampleR; //Right channel - - for (int x = 0; x < powerfactor; x++) factor *= inputSampleR; - //this applies more and more of a 'curve' to the transfer function - - if (powerfactor % 2 == 1) factor = (factor/inputSampleR)*fabs(inputSampleR); - //if we would've got an asymmetrical effect this undoes the last step, and then - //redoes it using an absolute value to make the effect symmetrical again - - factor *= gainscaling; - inputSampleR -= factor; - inputSampleR *= outputscaling; - - /* This is the simplest raw form of the 'fattest' TUBE boost between -1.0 and 1.0 - - if (inputSample > 1.0) inputSample = 1.0; if (inputSample < -1.0) inputSample = -1.0; - inputSample = (inputSample-(inputSample*fabs(inputSample)*0.5))*2.0; - - */ - - if (overallscale > 1.9) { - long double stored = inputSampleL; - inputSampleL += previousSampleC; previousSampleC = stored; inputSampleL *= 0.5; - stored = inputSampleR; - inputSampleR += previousSampleD; previousSampleD = stored; inputSampleR *= 0.5; - } //for high sample rates on this plugin we are going to do a simple average - - //begin 64 bit stereo floating point dither - int expon; frexp((double)inputSampleL, &expon); - fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; - inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); - frexp((double)inputSampleR, &expon); - fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; - inputSampleR += ((double(fpdR)-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++; - } -} - - -} // end namespace Tube - diff --git a/resources/data/fx_presets/Airwindows/Saturation And More/Tube.srgfx b/resources/data/fx_presets/Airwindows/Saturation And More/Tube.srgfx deleted file mode 100644 index fa92d17efb1..00000000000 --- a/resources/data/fx_presets/Airwindows/Saturation And More/Tube.srgfx +++ /dev/null @@ -1,3 +0,0 @@ - - -