From a376041ab80ef23391b8f301ea4a286cca4d4088 Mon Sep 17 00:00:00 2001 From: Roland Rabien Date: Fri, 20 Oct 2023 18:49:05 -0700 Subject: [PATCH] Remove dithers --- CMakeLists.txt | 1 + modules/gin | 2 +- modules/juce | 2 +- plugin/Source/FX/DeRez2.cpp | 23 ++++++ plugin/Source/FX/DeRez2.h | 38 ++++----- plugin/Source/FX/DeRez2Proc.cpp | 17 ++-- plugin/Source/FX/FireAmp.cpp | 106 +++++++++++++++++++++++++ plugin/Source/FX/FireAmp.h | 38 ++++----- plugin/Source/FX/FireAmpProc.cpp | 16 ++-- plugin/Source/FX/GrindAmp.cpp | 126 ++++++++++++++++++++++++++++++ plugin/Source/FX/GrindAmp.h | 38 ++++----- plugin/Source/FX/GrindAmpProc.cpp | 16 ++-- plugin/Source/PluginEditor.cpp | 3 + plugin/Source/PluginProcessor.cpp | 8 ++ 14 files changed, 356 insertions(+), 78 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4f1ee..323b4d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -491,6 +491,7 @@ target_compile_definitions (${PLUGIN_NAME} PRIVATE JUCE_USE_MP3AUDIOFORMAT=0 JUCE_USE_LAME_AUDIO_FORMAT=0 JUCE_USE_WINDOWS_MEDIA_FORMAT=0 + JUCE_SILENCE_XCODE_15_LINKER_WARNING=1 _CRT_SECURE_NO_WARNINGS ) diff --git a/modules/gin b/modules/gin index 017dc57..40792eb 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit 017dc578135abcf00607edbf17f56288ad135e0b +Subproject commit 40792ebd575d35691dc2fb0c16ebff67846b1826 diff --git a/modules/juce b/modules/juce index a878e04..c474cb2 160000 --- a/modules/juce +++ b/modules/juce @@ -1 +1 @@ -Subproject commit a878e042e86f9462fc08459e13fcd9bf196e0c69 +Subproject commit c474cb2469272b45909c45f5d4d30df04cc342eb diff --git a/plugin/Source/FX/DeRez2.cpp b/plugin/Source/FX/DeRez2.cpp index 1240479..ba92bb2 100755 --- a/plugin/Source/FX/DeRez2.cpp +++ b/plugin/Source/FX/DeRez2.cpp @@ -52,6 +52,29 @@ void DeRez2::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMa //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 DeRez2::reset() +{ + A = 1.0; + B = 1.0; + C = 1.0; + D = 1.0; + lastSampleL = 0.0; + heldSampleL = 0.0; + lastDrySampleL = 0.0; + lastOutputSampleL = 0.0; + + lastSampleR = 0.0; + heldSampleR = 0.0; + lastDrySampleR = 0.0; + lastOutputSampleR = 0.0; + + position = 0.0; + incrementA = 0.0; + incrementB = 0.0; + fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; + fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX; +} + static float pinParameter(float data) { if (data < 0.0f) return 0.0f; diff --git a/plugin/Source/FX/DeRez2.h b/plugin/Source/FX/DeRez2.h index b8dde03..e886761 100755 --- a/plugin/Source/FX/DeRez2.h +++ b/plugin/Source/FX/DeRez2.h @@ -12,8 +12,7 @@ #include #include -class DeRez2 : - public AudioEffectX +class DeRez2 final : public AudioEffectX { public: enum { @@ -31,23 +30,24 @@ public: DeRez2(audioMasterCallback audioMaster); ~DeRez2(); - 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); + void reset(); + bool getEffectName(char* name); // The plug-in name + VstPlugCategory getPlugCategory(); // The general category for the plug-in + bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg + bool getVendorString(char* text); // Vendor info + VstInt32 getVendorVersion(); // Version number + void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); + void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); + void getProgramName(char *name); // read the name from the host + void setProgramName(char *name); // changes the name of the preset displayed in the host + VstInt32 getChunk (void** data, bool isPreset); + VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); + float getParameter(VstInt32 index); // get the parameter value at the specified index + void setParameter(VstInt32 index, float value); // set the parameter at index to value + void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) + void getParameterName(VstInt32 index, char *text); // name of the parameter + void getParameterDisplay(VstInt32 index, char *text); // text description of the current value + VstInt32 canDo(char *text); private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; diff --git a/plugin/Source/FX/DeRez2Proc.cpp b/plugin/Source/FX/DeRez2Proc.cpp index 3a9b270..8b3ef70 100755 --- a/plugin/Source/FX/DeRez2Proc.cpp +++ b/plugin/Source/FX/DeRez2Proc.cpp @@ -32,8 +32,8 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr { double inputSampleL = *in1; double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; - if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; + //if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; + //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; double drySampleL = inputSampleL; double drySampleR = inputSampleR; @@ -167,7 +167,7 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr lastSampleL = drySampleL; lastSampleR = drySampleR; - + /* //begin 32 bit stereo floating point dither int expon; frexpf((float)inputSampleL, &expon); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; @@ -176,7 +176,8 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr 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; @@ -210,8 +211,8 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 { double inputSampleL = *in1; double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; - if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; + //if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; + //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; double drySampleL = inputSampleL; double drySampleR = inputSampleR; @@ -347,6 +348,7 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 lastSampleR = drySampleR; //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)); @@ -354,7 +356,8 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 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; diff --git a/plugin/Source/FX/FireAmp.cpp b/plugin/Source/FX/FireAmp.cpp index dfefd44..c7643de 100755 --- a/plugin/Source/FX/FireAmp.cpp +++ b/plugin/Source/FX/FireAmp.cpp @@ -134,6 +134,112 @@ void FireAmp::getProgramName(char *name) {vst_strncpy (name, _programName, kVstM //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 FireAmp::reset() +{ + A = 0.5; + B = 0.5; + C = 0.8; + D = 1.0; + + lastSampleL = 0.0; + storeSampleL = 0.0; + smoothAL = 0.0; + smoothBL = 0.0; + smoothCL = 0.0; + smoothDL = 0.0; + smoothEL = 0.0; + smoothFL = 0.0; + smoothGL = 0.0; + smoothHL = 0.0; + smoothIL = 0.0; + smoothJL = 0.0; + smoothKL = 0.0; + smoothLL = 0.0; + iirSampleAL = 0.0; + iirSampleBL = 0.0; + iirSampleCL = 0.0; + iirSampleDL = 0.0; + iirSampleEL = 0.0; + iirSampleFL = 0.0; + iirSampleGL = 0.0; + iirSampleHL = 0.0; + iirSampleIL = 0.0; + iirSampleJL = 0.0; + iirSampleKL = 0.0; + iirSampleLL = 0.0; + iirLowpassL = 0.0; + iirSpkAL = 0.0; + iirSpkBL = 0.0; + iirSubL = 0.0; + + lastSampleR = 0.0; + storeSampleR = 0.0; + smoothAR = 0.0; + smoothBR = 0.0; + smoothCR = 0.0; + smoothDR = 0.0; + smoothER = 0.0; + smoothFR = 0.0; + smoothGR = 0.0; + smoothHR = 0.0; + smoothIR = 0.0; + smoothJR = 0.0; + smoothKR = 0.0; + smoothLR = 0.0; + iirSampleAR = 0.0; + iirSampleBR = 0.0; + iirSampleCR = 0.0; + iirSampleDR = 0.0; + iirSampleER = 0.0; + iirSampleFR = 0.0; + iirSampleGR = 0.0; + iirSampleHR = 0.0; + iirSampleIR = 0.0; + iirSampleJR = 0.0; + iirSampleKR = 0.0; + iirSampleLR = 0.0; + iirLowpassR = 0.0; + iirSpkAR = 0.0; + iirSpkBR = 0.0; + iirSubR = 0.0; + + for (int fcount = 0; fcount < 257; fcount++) { + OddL[fcount] = 0.0; + EvenL[fcount] = 0.0; + OddR[fcount] = 0.0; + EvenR[fcount] = 0.0; + } + + count = 0; + flip = false; //amp + + for(int fcount = 0; fcount < 90; fcount++) { + bL[fcount] = 0; + bR[fcount] = 0; + } + smoothCabAL = 0.0; smoothCabBL = 0.0; lastCabSampleL = 0.0; //cab + smoothCabAR = 0.0; smoothCabBR = 0.0; lastCabSampleR = 0.0; //cab + + for (int fcount = 0; fcount < 9; fcount++) { + lastRefL[fcount] = 0.0; + lastRefR[fcount] = 0.0; + } + cycle = 0; //undersampling + + for (int x = 0; x < fix_total; x++) { + fixA[x] = 0.0; + fixB[x] = 0.0; + fixC[x] = 0.0; + fixD[x] = 0.0; + fixE[x] = 0.0; + fixF[x] = 0.0; + } //filtering + + 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. +} + static float pinParameter(float data) { if (data < 0.0f) return 0.0f; diff --git a/plugin/Source/FX/FireAmp.h b/plugin/Source/FX/FireAmp.h index b9c0043..1bfaeed 100755 --- a/plugin/Source/FX/FireAmp.h +++ b/plugin/Source/FX/FireAmp.h @@ -12,8 +12,7 @@ #include #include -class FireAmp : - public AudioEffectX +class FireAmp final : public AudioEffectX { public: enum { @@ -31,23 +30,24 @@ public: FireAmp(audioMasterCallback audioMaster); ~FireAmp(); - 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); + void reset(); + bool getEffectName(char* name); // The plug-in name + VstPlugCategory getPlugCategory(); // The general category for the plug-in + bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg + bool getVendorString(char* text); // Vendor info + VstInt32 getVendorVersion(); // Version number + void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); + void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); + void getProgramName(char *name); // read the name from the host + void setProgramName(char *name); // changes the name of the preset displayed in the host + VstInt32 getChunk (void** data, bool isPreset); + VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); + float getParameter(VstInt32 index); // get the parameter value at the specified index + void setParameter(VstInt32 index, float value); // set the parameter at index to value + void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) + void getParameterName(VstInt32 index, char *text); // name of the parameter + void getParameterDisplay(VstInt32 index, char *text); // text description of the current value + VstInt32 canDo(char *text); private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; diff --git a/plugin/Source/FX/FireAmpProc.cpp b/plugin/Source/FX/FireAmpProc.cpp index 60dcc63..fbd5626 100755 --- a/plugin/Source/FX/FireAmpProc.cpp +++ b/plugin/Source/FX/FireAmpProc.cpp @@ -108,8 +108,8 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF { double inputSampleL = *in1; double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; - if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; + //if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; + //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; double drySampleL = inputSampleL; double drySampleR = inputSampleR; @@ -840,6 +840,7 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF } //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)); @@ -847,7 +848,8 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF 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; @@ -958,8 +960,8 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32 { double inputSampleL = *in1; double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; - if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; + //if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; + //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; double drySampleL = inputSampleL; double drySampleR = inputSampleR; @@ -1690,6 +1692,7 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32 } //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)); @@ -1697,7 +1700,8 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32 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; diff --git a/plugin/Source/FX/GrindAmp.cpp b/plugin/Source/FX/GrindAmp.cpp index ca8d322..e2a508e 100755 --- a/plugin/Source/FX/GrindAmp.cpp +++ b/plugin/Source/FX/GrindAmp.cpp @@ -154,6 +154,132 @@ void GrindAmp::getProgramName(char *name) {vst_strncpy (name, _programName, kVst //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 GrindAmp::reset() +{ + A = 0.5; + B = 0.5; + C = 0.8; + D = 1.0; + + smoothAL = 0.0; + smoothBL = 0.0; + smoothCL = 0.0; + smoothDL = 0.0; + smoothEL = 0.0; + smoothFL = 0.0; + smoothGL = 0.0; + smoothHL = 0.0; + smoothIL = 0.0; + smoothJL = 0.0; + smoothKL = 0.0; + secondAL = 0.0; + secondBL = 0.0; + secondCL = 0.0; + secondDL = 0.0; + secondEL = 0.0; + secondFL = 0.0; + secondGL = 0.0; + secondHL = 0.0; + secondIL = 0.0; + secondJL = 0.0; + secondKL = 0.0; + thirdAL = 0.0; + thirdBL = 0.0; + thirdCL = 0.0; + thirdDL = 0.0; + thirdEL = 0.0; + thirdFL = 0.0; + thirdGL = 0.0; + thirdHL = 0.0; + thirdIL = 0.0; + thirdJL = 0.0; + thirdKL = 0.0; + iirSampleAL = 0.0; + iirSampleBL = 0.0; + iirSampleCL = 0.0; + iirSampleDL = 0.0; + iirSampleEL = 0.0; + iirSampleFL = 0.0; + iirSampleGL = 0.0; + iirSampleHL = 0.0; + iirSampleIL = 0.0; + iirLowpassL = 0.0; + iirSubL = 0.0; + storeSampleL = 0.0; //amp + + smoothAR = 0.0; + smoothBR = 0.0; + smoothCR = 0.0; + smoothDR = 0.0; + smoothER = 0.0; + smoothFR = 0.0; + smoothGR = 0.0; + smoothHR = 0.0; + smoothIR = 0.0; + smoothJR = 0.0; + smoothKR = 0.0; + secondAR = 0.0; + secondBR = 0.0; + secondCR = 0.0; + secondDR = 0.0; + secondER = 0.0; + secondFR = 0.0; + secondGR = 0.0; + secondHR = 0.0; + secondIR = 0.0; + secondJR = 0.0; + secondKR = 0.0; + thirdAR = 0.0; + thirdBR = 0.0; + thirdCR = 0.0; + thirdDR = 0.0; + thirdER = 0.0; + thirdFR = 0.0; + thirdGR = 0.0; + thirdHR = 0.0; + thirdIR = 0.0; + thirdJR = 0.0; + thirdKR = 0.0; + iirSampleAR = 0.0; + iirSampleBR = 0.0; + iirSampleCR = 0.0; + iirSampleDR = 0.0; + iirSampleER = 0.0; + iirSampleFR = 0.0; + iirSampleGR = 0.0; + iirSampleHR = 0.0; + iirSampleIR = 0.0; + iirLowpassR = 0.0; + iirSubR = 0.0; + storeSampleR = 0.0; //amp + + for(int fcount = 0; fcount < 90; fcount++) { + bL[fcount] = 0; + bR[fcount] = 0; + } + smoothCabAL = 0.0; smoothCabBL = 0.0; lastCabSampleL = 0.0; //cab + smoothCabAR = 0.0; smoothCabBR = 0.0; lastCabSampleR = 0.0; //cab + + for (int fcount = 0; fcount < 9; fcount++) { + lastRefL[fcount] = 0.0; + lastRefR[fcount] = 0.0; + } + cycle = 0; //undersampling + + for (int x = 0; x < fix_total; x++) { + fixA[x] = 0.0; + fixB[x] = 0.0; + fixC[x] = 0.0; + fixD[x] = 0.0; + fixE[x] = 0.0; + fixF[x] = 0.0; + } //filtering + + 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. +} + static float pinParameter(float data) { if (data < 0.0f) return 0.0f; diff --git a/plugin/Source/FX/GrindAmp.h b/plugin/Source/FX/GrindAmp.h index 59cf043..7ad9704 100755 --- a/plugin/Source/FX/GrindAmp.h +++ b/plugin/Source/FX/GrindAmp.h @@ -12,8 +12,7 @@ #include #include -class GrindAmp : - public AudioEffectX +class GrindAmp final : public AudioEffectX { public: enum { @@ -31,23 +30,24 @@ public: GrindAmp(audioMasterCallback audioMaster); ~GrindAmp(); - 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); + void reset(); + bool getEffectName(char* name); // The plug-in name + VstPlugCategory getPlugCategory(); // The general category for the plug-in + bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg + bool getVendorString(char* text); // Vendor info + VstInt32 getVendorVersion(); // Version number + void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); + void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); + void getProgramName(char *name); // read the name from the host + void setProgramName(char *name); // changes the name of the preset displayed in the host + VstInt32 getChunk (void** data, bool isPreset); + VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); + float getParameter(VstInt32 index); // get the parameter value at the specified index + void setParameter(VstInt32 index, float value); // set the parameter at index to value + void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) + void getParameterName(VstInt32 index, char *text); // name of the parameter + void getParameterDisplay(VstInt32 index, char *text); // text description of the current value + VstInt32 canDo(char *text); private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; diff --git a/plugin/Source/FX/GrindAmpProc.cpp b/plugin/Source/FX/GrindAmpProc.cpp index 05c8ff7..77e0af4 100755 --- a/plugin/Source/FX/GrindAmpProc.cpp +++ b/plugin/Source/FX/GrindAmpProc.cpp @@ -102,8 +102,8 @@ void GrindAmp::processReplacing(float **inputs, float **outputs, VstInt32 sample { double inputSampleL = *in1; double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; - if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; + //if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; + //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; double drySampleL = inputSampleL; double drySampleR = inputSampleR; @@ -812,6 +812,7 @@ void GrindAmp::processReplacing(float **inputs, float **outputs, VstInt32 sample } //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)); @@ -819,7 +820,8 @@ void GrindAmp::processReplacing(float **inputs, float **outputs, VstInt32 sample 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; @@ -923,8 +925,8 @@ void GrindAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt3 { double inputSampleL = *in1; double inputSampleR = *in2; - if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; - if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; + //if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; + //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; double drySampleL = inputSampleL; double drySampleR = inputSampleR; @@ -1633,6 +1635,7 @@ void GrindAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt3 } //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)); @@ -1640,7 +1643,8 @@ void GrindAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt3 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; diff --git a/plugin/Source/PluginEditor.cpp b/plugin/Source/PluginEditor.cpp index ffae4b3..9643397 100644 --- a/plugin/Source/PluginEditor.cpp +++ b/plugin/Source/PluginEditor.cpp @@ -78,6 +78,9 @@ void WavetableAudioProcessorEditor::addMenuItems (juce::PopupMenu& m) m.addItem ("MPE", true, wtProc.globalParams.mpe->getUserValueBool(), [this] { wtProc.globalParams.mpe->setUserValue (wtProc.globalParams.mpe->getUserValueBool() ? 0.0f : 1.0f); + + if (auto props = wtProc.getSettings()) + props->setValue ("mpe", wtProc.globalParams.mpe->getUserValueBool()); }); auto setSize = [this] (float scale) diff --git a/plugin/Source/PluginProcessor.cpp b/plugin/Source/PluginProcessor.cpp index 9515d6d..37d01b6 100644 --- a/plugin/Source/PluginProcessor.cpp +++ b/plugin/Source/PluginProcessor.cpp @@ -297,6 +297,9 @@ void WavetableAudioProcessor::GlobalParams::setup (WavetableAudioProcessor& p) pitchBend = p.addIntParam ("pitchbend", "Pitch Bend", "PB Range", "", { 0.0, 48.0, 1.0, 1.0 }, 2.0f, 0.0f); level->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); }; + + if (auto props = p.getSettings()) + mpe->setUserValue (props->getBoolValue ("mpe", false) ? 1.0f : 0.0f); } //============================================================================== @@ -566,6 +569,8 @@ WavetableAudioProcessor::WavetableAudioProcessor() init(); lastMono = globalParams.mono->isOn(); + + reset(); } WavetableAudioProcessor::~WavetableAudioProcessor() @@ -779,6 +784,9 @@ void WavetableAudioProcessor::reset() chorus.reset(); stereoDelay.reset(); reverb.reset(); + bitcrusher.reset(); + fireAmp.reset(); + grindAmp.reset(); for (auto& l : modLFOs) l.reset();