Remove dithers

This commit is contained in:
Roland Rabien 2023-10-20 18:49:05 -07:00
commit a376041ab8
14 changed files with 356 additions and 78 deletions

View file

@ -491,6 +491,7 @@ target_compile_definitions (${PLUGIN_NAME} PRIVATE
JUCE_USE_MP3AUDIOFORMAT=0 JUCE_USE_MP3AUDIOFORMAT=0
JUCE_USE_LAME_AUDIO_FORMAT=0 JUCE_USE_LAME_AUDIO_FORMAT=0
JUCE_USE_WINDOWS_MEDIA_FORMAT=0 JUCE_USE_WINDOWS_MEDIA_FORMAT=0
JUCE_SILENCE_XCODE_15_LINKER_WARNING=1
_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS
) )

@ -1 +1 @@
Subproject commit 017dc578135abcf00607edbf17f56288ad135e0b Subproject commit 40792ebd575d35691dc2fb0c16ebff67846b1826

@ -1 +1 @@
Subproject commit a878e042e86f9462fc08459e13fcd9bf196e0c69 Subproject commit c474cb2469272b45909c45f5d4d30df04cc342eb

View file

@ -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 //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! //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) static float pinParameter(float data)
{ {
if (data < 0.0f) return 0.0f; if (data < 0.0f) return 0.0f;

View file

@ -12,8 +12,7 @@
#include <string> #include <string>
#include <math.h> #include <math.h>
class DeRez2 : class DeRez2 final : public AudioEffectX
public AudioEffectX
{ {
public: public:
enum { enum {
@ -31,23 +30,24 @@ public:
DeRez2(audioMasterCallback audioMaster); DeRez2(audioMasterCallback audioMaster);
~DeRez2(); ~DeRez2();
virtual bool getEffectName(char* name); // The plug-in name void reset();
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in bool getEffectName(char* name); // The plug-in name
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getVendorString(char* text); // Vendor info bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual VstInt32 getVendorVersion(); // Version number bool getVendorString(char* text); // Vendor info
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); VstInt32 getVendorVersion(); // Version number
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host void getProgramName(char *name); // read the name from the host
virtual VstInt32 getChunk (void** data, bool isPreset); void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); VstInt32 getChunk (void** data, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual VstInt32 canDo(char *text); void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
VstInt32 canDo(char *text);
private: private:
char _programName[kVstMaxProgNameLen + 1]; char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo; std::set< std::string > _canDo;

View file

@ -32,8 +32,8 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 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; //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double drySampleL = inputSampleL; double drySampleL = inputSampleL;
double drySampleR = inputSampleR; double drySampleR = inputSampleR;
@ -167,7 +167,7 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
lastSampleL = drySampleL; lastSampleL = drySampleL;
lastSampleR = drySampleR; lastSampleR = drySampleR;
/*
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
@ -176,6 +176,7 @@ void DeRez2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*/
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
@ -210,8 +211,8 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 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; //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double drySampleL = inputSampleL; double drySampleL = inputSampleL;
double drySampleR = inputSampleR; double drySampleR = inputSampleR;
@ -347,6 +348,7 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
lastSampleR = drySampleR; lastSampleR = drySampleR;
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
/*
//int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
@ -354,6 +356,7 @@ void DeRez2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
//end 64 bit stereo floating point dither //end 64 bit stereo floating point dither
*/
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;

View file

@ -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 //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! //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) static float pinParameter(float data)
{ {
if (data < 0.0f) return 0.0f; if (data < 0.0f) return 0.0f;

View file

@ -12,8 +12,7 @@
#include <string> #include <string>
#include <math.h> #include <math.h>
class FireAmp : class FireAmp final : public AudioEffectX
public AudioEffectX
{ {
public: public:
enum { enum {
@ -31,23 +30,24 @@ public:
FireAmp(audioMasterCallback audioMaster); FireAmp(audioMasterCallback audioMaster);
~FireAmp(); ~FireAmp();
virtual bool getEffectName(char* name); // The plug-in name void reset();
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in bool getEffectName(char* name); // The plug-in name
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getVendorString(char* text); // Vendor info bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual VstInt32 getVendorVersion(); // Version number bool getVendorString(char* text); // Vendor info
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); VstInt32 getVendorVersion(); // Version number
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host void getProgramName(char *name); // read the name from the host
virtual VstInt32 getChunk (void** data, bool isPreset); void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); VstInt32 getChunk (void** data, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual VstInt32 canDo(char *text); void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
VstInt32 canDo(char *text);
private: private:
char _programName[kVstMaxProgNameLen + 1]; char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo; std::set< std::string > _canDo;

View file

@ -108,8 +108,8 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 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; //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double drySampleL = inputSampleL; double drySampleL = inputSampleL;
double drySampleR = inputSampleR; double drySampleR = inputSampleR;
@ -840,6 +840,7 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
} }
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
/*
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
@ -847,6 +848,7 @@ void FireAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*/
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
@ -958,8 +960,8 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 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; //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double drySampleL = inputSampleL; double drySampleL = inputSampleL;
double drySampleR = inputSampleR; double drySampleR = inputSampleR;
@ -1690,6 +1692,7 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32
} }
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
/*
//int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
@ -1697,6 +1700,7 @@ void FireAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
//end 64 bit stereo floating point dither //end 64 bit stereo floating point dither
*/
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;

View file

@ -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 //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! //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) static float pinParameter(float data)
{ {
if (data < 0.0f) return 0.0f; if (data < 0.0f) return 0.0f;

View file

@ -12,8 +12,7 @@
#include <string> #include <string>
#include <math.h> #include <math.h>
class GrindAmp : class GrindAmp final : public AudioEffectX
public AudioEffectX
{ {
public: public:
enum { enum {
@ -31,23 +30,24 @@ public:
GrindAmp(audioMasterCallback audioMaster); GrindAmp(audioMasterCallback audioMaster);
~GrindAmp(); ~GrindAmp();
virtual bool getEffectName(char* name); // The plug-in name void reset();
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in bool getEffectName(char* name); // The plug-in name
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getVendorString(char* text); // Vendor info bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual VstInt32 getVendorVersion(); // Version number bool getVendorString(char* text); // Vendor info
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); VstInt32 getVendorVersion(); // Version number
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host void getProgramName(char *name); // read the name from the host
virtual VstInt32 getChunk (void** data, bool isPreset); void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); VstInt32 getChunk (void** data, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual VstInt32 canDo(char *text); void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
VstInt32 canDo(char *text);
private: private:
char _programName[kVstMaxProgNameLen + 1]; char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo; std::set< std::string > _canDo;

View file

@ -102,8 +102,8 @@ void GrindAmp::processReplacing(float **inputs, float **outputs, VstInt32 sample
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 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; //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double drySampleL = inputSampleL; double drySampleL = inputSampleL;
double drySampleR = inputSampleR; double drySampleR = inputSampleR;
@ -812,6 +812,7 @@ void GrindAmp::processReplacing(float **inputs, float **outputs, VstInt32 sample
} }
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
/*
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
@ -819,6 +820,7 @@ void GrindAmp::processReplacing(float **inputs, float **outputs, VstInt32 sample
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*/
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
@ -923,8 +925,8 @@ void GrindAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt3
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 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; //if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double drySampleL = inputSampleL; double drySampleL = inputSampleL;
double drySampleR = inputSampleR; double drySampleR = inputSampleR;
@ -1633,6 +1635,7 @@ void GrindAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt3
} }
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
/*
//int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
@ -1640,6 +1643,7 @@ void GrindAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt3
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
//end 64 bit stereo floating point dither //end 64 bit stereo floating point dither
*/
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;

View file

@ -78,6 +78,9 @@ void WavetableAudioProcessorEditor::addMenuItems (juce::PopupMenu& m)
m.addItem ("MPE", true, wtProc.globalParams.mpe->getUserValueBool(), [this] m.addItem ("MPE", true, wtProc.globalParams.mpe->getUserValueBool(), [this]
{ {
wtProc.globalParams.mpe->setUserValue (wtProc.globalParams.mpe->getUserValueBool() ? 0.0f : 1.0f); 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) auto setSize = [this] (float scale)

View file

@ -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); 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); }; 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(); init();
lastMono = globalParams.mono->isOn(); lastMono = globalParams.mono->isOn();
reset();
} }
WavetableAudioProcessor::~WavetableAudioProcessor() WavetableAudioProcessor::~WavetableAudioProcessor()
@ -779,6 +784,9 @@ void WavetableAudioProcessor::reset()
chorus.reset(); chorus.reset();
stereoDelay.reset(); stereoDelay.reset();
reverb.reset(); reverb.reset();
bitcrusher.reset();
fireAmp.reset();
grindAmp.reset();
for (auto& l : modLFOs) for (auto& l : modLFOs)
l.reset(); l.reset();