diff options
Diffstat (limited to 'plugins/WinVST')
471 files changed, 4293 insertions, 5636 deletions
diff --git a/plugins/WinVST/ADClip7/.vs/VSTProject/v14/.suo b/plugins/WinVST/ADClip7/.vs/VSTProject/v14/.suo Binary files differindex 41b2402..51c82cf 100755 --- a/plugins/WinVST/ADClip7/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ADClip7/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ADClip7/ADClip7.cpp b/plugins/WinVST/ADClip7/ADClip7.cpp index fb6d6c6..7ebc817 100755 --- a/plugins/WinVST/ADClip7/ADClip7.cpp +++ b/plugins/WinVST/ADClip7/ADClip7.cpp @@ -30,11 +30,8 @@ ADClip7::ADClip7(audioMasterCallback audioMaster) : iirLowsBL = 0.0; iirLowsBR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ADClip7/ADClip7.h b/plugins/WinVST/ADClip7/ADClip7.h index f20d3fb..f0cde6c 100755 --- a/plugins/WinVST/ADClip7/ADClip7.h +++ b/plugins/WinVST/ADClip7/ADClip7.h @@ -55,11 +55,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff long double lastSampleL; long double lastSampleR; diff --git a/plugins/WinVST/ADClip7/ADClip7Proc.cpp b/plugins/WinVST/ADClip7/ADClip7Proc.cpp index 2705d61..abc9909 100755 --- a/plugins/WinVST/ADClip7/ADClip7Proc.cpp +++ b/plugins/WinVST/ADClip7/ADClip7Proc.cpp @@ -17,10 +17,8 @@ void ADClip7::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double fpNew = 1.0 - fpOld; double inputGain = pow(10.0,(A*18.0)/20.0); double softness = B * fpNew; double hardness = 1.0 - softness; @@ -449,25 +447,14 @@ void ADClip7::processReplacing(float **inputs, float **outputs, VstInt32 sampleF if (inputSampleR < -refclipR) inputSampleR = -refclipR; //final iron bar - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -489,10 +476,8 @@ void ADClip7::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double fpNew = 1.0 - fpOld; double inputGain = pow(10.0,(A*18.0)/20.0); double softness = B * fpNew; double hardness = 1.0 - softness; @@ -922,25 +907,16 @@ void ADClip7::processDoubleReplacing(double **inputs, double **outputs, VstInt32 if (inputSampleR < -refclipR) inputSampleR = -refclipR; //final iron bar - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ADT/.vs/VSTProject/v14/.suo b/plugins/WinVST/ADT/.vs/VSTProject/v14/.suo Binary files differindex bf5ce54..60acd7c 100755 --- a/plugins/WinVST/ADT/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ADT/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ADT/ADTProc.cpp b/plugins/WinVST/ADT/ADTProc.cpp index f963f2f..74d23dd 100755 --- a/plugins/WinVST/ADT/ADTProc.cpp +++ b/plugins/WinVST/ADT/ADTProc.cpp @@ -156,18 +156,14 @@ void ADT::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame if (output < 1.0) {inputSampleL *= output; inputSampleR *= output;} - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -177,12 +173,6 @@ void ADT::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -334,18 +324,16 @@ void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam if (output < 1.0) {inputSampleL *= output; inputSampleR *= output;} - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -355,10 +343,4 @@ void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/AQuickVoiceClip/.vs/VSTProject/v14/.suo b/plugins/WinVST/AQuickVoiceClip/.vs/VSTProject/v14/.suo Binary files differindex 42a754f..c1193f7 100755 --- a/plugins/WinVST/AQuickVoiceClip/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/AQuickVoiceClip/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.cpp b/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.cpp index 9b5ea81..9b84221 100755 --- a/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.cpp +++ b/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.cpp @@ -57,11 +57,8 @@ AQuickVoiceClip::AQuickVoiceClip(audioMasterCallback audioMaster) : ataK4 = 0.886; //remainder of interpolated dry, adds up to 1.0 ataK5 = 0.431; //subtract this much prev. diff sample, brightens. 0.431 becomes flat - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.h b/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.h index dc8f5fa..40cfab2 100755 --- a/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.h +++ b/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClip.h @@ -115,11 +115,8 @@ private: double RiirSampleD; bool flip; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClipProc.cpp b/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClipProc.cpp index 69dc283..cc282b6 100755 --- a/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClipProc.cpp +++ b/plugins/WinVST/AQuickVoiceClip/AQuickVoiceClipProc.cpp @@ -41,9 +41,6 @@ void AQuickVoiceClip::processReplacing(float **inputs, float **outputs, VstInt32 double RoutputSample; double RdrySample; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -410,25 +407,14 @@ void AQuickVoiceClip::processReplacing(float **inputs, float **outputs, VstInt32 if (LlpDepth < 0.0) LlpDepth = 0.0; if (RlpDepth < 0.0) RlpDepth = 0.0; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither inputSampleL *= (1.0-LmaxRecent); inputSampleR *= (1.0-RmaxRecent); @@ -487,9 +473,6 @@ void AQuickVoiceClip::processDoubleReplacing(double **inputs, double **outputs, double RoutputSample; double RdrySample; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -856,25 +839,16 @@ void AQuickVoiceClip::processDoubleReplacing(double **inputs, double **outputs, if (LlpDepth < 0.0) LlpDepth = 0.0; if (RlpDepth < 0.0) RlpDepth = 0.0; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither inputSampleL *= (1.0-LmaxRecent); inputSampleR *= (1.0-RmaxRecent); diff --git a/plugins/WinVST/Acceleration/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/Acceleration/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/Acceleration/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/Acceleration/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/Acceleration/.vs/VSTProject/v14/.suo b/plugins/WinVST/Acceleration/.vs/VSTProject/v14/.suo Binary files differindex 734c0c5..2ff1d0a 100644..100755 --- a/plugins/WinVST/Acceleration/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Acceleration/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Acceleration/Acceleration.cpp b/plugins/WinVST/Acceleration/Acceleration.cpp index f20c8f2..b2721d9 100644..100755 --- a/plugins/WinVST/Acceleration/Acceleration.cpp +++ b/plugins/WinVST/Acceleration/Acceleration.cpp @@ -23,11 +23,8 @@ Acceleration::Acceleration(audioMasterCallback audioMaster) : o1R = o2R = o3R = 0.0; m1R = m2R = desR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Acceleration/Acceleration.h b/plugins/WinVST/Acceleration/Acceleration.h index a152e25..02a3760 100644..100755 --- a/plugins/WinVST/Acceleration/Acceleration.h +++ b/plugins/WinVST/Acceleration/Acceleration.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double ataLastOutL; double s1L; diff --git a/plugins/WinVST/Acceleration/AccelerationProc.cpp b/plugins/WinVST/Acceleration/AccelerationProc.cpp index 4785e37..0151dbe 100644..100755 --- a/plugins/WinVST/Acceleration/AccelerationProc.cpp +++ b/plugins/WinVST/Acceleration/AccelerationProc.cpp @@ -17,9 +17,6 @@ void Acceleration::processReplacing(float **inputs, float **outputs, VstInt32 sa double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = pow(A,3)*(32/overallscale); double wet = B; @@ -135,25 +132,14 @@ void Acceleration::processReplacing(float **inputs, float **outputs, VstInt32 sa inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -175,9 +161,6 @@ void Acceleration::processDoubleReplacing(double **inputs, double **outputs, Vst double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = pow(A,3)*(32/overallscale); double wet = B; @@ -293,25 +276,16 @@ void Acceleration::processDoubleReplacing(double **inputs, double **outputs, Vst inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Acceleration/VSTProject.sln b/plugins/WinVST/Acceleration/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/Acceleration/VSTProject.sln +++ b/plugins/WinVST/Acceleration/VSTProject.sln diff --git a/plugins/WinVST/Acceleration/VSTProject.vcxproj b/plugins/WinVST/Acceleration/VSTProject.vcxproj index 3a80f39..3a80f39 100644..100755 --- a/plugins/WinVST/Acceleration/VSTProject.vcxproj +++ b/plugins/WinVST/Acceleration/VSTProject.vcxproj diff --git a/plugins/WinVST/Acceleration/VSTProject.vcxproj.filters b/plugins/WinVST/Acceleration/VSTProject.vcxproj.filters index 8e2ce84..8e2ce84 100644..100755 --- a/plugins/WinVST/Acceleration/VSTProject.vcxproj.filters +++ b/plugins/WinVST/Acceleration/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/Acceleration/VSTProject.vcxproj.user b/plugins/WinVST/Acceleration/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/Acceleration/VSTProject.vcxproj.user +++ b/plugins/WinVST/Acceleration/VSTProject.vcxproj.user diff --git a/plugins/WinVST/Acceleration/vstplug.def b/plugins/WinVST/Acceleration/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/Acceleration/vstplug.def +++ b/plugins/WinVST/Acceleration/vstplug.def diff --git a/plugins/WinVST/Air/.vs/VSTProject/v14/.suo b/plugins/WinVST/Air/.vs/VSTProject/v14/.suo Binary files differindex 5e12ea1..50bebe3 100755 --- a/plugins/WinVST/Air/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Air/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Air/Air.cpp b/plugins/WinVST/Air/Air.cpp index ebe8adc..ea52c26 100755 --- a/plugins/WinVST/Air/Air.cpp +++ b/plugins/WinVST/Air/Air.cpp @@ -61,11 +61,8 @@ Air::Air(audioMasterCallback audioMaster) : D = 0.0; E = 1.0; F = 1.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Air/Air.h b/plugins/WinVST/Air/Air.h index 00c0b76..a713cf2 100755 --- a/plugins/WinVST/Air/Air.h +++ b/plugins/WinVST/Air/Air.h @@ -100,11 +100,8 @@ private: bool flop; int count; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Air/AirProc.cpp b/plugins/WinVST/Air/AirProc.cpp index f73e7d8..f5eb39f 100755 --- a/plugins/WinVST/Air/AirProc.cpp +++ b/plugins/WinVST/Air/AirProc.cpp @@ -22,9 +22,6 @@ void Air::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame double wet = F; double dry = 1.0-wet; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -260,25 +257,14 @@ void Air::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -305,9 +291,6 @@ void Air::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam double wet = F; double dry = 1.0-wet; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -543,25 +526,16 @@ void Air::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo b/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo Binary files differindex 48715fd..c97c439 100755 --- a/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp b/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp index 6530a7e..16d7a31 100755 --- a/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp +++ b/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp @@ -13,7 +13,6 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32 float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); @@ -250,18 +249,14 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32 lastSampleAR = drySampleR; //store the raw R input sample again for use next time - //noise shaping to 32-bit floating point - fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -271,12 +266,6 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -285,7 +274,6 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); @@ -522,18 +510,16 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V lastSampleAR = drySampleR; //store the raw R input sample again for use next time - //noise shaping to 64-bit floating point - fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -543,10 +529,4 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. }
\ No newline at end of file diff --git a/plugins/WinVST/AtmosphereChannel/.vs/VSTProject/v14/.suo b/plugins/WinVST/AtmosphereChannel/.vs/VSTProject/v14/.suo Binary files differindex 76526b8..c7e4ab5 100755 --- a/plugins/WinVST/AtmosphereChannel/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/AtmosphereChannel/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/AtmosphereChannel/AtmosphereChannelProc.cpp b/plugins/WinVST/AtmosphereChannel/AtmosphereChannelProc.cpp index 97038e8..bbdf44c 100755 --- a/plugins/WinVST/AtmosphereChannel/AtmosphereChannelProc.cpp +++ b/plugins/WinVST/AtmosphereChannel/AtmosphereChannelProc.cpp @@ -13,7 +13,6 @@ void AtmosphereChannel::processReplacing(float **inputs, float **outputs, VstInt float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); @@ -245,18 +244,14 @@ void AtmosphereChannel::processReplacing(float **inputs, float **outputs, VstInt lastSampleAR = drySampleR; //store the raw R input sample again for use next time - //noise shaping to 32-bit floating point - fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -266,12 +261,6 @@ void AtmosphereChannel::processReplacing(float **inputs, float **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void AtmosphereChannel::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -280,7 +269,6 @@ void AtmosphereChannel::processDoubleReplacing(double **inputs, double **outputs double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); @@ -512,18 +500,16 @@ void AtmosphereChannel::processDoubleReplacing(double **inputs, double **outputs lastSampleAR = drySampleR; //store the raw R input sample again for use next time - //noise shaping to 64-bit floating point - fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -533,10 +519,4 @@ void AtmosphereChannel::processDoubleReplacing(double **inputs, double **outputs *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. }
\ No newline at end of file diff --git a/plugins/WinVST/Aura/.vs/VSTProject/v14/.suo b/plugins/WinVST/Aura/.vs/VSTProject/v14/.suo Binary files differindex 885f4c3..ef870fa 100755 --- a/plugins/WinVST/Aura/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Aura/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Aura/Aura.cpp b/plugins/WinVST/Aura/Aura.cpp index d011564..8663d3b 100755 --- a/plugins/WinVST/Aura/Aura.cpp +++ b/plugins/WinVST/Aura/Aura.cpp @@ -24,11 +24,8 @@ Aura::Aura(audioMasterCallback audioMaster) : lastSampleR = 0.0; previousVelocityR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Aura/Aura.h b/plugins/WinVST/Aura/Aura.h index 557169d..22d4653 100755 --- a/plugins/WinVST/Aura/Aura.h +++ b/plugins/WinVST/Aura/Aura.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff long double lastSampleL; double previousVelocityL; diff --git a/plugins/WinVST/Aura/AuraProc.cpp b/plugins/WinVST/Aura/AuraProc.cpp index daf54d6..089a873 100755 --- a/plugins/WinVST/Aura/AuraProc.cpp +++ b/plugins/WinVST/Aura/AuraProc.cpp @@ -14,9 +14,6 @@ void Aura::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double correctionL; double correctionR; @@ -211,25 +208,14 @@ void Aura::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -248,9 +234,6 @@ void Aura::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double correctionL; double correctionR; @@ -445,25 +428,16 @@ void Aura::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Average/.vs/VSTProject/v14/.suo b/plugins/WinVST/Average/.vs/VSTProject/v14/.suo Binary files differindex 24b500e..832bbaa 100755 --- a/plugins/WinVST/Average/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Average/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Average/Average.cpp b/plugins/WinVST/Average/Average.cpp index 945c76c..2f39ca1 100755 --- a/plugins/WinVST/Average/Average.cpp +++ b/plugins/WinVST/Average/Average.cpp @@ -17,11 +17,8 @@ Average::Average(audioMasterCallback audioMaster) : for(int count = 0; count < 11; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;} - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Average/Average.h b/plugins/WinVST/Average/Average.h index 7e4b25e..9932e99 100755 --- a/plugins/WinVST/Average/Average.h +++ b/plugins/WinVST/Average/Average.h @@ -57,11 +57,8 @@ private: double f[11]; double bR[11]; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Average/AverageProc.cpp b/plugins/WinVST/Average/AverageProc.cpp index 2b1c355..17f4783 100755 --- a/plugins/WinVST/Average/AverageProc.cpp +++ b/plugins/WinVST/Average/AverageProc.cpp @@ -14,9 +14,6 @@ void Average::processReplacing(float **inputs, float **outputs, VstInt32 sampleF float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double correctionSample; double accumulatorSampleL; @@ -154,25 +151,14 @@ void Average::processReplacing(float **inputs, float **outputs, VstInt32 sampleF //in the floating point system. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -189,12 +175,7 @@ void Average::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double* in1 = inputs[0]; double* in2 = inputs[1]; double* out1 = outputs[0]; - double* out2 = outputs[1]; - - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + double* out2 = outputs[1]; double correctionSample; double accumulatorSampleL; double accumulatorSampleR; @@ -330,25 +311,16 @@ void Average::processDoubleReplacing(double **inputs, double **outputs, VstInt32 //if it 'won't change anything' but our sample might be at a very different scaling //in the floating point system. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/BassKit/.vs/VSTProject/v14/.suo b/plugins/WinVST/BassKit/.vs/VSTProject/v14/.suo Binary files differindex 8b0a466..adef4ae 100755 --- a/plugins/WinVST/BassKit/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/BassKit/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/BassKit/BassKitProc.cpp b/plugins/WinVST/BassKit/BassKitProc.cpp index df3310e..9199c82 100755 --- a/plugins/WinVST/BassKit/BassKitProc.cpp +++ b/plugins/WinVST/BassKit/BassKitProc.cpp @@ -204,18 +204,14 @@ void BassKit::processReplacing(float **inputs, float **outputs, VstInt32 sampleF bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -225,12 +221,6 @@ void BassKit::processReplacing(float **inputs, float **outputs, VstInt32 sampleF *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void BassKit::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -430,18 +420,16 @@ void BassKit::processDoubleReplacing(double **inputs, double **outputs, VstInt32 bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -451,10 +439,4 @@ void BassKit::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/BitGlitter/.vs/VSTProject/v14/.suo b/plugins/WinVST/BitGlitter/.vs/VSTProject/v14/.suo Binary files differindex 22c8c6e..6d68229 100755 --- a/plugins/WinVST/BitGlitter/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/BitGlitter/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/BitGlitter/BitGlitter.cpp b/plugins/WinVST/BitGlitter/BitGlitter.cpp index 7e9cfdb..a1e1a9b 100755 --- a/plugins/WinVST/BitGlitter/BitGlitter.cpp +++ b/plugins/WinVST/BitGlitter/BitGlitter.cpp @@ -17,6 +17,9 @@ BitGlitter::BitGlitter(audioMasterCallback audioMaster) : C = 0.5; D = 1.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; + ataLastSampleL = 0.0; ataHalfwaySampleL = 0.0; lastSampleL = 0.0; diff --git a/plugins/WinVST/BitGlitter/BitGlitter.h b/plugins/WinVST/BitGlitter/BitGlitter.h index d87e277..4f108cd 100755 --- a/plugins/WinVST/BitGlitter/BitGlitter.h +++ b/plugins/WinVST/BitGlitter/BitGlitter.h @@ -55,6 +55,9 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; + long double fpNShapeL; + long double fpNShapeR; + double ataLastSampleL; double ataHalfwaySampleL; double ataDrySampleL; diff --git a/plugins/WinVST/BitGlitter/BitGlitterProc.cpp b/plugins/WinVST/BitGlitter/BitGlitterProc.cpp index 321d0b6..ff2968c 100755 --- a/plugins/WinVST/BitGlitter/BitGlitterProc.cpp +++ b/plugins/WinVST/BitGlitter/BitGlitterProc.cpp @@ -202,6 +202,14 @@ void BitGlitter::processReplacing(float **inputs, float **outputs, VstInt32 samp outputSampleL = (drySampleL * (1.0-wet)) + (outputSampleL * wet); outputSampleR = (drySampleR * (1.0-wet)) + (outputSampleR * wet); } + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)outputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + outputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)outputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + outputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = outputSampleL; *out2 = outputSampleR; @@ -408,6 +416,17 @@ void BitGlitter::processDoubleReplacing(double **inputs, double **outputs, VstIn outputSampleR = (drySampleR * (1.0-wet)) + (outputSampleR * wet); } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)outputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + outputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)outputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + outputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither + *out1 = outputSampleL; *out2 = outputSampleR; diff --git a/plugins/WinVST/BitShiftGain/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/BitShiftGain/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/BitShiftGain/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/BitShiftGain/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/BitShiftGain/.vs/VSTProject/v14/.suo b/plugins/WinVST/BitShiftGain/.vs/VSTProject/v14/.suo Binary files differindex 0b76ac5..d9c85b0 100644..100755 --- a/plugins/WinVST/BitShiftGain/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/BitShiftGain/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/BitShiftGain/BitShiftGain.cpp b/plugins/WinVST/BitShiftGain/BitShiftGain.cpp index c89bb9f..c89bb9f 100644..100755 --- a/plugins/WinVST/BitShiftGain/BitShiftGain.cpp +++ b/plugins/WinVST/BitShiftGain/BitShiftGain.cpp diff --git a/plugins/WinVST/BitShiftGain/BitShiftGain.h b/plugins/WinVST/BitShiftGain/BitShiftGain.h index 00400a2..00400a2 100644..100755 --- a/plugins/WinVST/BitShiftGain/BitShiftGain.h +++ b/plugins/WinVST/BitShiftGain/BitShiftGain.h diff --git a/plugins/WinVST/BitShiftGain/BitShiftGainProc.cpp b/plugins/WinVST/BitShiftGain/BitShiftGainProc.cpp index c680ebe..c680ebe 100644..100755 --- a/plugins/WinVST/BitShiftGain/BitShiftGainProc.cpp +++ b/plugins/WinVST/BitShiftGain/BitShiftGainProc.cpp diff --git a/plugins/WinVST/BitShiftGain/VSTProject.sln b/plugins/WinVST/BitShiftGain/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/BitShiftGain/VSTProject.sln +++ b/plugins/WinVST/BitShiftGain/VSTProject.sln diff --git a/plugins/WinVST/BitShiftGain/VSTProject.vcxproj b/plugins/WinVST/BitShiftGain/VSTProject.vcxproj index 4403483..4403483 100644..100755 --- a/plugins/WinVST/BitShiftGain/VSTProject.vcxproj +++ b/plugins/WinVST/BitShiftGain/VSTProject.vcxproj diff --git a/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.filters b/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.filters index 6d9420c..6d9420c 100644..100755 --- a/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.filters +++ b/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.user b/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.user +++ b/plugins/WinVST/BitShiftGain/VSTProject.vcxproj.user diff --git a/plugins/WinVST/BitShiftGain/vstplug.def b/plugins/WinVST/BitShiftGain/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/BitShiftGain/vstplug.def +++ b/plugins/WinVST/BitShiftGain/vstplug.def diff --git a/plugins/WinVST/Bite/.vs/VSTProject/v14/.suo b/plugins/WinVST/Bite/.vs/VSTProject/v14/.suo Binary files differindex a8fee43..3113a75 100755 --- a/plugins/WinVST/Bite/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Bite/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Bite/Bite.cpp b/plugins/WinVST/Bite/Bite.cpp index b563f54..c9d0fcb 100755 --- a/plugins/WinVST/Bite/Bite.cpp +++ b/plugins/WinVST/Bite/Bite.cpp @@ -34,11 +34,8 @@ Bite::Bite(audioMasterCallback audioMaster) : sampleHR = 0.0; sampleIR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Bite/Bite.h b/plugins/WinVST/Bite/Bite.h index d6f9e44..288ac7f 100755 --- a/plugins/WinVST/Bite/Bite.h +++ b/plugins/WinVST/Bite/Bite.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double sampleAL; double sampleBL; diff --git a/plugins/WinVST/Bite/BiteProc.cpp b/plugins/WinVST/Bite/BiteProc.cpp index 690a998..64e0ac4 100755 --- a/plugins/WinVST/Bite/BiteProc.cpp +++ b/plugins/WinVST/Bite/BiteProc.cpp @@ -17,9 +17,6 @@ void Bite::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram double overallscale = 1.3; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double gain = ((A*2.0)-1.0)*overallscale; double outputgain = B; @@ -119,25 +116,14 @@ void Bite::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram inputSampleR *= outputgain; } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -159,9 +145,6 @@ void Bite::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa double overallscale = 1.3; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double gain = ((A*2.0)-1.0)*overallscale; double outputgain = B; @@ -261,25 +244,16 @@ void Bite::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa inputSampleR *= outputgain; } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/BuildATPDF/.vs/VSTProject/v14/.suo b/plugins/WinVST/BuildATPDF/.vs/VSTProject/v14/.suo Binary files differindex 48c954d..ac5f5f8 100755 --- a/plugins/WinVST/BuildATPDF/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/BuildATPDF/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/BussColors4/.vs/VSTProject/v14/.suo b/plugins/WinVST/BussColors4/.vs/VSTProject/v14/.suo Binary files differindex 8ad21ec..d45891a 100755 --- a/plugins/WinVST/BussColors4/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/BussColors4/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/BussColors4/BussColors4.cpp b/plugins/WinVST/BussColors4/BussColors4.cpp index 720dbf9..c7de380 100755 --- a/plugins/WinVST/BussColors4/BussColors4.cpp +++ b/plugins/WinVST/BussColors4/BussColors4.cpp @@ -44,11 +44,8 @@ BussColors4::BussColors4(audioMasterCallback audioMaster) : slowdynR = 0; gcount = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. @@ -114,21 +111,6 @@ void BussColors4::setParameter(VstInt32 index, float value) { case kParamD: D = value; break; //this is the popup, stored as a float default: throw; // unknown parameter, shouldn't happen! } - //we can also set other defaults here, and do calculations that only have to happen - //once when parameters actually change. Here is the 'popup' setting its (global) values. - //variables can also be set in the processreplacing loop, and there they'll be set every buffersize - //here they're set when a parameter's actually changed, which should be less frequent, but - //you must use global variables in the BussColors4.h file to do it. - switch((VstInt32)( D * 3.999 )) - { - case 0: fpFlip = true; break; //choice A - case 1: fpFlip = false; break; //choice B - case 2: break; //choice C - case 3: break; //choice D - default: break; //should not happen - } - //this relates to using D as a 'popup' and changing things based on that switch. - //we are using fpFlip just because it's already there globally, as an example. } float BussColors4::getParameter(VstInt32 index) { diff --git a/plugins/WinVST/BussColors4/BussColors4.h b/plugins/WinVST/BussColors4/BussColors4.h index d07460e..6452555 100755 --- a/plugins/WinVST/BussColors4/BussColors4.h +++ b/plugins/WinVST/BussColors4/BussColors4.h @@ -68,11 +68,8 @@ private: double slowdynR; int gcount; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/BussColors4/BussColors4Proc.cpp b/plugins/WinVST/BussColors4/BussColors4Proc.cpp index 2629ee8..b1b9451 100755 --- a/plugins/WinVST/BussColors4/BussColors4Proc.cpp +++ b/plugins/WinVST/BussColors4/BussColors4Proc.cpp @@ -31,9 +31,6 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam double gain = 0.436; double outgain = 1.0; double bridgerectifier; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -795,25 +792,14 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -849,9 +835,6 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI double gain = 0.436; double outgain = 1.0; double bridgerectifier; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -1613,25 +1596,16 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ButterComp/.vs/VSTProject/v14/.suo b/plugins/WinVST/ButterComp/.vs/VSTProject/v14/.suo Binary files differindex 973e33a..33f7d87 100755 --- a/plugins/WinVST/ButterComp/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ButterComp/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ButterComp/ButterComp.cpp b/plugins/WinVST/ButterComp/ButterComp.cpp index e6a33f7..b3123e2 100755 --- a/plugins/WinVST/ButterComp/ButterComp.cpp +++ b/plugins/WinVST/ButterComp/ButterComp.cpp @@ -26,11 +26,8 @@ ButterComp::ButterComp(audioMasterCallback audioMaster) : controlBnegR = 1.0; targetposR = 1.0; targetnegR = 1.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ButterComp/ButterComp.h b/plugins/WinVST/ButterComp/ButterComp.h index af6df66..5c9862b 100755 --- a/plugins/WinVST/ButterComp/ButterComp.h +++ b/plugins/WinVST/ButterComp/ButterComp.h @@ -65,11 +65,8 @@ private: double controlBnegR; double targetposR; double targetnegR; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/ButterComp/ButterCompProc.cpp b/plugins/WinVST/ButterComp/ButterCompProc.cpp index ea52946..d87030c 100755 --- a/plugins/WinVST/ButterComp/ButterCompProc.cpp +++ b/plugins/WinVST/ButterComp/ButterCompProc.cpp @@ -17,9 +17,6 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputposL; double inputnegL; @@ -181,25 +178,14 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -221,9 +207,6 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputposL; double inputnegL; @@ -385,25 +368,16 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ButterComp2/.vs/VSTProject/v14/.suo b/plugins/WinVST/ButterComp2/.vs/VSTProject/v14/.suo Binary files differindex 5192314..7169495 100755 --- a/plugins/WinVST/ButterComp2/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ButterComp2/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ButterComp2/ButterComp2Proc.cpp b/plugins/WinVST/ButterComp2/ButterComp2Proc.cpp index 55ce488..67a6367 100755 --- a/plugins/WinVST/ButterComp2/ButterComp2Proc.cpp +++ b/plugins/WinVST/ButterComp2/ButterComp2Proc.cpp @@ -223,18 +223,14 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam flip = !flip; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -244,12 +240,6 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -468,18 +458,16 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI flip = !flip; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -489,10 +477,4 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/C5RawBuss/.vs/VSTProject/v14/.suo b/plugins/WinVST/C5RawBuss/.vs/VSTProject/v14/.suo Binary files differindex 03f4aae..7727c07 100755 --- a/plugins/WinVST/C5RawBuss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/C5RawBuss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/C5RawBuss/C5RawBuss.cpp b/plugins/WinVST/C5RawBuss/C5RawBuss.cpp index 14b4dc5..8fba0ef 100755 --- a/plugins/WinVST/C5RawBuss/C5RawBuss.cpp +++ b/plugins/WinVST/C5RawBuss/C5RawBuss.cpp @@ -17,11 +17,8 @@ C5RawBuss::C5RawBuss(audioMasterCallback audioMaster) : lastSampleBussL = 0.0; lastFXBussR = 0.0; lastSampleBussR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/C5RawBuss/C5RawBuss.h b/plugins/WinVST/C5RawBuss/C5RawBuss.h index 5a409bc..f4d01fe 100755 --- a/plugins/WinVST/C5RawBuss/C5RawBuss.h +++ b/plugins/WinVST/C5RawBuss/C5RawBuss.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastFXBussL; double lastSampleBussL; diff --git a/plugins/WinVST/C5RawBuss/C5RawBussProc.cpp b/plugins/WinVST/C5RawBuss/C5RawBussProc.cpp index 1bf5eec..fab4612 100755 --- a/plugins/WinVST/C5RawBuss/C5RawBussProc.cpp +++ b/plugins/WinVST/C5RawBuss/C5RawBussProc.cpp @@ -14,9 +14,6 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double centering = A * 0.5; centering = 1.0 - pow(centering,5); @@ -111,25 +108,14 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl //build new signal off what was present in output last time //slew aspect - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -148,9 +134,6 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double centering = A * 0.5; centering = 1.0 - pow(centering,5); @@ -245,25 +228,16 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt //build new signal off what was present in output last time //slew aspect - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/C5RawChannel/.vs/VSTProject/v14/.suo b/plugins/WinVST/C5RawChannel/.vs/VSTProject/v14/.suo Binary files differindex 60c2966..6732c5e 100755 --- a/plugins/WinVST/C5RawChannel/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/C5RawChannel/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/C5RawChannel/C5RawChannel.cpp b/plugins/WinVST/C5RawChannel/C5RawChannel.cpp index b02a07d..ffc2ecf 100755 --- a/plugins/WinVST/C5RawChannel/C5RawChannel.cpp +++ b/plugins/WinVST/C5RawChannel/C5RawChannel.cpp @@ -17,11 +17,8 @@ C5RawChannel::C5RawChannel(audioMasterCallback audioMaster) : lastSampleChannelL = 0.0; lastFXChannelR = 0.0; lastSampleChannelR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/C5RawChannel/C5RawChannel.h b/plugins/WinVST/C5RawChannel/C5RawChannel.h index 2281961..3ce3e84 100755 --- a/plugins/WinVST/C5RawChannel/C5RawChannel.h +++ b/plugins/WinVST/C5RawChannel/C5RawChannel.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastFXChannelL; double lastSampleChannelL; diff --git a/plugins/WinVST/C5RawChannel/C5RawChannelProc.cpp b/plugins/WinVST/C5RawChannel/C5RawChannelProc.cpp index 41f949e..b2679ff 100755 --- a/plugins/WinVST/C5RawChannel/C5RawChannelProc.cpp +++ b/plugins/WinVST/C5RawChannel/C5RawChannelProc.cpp @@ -14,9 +14,6 @@ void C5RawChannel::processReplacing(float **inputs, float **outputs, VstInt32 sa float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double centering = A * 0.5; centering = 1.0 - pow(centering,5); @@ -110,25 +107,14 @@ void C5RawChannel::processReplacing(float **inputs, float **outputs, VstInt32 sa inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -147,9 +133,6 @@ void C5RawChannel::processDoubleReplacing(double **inputs, double **outputs, Vst double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double centering = A * 0.5; centering = 1.0 - pow(centering,5); @@ -243,25 +226,16 @@ void C5RawChannel::processDoubleReplacing(double **inputs, double **outputs, Vst inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/CStrip/.vs/VSTProject/v14/.suo b/plugins/WinVST/CStrip/.vs/VSTProject/v14/.suo Binary files differindex 36fe57d..09cd1aa 100755 --- a/plugins/WinVST/CStrip/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/CStrip/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/CStrip/CStrip.cpp b/plugins/WinVST/CStrip/CStrip.cpp index 1c24d1b..2049ab8 100755 --- a/plugins/WinVST/CStrip/CStrip.cpp +++ b/plugins/WinVST/CStrip/CStrip.cpp @@ -153,11 +153,8 @@ CStrip::CStrip(audioMasterCallback audioMaster) : nvgRA = nvgRB = 0.0; //end ButterComp - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/CStrip/CStrip.h b/plugins/WinVST/CStrip/CStrip.h index 10f6729..cc9f722 100755 --- a/plugins/WinVST/CStrip/CStrip.h +++ b/plugins/WinVST/CStrip/CStrip.h @@ -63,11 +63,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastSampleL; diff --git a/plugins/WinVST/CStrip/CStripProc.cpp b/plugins/WinVST/CStrip/CStripProc.cpp index 272b9b6..60ce59c 100755 --- a/plugins/WinVST/CStrip/CStripProc.cpp +++ b/plugins/WinVST/CStrip/CStripProc.cpp @@ -20,10 +20,8 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - float fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -728,25 +726,14 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr inputSampleR *= outputgain; } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -771,10 +758,8 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32 overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - double fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! long double fpNew = 1.0 - fpOld; - long double inputSampleL; long double inputSampleR; @@ -1479,25 +1464,16 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR *= outputgain; } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Capacitor/.vs/VSTProject/v14/.suo b/plugins/WinVST/Capacitor/.vs/VSTProject/v14/.suo Binary files differindex 28e146c..97e4f53 100755 --- a/plugins/WinVST/Capacitor/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Capacitor/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Capacitor/Capacitor.cpp b/plugins/WinVST/Capacitor/Capacitor.cpp index 2a62df6..0ade9c9 100755 --- a/plugins/WinVST/Capacitor/Capacitor.cpp +++ b/plugins/WinVST/Capacitor/Capacitor.cpp @@ -51,11 +51,8 @@ Capacitor::Capacitor(audioMasterCallback audioMaster) : lastHighpass = 1000.0; lastWet = 1000.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Capacitor/Capacitor.h b/plugins/WinVST/Capacitor/Capacitor.h index d80c676..0799d39 100755 --- a/plugins/WinVST/Capacitor/Capacitor.h +++ b/plugins/WinVST/Capacitor/Capacitor.h @@ -94,11 +94,8 @@ private: double lastHighpass; double lastWet; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Capacitor/CapacitorProc.cpp b/plugins/WinVST/Capacitor/CapacitorProc.cpp index 6accb0d..6b3582b 100755 --- a/plugins/WinVST/Capacitor/CapacitorProc.cpp +++ b/plugins/WinVST/Capacitor/CapacitorProc.cpp @@ -30,9 +30,6 @@ void Capacitor::processReplacing(float **inputs, float **outputs, VstInt32 sampl double invHighpass; double dry; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -182,25 +179,14 @@ void Capacitor::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleL = (drySampleL * dry) + (inputSampleL * wet); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -235,9 +221,6 @@ void Capacitor::processDoubleReplacing(double **inputs, double **outputs, VstInt double invHighpass; double dry; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -387,25 +370,16 @@ void Capacitor::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleL = (drySampleL * dry) + (inputSampleL * wet); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Channel6/.vs/VSTProject/v14/.suo b/plugins/WinVST/Channel6/.vs/VSTProject/v14/.suo Binary files differindex 521c0d0..7d5f2f1 100755 --- a/plugins/WinVST/Channel6/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Channel6/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Channel6/Channel6Proc.cpp b/plugins/WinVST/Channel6/Channel6Proc.cpp index d206851..9f16b2a 100755 --- a/plugins/WinVST/Channel6/Channel6Proc.cpp +++ b/plugins/WinVST/Channel6/Channel6Proc.cpp @@ -121,18 +121,14 @@ void Channel6::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR *= output; } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -142,12 +138,6 @@ void Channel6::processReplacing(float **inputs, float **outputs, VstInt32 sample *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -264,18 +254,16 @@ void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR *= output; } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -285,10 +273,4 @@ void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt3 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/Chorus/.vs/VSTProject/v14/.suo b/plugins/WinVST/Chorus/.vs/VSTProject/v14/.suo Binary files differindex 6891b3b..113c667 100755 --- a/plugins/WinVST/Chorus/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Chorus/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Chorus/Chorus.cpp b/plugins/WinVST/Chorus/Chorus.cpp index a0699ec..1f3965a 100755 --- a/plugins/WinVST/Chorus/Chorus.cpp +++ b/plugins/WinVST/Chorus/Chorus.cpp @@ -27,12 +27,9 @@ Chorus::Chorus(audioMasterCallback audioMaster) : airEvenR = 0.0; airOddR = 0.0; airFactorR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Chorus/Chorus.h b/plugins/WinVST/Chorus/Chorus.h index fb2fb44..5508ac3 100755 --- a/plugins/WinVST/Chorus/Chorus.h +++ b/plugins/WinVST/Chorus/Chorus.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff const static int totalsamples = 16386; float dL[totalsamples]; @@ -73,6 +70,7 @@ private: double airEvenR; double airOddR; double airFactorR; + bool fpFlip; float A; float B; diff --git a/plugins/WinVST/Chorus/ChorusProc.cpp b/plugins/WinVST/Chorus/ChorusProc.cpp index aed2bc0..368ade7 100755 --- a/plugins/WinVST/Chorus/ChorusProc.cpp +++ b/plugins/WinVST/Chorus/ChorusProc.cpp @@ -30,9 +30,6 @@ void Chorus::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr double offset; //this is a double buffer so we will be splitting it in two - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -134,26 +131,16 @@ void Chorus::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 32 bit output + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -188,9 +175,6 @@ void Chorus::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double offset; //this is a double buffer so we will be splitting it in two - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -293,25 +277,17 @@ void Chorus::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither fpFlip = !fpFlip; - //end noise shaping on 64 bit output *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ChorusEnsemble/.vs/VSTProject/v14/.suo b/plugins/WinVST/ChorusEnsemble/.vs/VSTProject/v14/.suo Binary files differindex 169e939..f4a5693 100755 --- a/plugins/WinVST/ChorusEnsemble/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ChorusEnsemble/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.cpp b/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.cpp index b1012f9..318b678 100755 --- a/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.cpp +++ b/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.cpp @@ -27,12 +27,9 @@ ChorusEnsemble::ChorusEnsemble(audioMasterCallback audioMaster) : airEvenR = 0.0; airOddR = 0.0; airFactorR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.h b/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.h index bd442ab..e7df332 100755 --- a/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.h +++ b/plugins/WinVST/ChorusEnsemble/ChorusEnsemble.h @@ -67,12 +67,9 @@ private: double airEvenR; double airOddR; double airFactorR; - - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/ChorusEnsemble/ChorusEnsembleProc.cpp b/plugins/WinVST/ChorusEnsemble/ChorusEnsembleProc.cpp index 2a783dd..1663244 100755 --- a/plugins/WinVST/ChorusEnsemble/ChorusEnsembleProc.cpp +++ b/plugins/WinVST/ChorusEnsemble/ChorusEnsembleProc.cpp @@ -17,9 +17,6 @@ void ChorusEnsemble::processReplacing(float **inputs, float **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double speed = pow(A,3) * 0.001; speed *= overallscale; @@ -174,27 +171,17 @@ void ChorusEnsemble::processReplacing(float **inputs, float **outputs, VstInt32 inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } + fpFlip = !fpFlip; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -216,9 +203,6 @@ void ChorusEnsemble::processDoubleReplacing(double **inputs, double **outputs, V double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double speed = pow(A,3) * 0.001; speed *= overallscale; @@ -373,27 +357,19 @@ void ChorusEnsemble::processDoubleReplacing(double **inputs, double **outputs, V inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } + fpFlip = !fpFlip; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ClipOnly/.vs/VSTProject/v14/.suo b/plugins/WinVST/ClipOnly/.vs/VSTProject/v14/.suo Binary files differindex 0762d52..32dfba4 100755 --- a/plugins/WinVST/ClipOnly/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ClipOnly/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Console4Buss/.vs/VSTProject/v14/.suo b/plugins/WinVST/Console4Buss/.vs/VSTProject/v14/.suo Binary files differindex 82160f2..d8e035e 100755 --- a/plugins/WinVST/Console4Buss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Console4Buss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Console4Buss/Console4Buss.cpp b/plugins/WinVST/Console4Buss/Console4Buss.cpp index 79c7f6f..0c8e00c 100755 --- a/plugins/WinVST/Console4Buss/Console4Buss.cpp +++ b/plugins/WinVST/Console4Buss/Console4Buss.cpp @@ -22,11 +22,8 @@ Console4Buss::Console4Buss(audioMasterCallback audioMaster) : gainchase = -90.0; settingchase = -90.0; chasespeed = 350.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; // TODO: uncomment canDo entries according to your plugin's capabilities // _canDo.insert("sendVstEvents"); // plug-in will send Vst events to Host. diff --git a/plugins/WinVST/Console4Buss/Console4Buss.h b/plugins/WinVST/Console4Buss/Console4Buss.h index b19e6f2..9a9cbfb 100755 --- a/plugins/WinVST/Console4Buss/Console4Buss.h +++ b/plugins/WinVST/Console4Buss/Console4Buss.h @@ -71,11 +71,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - double fpNShapeLA; - double fpNShapeLB; - double fpNShapeRA; - double fpNShapeRB; - bool fpFlip; + double fpNShapeL; + double fpNShapeR; //default stuff double lastSampleL; double lastSampleR; diff --git a/plugins/WinVST/Console4Buss/Console4BussProc.cpp b/plugins/WinVST/Console4Buss/Console4BussProc.cpp index 712e496..dde872a 100755 --- a/plugins/WinVST/Console4Buss/Console4BussProc.cpp +++ b/plugins/WinVST/Console4Buss/Console4BussProc.cpp @@ -18,10 +18,6 @@ void Console4Buss::processReplacing(float **inputs, float **outputs, VstInt32 sa double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; - long double inputSampleL; long double inputSampleR; long double half; @@ -123,25 +119,14 @@ void Console4Buss::processReplacing(float **inputs, float **outputs, VstInt32 sa //this is the inverse processing for Console: boosts but not so much if there's slew. //is this too subtle an effect? - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -163,9 +148,6 @@ void Console4Buss::processDoubleReplacing(double **inputs, double **outputs, Vst double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -267,25 +249,16 @@ void Console4Buss::processDoubleReplacing(double **inputs, double **outputs, Vst //this is the inverse processing for Console: boosts but not so much if there's slew. //is this too subtle an effect? - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; diff --git a/plugins/WinVST/Console4Channel/.vs/VSTProject/v14/.suo b/plugins/WinVST/Console4Channel/.vs/VSTProject/v14/.suo Binary files differindex e9e8200..bec1667 100755 --- a/plugins/WinVST/Console4Channel/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Console4Channel/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Console4Channel/Console4Channel.cpp b/plugins/WinVST/Console4Channel/Console4Channel.cpp index 52f6190..2e524a1 100755 --- a/plugins/WinVST/Console4Channel/Console4Channel.cpp +++ b/plugins/WinVST/Console4Channel/Console4Channel.cpp @@ -20,11 +20,8 @@ Console4Channel::Console4Channel(audioMasterCallback audioMaster) : gainchase = -90.0; settingchase = -90.0; chasespeed = 350.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; // TODO: uncomment canDo entries according to your plugin's capabilities // _canDo.insert("sendVstEvents"); // plug-in will send Vst events to Host. diff --git a/plugins/WinVST/Console4Channel/Console4Channel.h b/plugins/WinVST/Console4Channel/Console4Channel.h index 861ebe3..564853a 100755 --- a/plugins/WinVST/Console4Channel/Console4Channel.h +++ b/plugins/WinVST/Console4Channel/Console4Channel.h @@ -76,11 +76,8 @@ private: double settingchase; double chasespeed; - double fpNShapeLA; - double fpNShapeLB; - double fpNShapeRA; - double fpNShapeRB; - bool fpFlip; + double fpNShapeL; + double fpNShapeR; //default stuff float gain; }; diff --git a/plugins/WinVST/Console4Channel/Console4ChannelProc.cpp b/plugins/WinVST/Console4Channel/Console4ChannelProc.cpp index 9bf7244..3538710 100755 --- a/plugins/WinVST/Console4Channel/Console4ChannelProc.cpp +++ b/plugins/WinVST/Console4Channel/Console4ChannelProc.cpp @@ -18,10 +18,6 @@ void Console4Channel::processReplacing(float **inputs, float **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; - long double inputSampleL; long double inputSampleR; long double half; @@ -105,25 +101,14 @@ void Console4Channel::processReplacing(float **inputs, float **outputs, VstInt32 //this is part of the Purest line: stuff that is on every track //needs to be DAMN LOW ON MATH srsly guys - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -145,9 +130,6 @@ void Console4Channel::processDoubleReplacing(double **inputs, double **outputs, double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -232,25 +214,16 @@ void Console4Channel::processDoubleReplacing(double **inputs, double **outputs, //this is part of the Purest line: stuff that is on every track //needs to be DAMN LOW ON MATH srsly guys - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Console5Buss/.vs/VSTProject/v14/.suo b/plugins/WinVST/Console5Buss/.vs/VSTProject/v14/.suo Binary files differindex f8fc15a..c5d83aa 100755 --- a/plugins/WinVST/Console5Buss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Console5Buss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Console5Buss/Console5Buss.cpp b/plugins/WinVST/Console5Buss/Console5Buss.cpp index 7f1c915..7e937a8 100755 --- a/plugins/WinVST/Console5Buss/Console5Buss.cpp +++ b/plugins/WinVST/Console5Buss/Console5Buss.cpp @@ -22,11 +22,8 @@ Console5Buss::Console5Buss(audioMasterCallback audioMaster) : gainchase = -90.0; settingchase = -90.0; chasespeed = 350.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Console5Buss/Console5Buss.h b/plugins/WinVST/Console5Buss/Console5Buss.h index 6ece284..0166f33 100755 --- a/plugins/WinVST/Console5Buss/Console5Buss.h +++ b/plugins/WinVST/Console5Buss/Console5Buss.h @@ -61,11 +61,8 @@ private: double gainchase; double settingchase; double chasespeed; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Console5Buss/Console5BussProc.cpp b/plugins/WinVST/Console5Buss/Console5BussProc.cpp index 28b4980..21069e8 100755 --- a/plugins/WinVST/Console5Buss/Console5BussProc.cpp +++ b/plugins/WinVST/Console5Buss/Console5BussProc.cpp @@ -17,9 +17,6 @@ void Console5Buss::processReplacing(float **inputs, float **outputs, VstInt32 sa double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double differenceL; @@ -151,25 +148,14 @@ void Console5Buss::processReplacing(float **inputs, float **outputs, VstInt32 sa lastFXBussR *= (1.0 - (nearZeroR * bassTrim)); //this cuts back the DC offset directly, relative to how near zero we are - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -191,9 +177,6 @@ void Console5Buss::processDoubleReplacing(double **inputs, double **outputs, Vst double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double differenceL; @@ -325,25 +308,16 @@ void Console5Buss::processDoubleReplacing(double **inputs, double **outputs, Vst lastFXBussR *= (1.0 - (nearZeroR * bassTrim)); //this cuts back the DC offset directly, relative to how near zero we are - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Console5Channel/.vs/VSTProject/v14/.suo b/plugins/WinVST/Console5Channel/.vs/VSTProject/v14/.suo Binary files differindex ac0d461..99d2ade 100755 --- a/plugins/WinVST/Console5Channel/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Console5Channel/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Console5Channel/Console5Channel.cpp b/plugins/WinVST/Console5Channel/Console5Channel.cpp index 9305bf4..1a8f6fb 100755 --- a/plugins/WinVST/Console5Channel/Console5Channel.cpp +++ b/plugins/WinVST/Console5Channel/Console5Channel.cpp @@ -22,11 +22,8 @@ Console5Channel::Console5Channel(audioMasterCallback audioMaster) : gainchase = -90.0; settingchase = -90.0; chasespeed = 350.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Console5Channel/Console5Channel.h b/plugins/WinVST/Console5Channel/Console5Channel.h index 59e7950..bbc58b3 100755 --- a/plugins/WinVST/Console5Channel/Console5Channel.h +++ b/plugins/WinVST/Console5Channel/Console5Channel.h @@ -61,11 +61,8 @@ private: double gainchase; double settingchase; double chasespeed; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Console5Channel/Console5ChannelProc.cpp b/plugins/WinVST/Console5Channel/Console5ChannelProc.cpp index 428e5e4..a010170 100755 --- a/plugins/WinVST/Console5Channel/Console5ChannelProc.cpp +++ b/plugins/WinVST/Console5Channel/Console5ChannelProc.cpp @@ -17,9 +17,6 @@ void Console5Channel::processReplacing(float **inputs, float **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double differenceL; @@ -152,25 +149,14 @@ void Console5Channel::processReplacing(float **inputs, float **outputs, VstInt32 inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -192,9 +178,6 @@ void Console5Channel::processDoubleReplacing(double **inputs, double **outputs, double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double differenceL; @@ -327,25 +310,16 @@ void Console5Channel::processDoubleReplacing(double **inputs, double **outputs, inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Console5DarkCh/.vs/VSTProject/v14/.suo b/plugins/WinVST/Console5DarkCh/.vs/VSTProject/v14/.suo Binary files differindex 1473e4d..4564e3b 100755 --- a/plugins/WinVST/Console5DarkCh/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Console5DarkCh/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Console5DarkCh/Console5DarkCh.cpp b/plugins/WinVST/Console5DarkCh/Console5DarkCh.cpp index 0d613a9..350a6b3 100755 --- a/plugins/WinVST/Console5DarkCh/Console5DarkCh.cpp +++ b/plugins/WinVST/Console5DarkCh/Console5DarkCh.cpp @@ -22,11 +22,8 @@ Console5DarkCh::Console5DarkCh(audioMasterCallback audioMaster) : gainchase = -90.0; settingchase = -90.0; chasespeed = 350.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Console5DarkCh/Console5DarkCh.h b/plugins/WinVST/Console5DarkCh/Console5DarkCh.h index 558e4f7..3265f5c 100755 --- a/plugins/WinVST/Console5DarkCh/Console5DarkCh.h +++ b/plugins/WinVST/Console5DarkCh/Console5DarkCh.h @@ -61,11 +61,8 @@ private: double gainchase; double settingchase; double chasespeed; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Console5DarkCh/Console5DarkChProc.cpp b/plugins/WinVST/Console5DarkCh/Console5DarkChProc.cpp index e17ff88c..ba3a842 100755 --- a/plugins/WinVST/Console5DarkCh/Console5DarkChProc.cpp +++ b/plugins/WinVST/Console5DarkCh/Console5DarkChProc.cpp @@ -17,9 +17,6 @@ void Console5DarkCh::processReplacing(float **inputs, float **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double differenceL; @@ -152,25 +149,14 @@ void Console5DarkCh::processReplacing(float **inputs, float **outputs, VstInt32 inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -192,9 +178,6 @@ void Console5DarkCh::processDoubleReplacing(double **inputs, double **outputs, V double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double differenceL; @@ -327,25 +310,16 @@ void Console5DarkCh::processDoubleReplacing(double **inputs, double **outputs, V inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/CrunchyGrooveWear/.vs/VSTProject/v14/.suo b/plugins/WinVST/CrunchyGrooveWear/.vs/VSTProject/v14/.suo Binary files differindex df12eeb..8e47c8f 100755 --- a/plugins/WinVST/CrunchyGrooveWear/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/CrunchyGrooveWear/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.cpp b/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.cpp index 68a7fd9..6653b91 100755 --- a/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.cpp +++ b/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.cpp @@ -36,11 +36,8 @@ CrunchyGrooveWear::CrunchyGrooveWear(audioMasterCallback audioMaster) : cMidPrevR = 0.0; dMidPrevR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.h b/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.h index ed304c5..3489e5b 100755 --- a/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.h +++ b/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWear.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double aMidL[21]; diff --git a/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWearProc.cpp b/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWearProc.cpp index 4eec93e..3c9762e 100755 --- a/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWearProc.cpp +++ b/plugins/WinVST/CrunchyGrooveWear/CrunchyGrooveWearProc.cpp @@ -14,9 +14,6 @@ void CrunchyGrooveWear::processReplacing(float **inputs, float **outputs, VstInt float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double overallscale = (pow(A,2)*19.0)+1.0; double gain = overallscale; @@ -434,25 +431,14 @@ void CrunchyGrooveWear::processReplacing(float **inputs, float **outputs, VstInt drySampleR = inputSampleR; } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -471,9 +457,6 @@ void CrunchyGrooveWear::processDoubleReplacing(double **inputs, double **outputs double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double overallscale = (pow(A,2)*19.0)+1.0; double gain = overallscale; @@ -891,25 +874,16 @@ void CrunchyGrooveWear::processDoubleReplacing(double **inputs, double **outputs drySampleR = inputSampleR; } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Crystal/.vs/VSTProject/v14/.suo b/plugins/WinVST/Crystal/.vs/VSTProject/v14/.suo Binary files differindex 3842fd5..5f8b648 100755 --- a/plugins/WinVST/Crystal/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Crystal/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Crystal/CrystalProc.cpp b/plugins/WinVST/Crystal/CrystalProc.cpp index 9c62355..7e696a7 100755 --- a/plugins/WinVST/Crystal/CrystalProc.cpp +++ b/plugins/WinVST/Crystal/CrystalProc.cpp @@ -191,18 +191,14 @@ void Crystal::processReplacing(float **inputs, float **outputs, VstInt32 sampleF //when current and old samples are different from each other, otherwise you can't tell it's there. //This is not only during silence but the tops of low frequency waves: it scales down to affect lows more gently. - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -212,12 +208,6 @@ void Crystal::processReplacing(float **inputs, float **outputs, VstInt32 sampleF *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Crystal::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -404,18 +394,16 @@ void Crystal::processDoubleReplacing(double **inputs, double **outputs, VstInt32 //when current and old samples are different from each other, otherwise you can't tell it's there. //This is not only during silence but the tops of low frequency waves: it scales down to affect lows more gently. - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -425,10 +413,4 @@ void Crystal::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/DeEss/.vs/VSTProject/v14/.suo b/plugins/WinVST/DeEss/.vs/VSTProject/v14/.suo Binary files differindex bf3a84e..1c15f88 100755 --- a/plugins/WinVST/DeEss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/DeEss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/DeEss/DeEssProc.cpp b/plugins/WinVST/DeEss/DeEssProc.cpp index 9a8e14b..9b030a4 100755 --- a/plugins/WinVST/DeEss/DeEssProc.cpp +++ b/plugins/WinVST/DeEss/DeEssProc.cpp @@ -148,18 +148,14 @@ void DeEss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra flip = !flip; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -169,12 +165,6 @@ void DeEss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void DeEss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -318,18 +308,16 @@ void DeEss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s flip = !flip; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -339,10 +327,4 @@ void DeEss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/DeRez/.vs/VSTProject/v14/.suo b/plugins/WinVST/DeRez/.vs/VSTProject/v14/.suo Binary files differindex 681434c..e083369 100755 --- a/plugins/WinVST/DeRez/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/DeRez/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/DeRez/DeRez.cpp b/plugins/WinVST/DeRez/DeRez.cpp index 404127a..cb9b514 100755 --- a/plugins/WinVST/DeRez/DeRez.cpp +++ b/plugins/WinVST/DeRez/DeRez.cpp @@ -23,11 +23,8 @@ DeRez::DeRez(audioMasterCallback audioMaster) : incrementA = 0.0; incrementB = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/DeRez/DeRez.h b/plugins/WinVST/DeRez/DeRez.h index 89338e8..8ebdcd9 100755 --- a/plugins/WinVST/DeRez/DeRez.h +++ b/plugins/WinVST/DeRez/DeRez.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastSampleL; diff --git a/plugins/WinVST/DeRez/DeRezProc.cpp b/plugins/WinVST/DeRez/DeRezProc.cpp index 247a364..cbe42d5 100755 --- a/plugins/WinVST/DeRez/DeRezProc.cpp +++ b/plugins/WinVST/DeRez/DeRezProc.cpp @@ -17,8 +17,6 @@ void DeRez::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double targetA = pow(A,3)+0.0005; if (targetA > 1.0) targetA = 1.0; @@ -132,26 +130,14 @@ void DeRez::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra lastSampleL = drySampleL; lastSampleR = drySampleR; - //noise shaping to 32-bit floating point - float fpTemp; - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -173,8 +159,6 @@ void DeRez::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double targetA = pow(A,3)+0.0005; if (targetA > 1.0) targetA = 1.0; @@ -288,26 +272,16 @@ void DeRez::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s lastSampleL = drySampleL; lastSampleR = drySampleR; - //noise shaping to 64-bit floating point - double fpTemp; - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Density/.vs/VSTProject/v14/.suo b/plugins/WinVST/Density/.vs/VSTProject/v14/.suo Binary files differindex ac31fc9..2a612b7 100755 --- a/plugins/WinVST/Density/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Density/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Density/Density.cpp b/plugins/WinVST/Density/Density.cpp index 1ecafde..bac4fb2 100755 --- a/plugins/WinVST/Density/Density.cpp +++ b/plugins/WinVST/Density/Density.cpp @@ -20,12 +20,9 @@ Density::Density(audioMasterCallback audioMaster) : iirSampleBL = 0.0; iirSampleAR = 0.0; iirSampleBR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Density/Density.h b/plugins/WinVST/Density/Density.h index 377d25d..b634c44 100755 --- a/plugins/WinVST/Density/Density.h +++ b/plugins/WinVST/Density/Density.h @@ -55,17 +55,14 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double iirSampleAL; double iirSampleBL; double iirSampleAR; double iirSampleBR; - + bool fpFlip; float A; float B; float C; diff --git a/plugins/WinVST/Density/DensityProc.cpp b/plugins/WinVST/Density/DensityProc.cpp index 1e968c7..f229a9d 100755 --- a/plugins/WinVST/Density/DensityProc.cpp +++ b/plugins/WinVST/Density/DensityProc.cpp @@ -26,9 +26,6 @@ void Density::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double out = fabs(density); density = density * fabs(density); double count; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -95,6 +92,7 @@ void Density::processReplacing(float **inputs, float **outputs, VstInt32 sampleF inputSampleR -= iirSampleBR; } //highpass section + fpFlip = !fpFlip; count = density; while (count > 1.0) @@ -150,25 +148,14 @@ void Density::processReplacing(float **inputs, float **outputs, VstInt32 sampleF //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -199,9 +186,6 @@ void Density::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double out = fabs(density); density = density * fabs(density); double count; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -268,6 +252,7 @@ void Density::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR -= iirSampleBR; } //highpass section + fpFlip = !fpFlip; count = density; while (count > 1.0) @@ -323,25 +308,16 @@ void Density::processDoubleReplacing(double **inputs, double **outputs, VstInt32 //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Desk/.vs/VSTProject/v14/.suo b/plugins/WinVST/Desk/.vs/VSTProject/v14/.suo Binary files differindex 9006873..8229c47 100755 --- a/plugins/WinVST/Desk/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Desk/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Desk/Desk.cpp b/plugins/WinVST/Desk/Desk.cpp index 7a30943..9582f04 100755 --- a/plugins/WinVST/Desk/Desk.cpp +++ b/plugins/WinVST/Desk/Desk.cpp @@ -18,11 +18,8 @@ Desk::Desk(audioMasterCallback audioMaster) : lastSampleR = 0.0; lastOutSampleR = 0.0; lastSlewR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Desk/Desk.h b/plugins/WinVST/Desk/Desk.h index 8c5c398..f7f933d 100755 --- a/plugins/WinVST/Desk/Desk.h +++ b/plugins/WinVST/Desk/Desk.h @@ -51,11 +51,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff long double lastSampleL; diff --git a/plugins/WinVST/Desk/DeskProc.cpp b/plugins/WinVST/Desk/DeskProc.cpp index a2bc92c..d53894b 100755 --- a/plugins/WinVST/Desk/DeskProc.cpp +++ b/plugins/WinVST/Desk/DeskProc.cpp @@ -29,9 +29,6 @@ void Desk::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram double bridgerectifier; double combsample; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -151,25 +148,14 @@ void Desk::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram inputSampleR /= gain; //end R - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -203,9 +189,6 @@ void Desk::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa double bridgerectifier; double combsample; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -325,25 +308,16 @@ void Desk::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa inputSampleR /= gain; //end R - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Desk4/.vs/VSTProject/v14/.suo b/plugins/WinVST/Desk4/.vs/VSTProject/v14/.suo Binary files differindex a020b8d..9fc65de 100755 --- a/plugins/WinVST/Desk4/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Desk4/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Desk4/Desk4.cpp b/plugins/WinVST/Desk4/Desk4.cpp index a8e20a7..0a05d87 100755 --- a/plugins/WinVST/Desk4/Desk4.cpp +++ b/plugins/WinVST/Desk4/Desk4.cpp @@ -30,11 +30,8 @@ Desk4::Desk4(audioMasterCallback audioMaster) : lastSlewR = 0.0; gcount = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Desk4/Desk4.h b/plugins/WinVST/Desk4/Desk4.h index fa09cd0..802ee47 100755 --- a/plugins/WinVST/Desk4/Desk4.h +++ b/plugins/WinVST/Desk4/Desk4.h @@ -70,11 +70,8 @@ private: double lastSlewR; int gcount; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Desk4/Desk4Proc.cpp b/plugins/WinVST/Desk4/Desk4Proc.cpp index 515436c..fd165b6 100755 --- a/plugins/WinVST/Desk4/Desk4Proc.cpp +++ b/plugins/WinVST/Desk4/Desk4Proc.cpp @@ -17,9 +17,6 @@ void Desk4::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double gain = (pow(A,2)*10)+0.0001; double gaintrim = (pow(A,2)*2)+1.0; @@ -229,25 +226,14 @@ void Desk4::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -269,9 +255,6 @@ void Desk4::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double gain = (pow(A,2)*10)+0.0001; double gaintrim = (pow(A,2)*2)+1.0; @@ -481,25 +464,16 @@ void Desk4::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Distance/.vs/VSTProject/v14/.suo b/plugins/WinVST/Distance/.vs/VSTProject/v14/.suo Binary files differindex 4359323..8d82790 100755 --- a/plugins/WinVST/Distance/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Distance/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Distance/Distance.cpp b/plugins/WinVST/Distance/Distance.cpp index bae55c1..7ccd8fb 100755 --- a/plugins/WinVST/Distance/Distance.cpp +++ b/plugins/WinVST/Distance/Distance.cpp @@ -16,11 +16,8 @@ Distance::Distance(audioMasterCallback audioMaster) : B = 1.0; thirdresultL = prevresultL = lastclampL = clampL = changeL = lastL = 0.0; thirdresultR = prevresultR = lastclampR = clampR = changeR = lastR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Distance/Distance.h b/plugins/WinVST/Distance/Distance.h index 52ecc14..5566f84 100755 --- a/plugins/WinVST/Distance/Distance.h +++ b/plugins/WinVST/Distance/Distance.h @@ -67,11 +67,8 @@ private: double prevresultR; double lastR; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Distance/DistanceProc.cpp b/plugins/WinVST/Distance/DistanceProc.cpp index bdf3c13..32eb3fa 100755 --- a/plugins/WinVST/Distance/DistanceProc.cpp +++ b/plugins/WinVST/Distance/DistanceProc.cpp @@ -28,9 +28,6 @@ void Distance::processReplacing(float **inputs, float **outputs, VstInt32 sample double dry = 1.0-wet; double bridgerectifier; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double drySampleL; @@ -126,25 +123,14 @@ void Distance::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (drySampleR * dry)+(inputSampleR*wet); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -177,9 +163,6 @@ void Distance::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double dry = 1.0-wet; double bridgerectifier; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double drySampleL; @@ -275,25 +258,16 @@ void Distance::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (drySampleR * dry)+(inputSampleR*wet); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Distance2/.vs/VSTProject/v14/.suo b/plugins/WinVST/Distance2/.vs/VSTProject/v14/.suo Binary files differindex a329e77..aee132b 100755 --- a/plugins/WinVST/Distance2/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Distance2/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Distance2/Distance2Proc.cpp b/plugins/WinVST/Distance2/Distance2Proc.cpp index ef5bf5b..473f3c8 100755 --- a/plugins/WinVST/Distance2/Distance2Proc.cpp +++ b/plugins/WinVST/Distance2/Distance2Proc.cpp @@ -266,18 +266,14 @@ void Distance2::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -287,12 +283,6 @@ void Distance2::processReplacing(float **inputs, float **outputs, VstInt32 sampl *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Distance2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -554,18 +544,16 @@ void Distance2::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -575,10 +563,4 @@ void Distance2::processDoubleReplacing(double **inputs, double **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/DitherFloat/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/DitherFloat/.vs/Console4Channel64/v14/.suo Binary files differnew file mode 100755 index 0000000..777b846 --- /dev/null +++ b/plugins/WinVST/DitherFloat/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/DitherFloat/.vs/VSTProject/v14/.suo b/plugins/WinVST/DitherFloat/.vs/VSTProject/v14/.suo Binary files differnew file mode 100755 index 0000000..7cd8028 --- /dev/null +++ b/plugins/WinVST/DitherFloat/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/DitherFloat/DitherFloat.cpp b/plugins/WinVST/DitherFloat/DitherFloat.cpp new file mode 100755 index 0000000..ffd9e94 --- /dev/null +++ b/plugins/WinVST/DitherFloat/DitherFloat.cpp @@ -0,0 +1,127 @@ +/* ======================================== + * DitherFloat - DitherFloat.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __DitherFloat_H +#include "DitherFloat.h" +#endif + +AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new DitherFloat(audioMaster);} + +DitherFloat::DitherFloat(audioMasterCallback audioMaster) : + AudioEffectX(audioMaster, kNumPrograms, kNumParameters) +{ + A = 0.0; + B = 1.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; + //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 +} + +DitherFloat::~DitherFloat() {} +VstInt32 DitherFloat::getVendorVersion () {return 1000;} +void DitherFloat::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);} +void DitherFloat::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 DitherFloat::getChunk (void** data, bool isPreset) +{ + float *chunkData = (float *)calloc(kNumParameters, sizeof(float)); + chunkData[0] = A; + chunkData[1] = B; + /* 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 DitherFloat::setChunk (void* data, VstInt32 byteSize, bool isPreset) +{ + float *chunkData = (float *)data; + A = pinParameter(chunkData[0]); + B = pinParameter(chunkData[1]); + /* 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 DitherFloat::setParameter(VstInt32 index, float value) { + switch (index) { + case kParamA: A = value; break; + case kParamB: B = value; break; + default: throw; // unknown parameter, shouldn't happen! + } +} + +float DitherFloat::getParameter(VstInt32 index) { + switch (index) { + case kParamA: return A; break; + case kParamB: return B; 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 DitherFloat::getParameterName(VstInt32 index, char *text) { + switch (index) { + case kParamA: vst_strncpy (text, "Offset", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } //this is our labels for displaying in the VST host +} + +void DitherFloat::getParameterDisplay(VstInt32 index, char *text) { + switch (index) { + case kParamA: int2string ((VstInt32)(A * 32), text, kVstMaxParamStrLen); break; + case kParamB: float2string (B, text, kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } //this displays the values and handles 'popups' where it's discrete choices +} + +void DitherFloat::getParameterLabel(VstInt32 index, char *text) { + switch (index) { + case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } +} + +VstInt32 DitherFloat::canDo(char *text) +{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know + +bool DitherFloat::getEffectName(char* name) { + vst_strncpy(name, "DitherFloat", kVstMaxProductStrLen); return true; +} + +VstPlugCategory DitherFloat::getPlugCategory() {return kPlugCategEffect;} + +bool DitherFloat::getProductString(char* text) { + vst_strncpy (text, "airwindows DitherFloat", kVstMaxProductStrLen); return true; +} + +bool DitherFloat::getVendorString(char* text) { + vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true; +} diff --git a/plugins/WinVST/DitherFloat/DitherFloat.h b/plugins/WinVST/DitherFloat/DitherFloat.h new file mode 100755 index 0000000..b8ddf51 --- /dev/null +++ b/plugins/WinVST/DitherFloat/DitherFloat.h @@ -0,0 +1,64 @@ +/* ======================================== + * DitherFloat - DitherFloat.h + * Created 8/12/11 by SPIAdmin + * Copyright (c) 2011 __MyCompanyName__, All rights reserved + * ======================================== */ + +#ifndef __DitherFloat_H +#define __DitherFloat_H + +#ifndef __audioeffect__ +#include "audioeffectx.h" +#endif + +#include <set> +#include <string> +#include <math.h> + +enum { + kParamA = 0, + kParamB = 1, + kNumParameters = 2 +}; // + +const int kNumPrograms = 0; +const int kNumInputs = 2; +const int kNumOutputs = 2; +const unsigned long kUniqueId = 'dthf'; //Change this to what the AU identity is! + +class DitherFloat : + public AudioEffectX +{ +public: + DitherFloat(audioMasterCallback audioMaster); + ~DitherFloat(); + 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; + + long double fpNShapeL; + long double fpNShapeR; + //default stuff + + float A; + float B; +}; + +#endif diff --git a/plugins/WinVST/DitherFloat/DitherFloatProc.cpp b/plugins/WinVST/DitherFloat/DitherFloatProc.cpp new file mode 100755 index 0000000..3c76a1a --- /dev/null +++ b/plugins/WinVST/DitherFloat/DitherFloatProc.cpp @@ -0,0 +1,184 @@ +/* ======================================== + * DitherFloat - DitherFloat.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __DitherFloat_H +#include "DitherFloat.h" +#endif + +void DitherFloat::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(); + + int floatOffset = (A * 32); + long double blend = B; + + long double gain = 0; + + switch (floatOffset) + { + case 0: gain = 1.0; break; + case 1: gain = 2.0; break; + case 2: gain = 4.0; break; + case 3: gain = 8.0; break; + case 4: gain = 16.0; break; + case 5: gain = 32.0; break; + case 6: gain = 64.0; break; + case 7: gain = 128.0; break; + case 8: gain = 256.0; break; + case 9: gain = 512.0; break; + case 10: gain = 1024.0; break; + case 11: gain = 2048.0; break; + case 12: gain = 4096.0; break; + case 13: gain = 8192.0; break; + case 14: gain = 16384.0; break; + case 15: gain = 32768.0; break; + case 16: gain = 65536.0; break; + case 17: gain = 131072.0; break; + case 18: gain = 262144.0; break; + case 19: gain = 524288.0; break; + case 20: gain = 1048576.0; break; + case 21: gain = 2097152.0; break; + case 22: gain = 4194304.0; break; + case 23: gain = 8388608.0; break; + case 24: gain = 16777216.0; break; + case 25: gain = 33554432.0; break; + case 26: gain = 67108864.0; break; + case 27: gain = 134217728.0; break; + case 28: gain = 268435456.0; break; + case 29: gain = 536870912.0; break; + case 30: gain = 1073741824.0; break; + case 31: gain = 2147483648.0; break; + case 32: gain = 4294967296.0; break; + } + //we are directly punching in the gain values rather than calculating them + + while (--sampleFrames >= 0) + { + long double inputSampleL = *in1 + (gain-1); + long double inputSampleR = *in2 + (gain-1); + + + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither + + + + inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point + inputSampleR = (float)inputSampleR; //equivalent of 'floor' for 32 bit floating point + //We do that separately, we're truncating to floating point WHILE heavily offset. + + *out1 = inputSampleL - (gain-1); + *out2 = inputSampleR - (gain-1); + + *in1++; + *in2++; + *out1++; + *out2++; + } +} + +void DitherFloat::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(); + + int floatOffset = (A * 32); + long double blend = B; + + long double gain = 0; + + switch (floatOffset) + { + case 0: gain = 1.0; break; + case 1: gain = 2.0; break; + case 2: gain = 4.0; break; + case 3: gain = 8.0; break; + case 4: gain = 16.0; break; + case 5: gain = 32.0; break; + case 6: gain = 64.0; break; + case 7: gain = 128.0; break; + case 8: gain = 256.0; break; + case 9: gain = 512.0; break; + case 10: gain = 1024.0; break; + case 11: gain = 2048.0; break; + case 12: gain = 4096.0; break; + case 13: gain = 8192.0; break; + case 14: gain = 16384.0; break; + case 15: gain = 32768.0; break; + case 16: gain = 65536.0; break; + case 17: gain = 131072.0; break; + case 18: gain = 262144.0; break; + case 19: gain = 524288.0; break; + case 20: gain = 1048576.0; break; + case 21: gain = 2097152.0; break; + case 22: gain = 4194304.0; break; + case 23: gain = 8388608.0; break; + case 24: gain = 16777216.0; break; + case 25: gain = 33554432.0; break; + case 26: gain = 67108864.0; break; + case 27: gain = 134217728.0; break; + case 28: gain = 268435456.0; break; + case 29: gain = 536870912.0; break; + case 30: gain = 1073741824.0; break; + case 31: gain = 2147483648.0; break; + case 32: gain = 4294967296.0; break; + } + //we are directly punching in the gain values rather than calculating them + + while (--sampleFrames >= 0) + { + long double inputSampleL = *in1 + (gain-1); + long double inputSampleR = *in2 + (gain-1); + + + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither + + + + inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point + inputSampleR = (float)inputSampleR; //equivalent of 'floor' for 32 bit floating point + //We do that separately, we're truncating to floating point WHILE heavily offset. + + //note for 64 bit version: this is not for actually dithering 64 bit floats! + //This is specifically for demonstrating the sound of 32 bit floating point dither + //even over a 64 bit buss. Therefore it should be using float, above! + + *out1 = inputSampleL - (gain-1); + *out2 = inputSampleR - (gain-1); + + *in1++; + *in2++; + *out1++; + *out2++; + } +} diff --git a/plugins/WinVST/GrooveWear/VSTProject.sln b/plugins/WinVST/DitherFloat/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/GrooveWear/VSTProject.sln +++ b/plugins/WinVST/DitherFloat/VSTProject.sln diff --git a/plugins/WinVST/DitherFloat/VSTProject.vcxproj b/plugins/WinVST/DitherFloat/VSTProject.vcxproj new file mode 100755 index 0000000..388624d --- /dev/null +++ b/plugins/WinVST/DitherFloat/VSTProject.vcxproj @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.cpp" />
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.cpp" />
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\vstplugmain.cpp" />
+ <ClCompile Include="DitherFloat.cpp" />
+ <ClCompile Include="DitherFloatProc.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\aeffeditor.h" />
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.h" />
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.h" />
+ <ClInclude Include="DitherFloat.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{16F7AB3C-1AE0-4574-B60C-7B4DED82938C}</ProjectGuid>
+ <RootNamespace>VSTProject</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ <ProjectName>DitherFloat64</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;libc.lib;libcd.lib;libcmt.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;libc.lib;libcd.lib;libcmt.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/WinVST/DitherFloat/VSTProject.vcxproj.filters b/plugins/WinVST/DitherFloat/VSTProject.vcxproj.filters new file mode 100755 index 0000000..fb1260a --- /dev/null +++ b/plugins/WinVST/DitherFloat/VSTProject.vcxproj.filters @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\vstplugmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="DitherFloat.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="DitherFloatProc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\aeffeditor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="DitherFloat.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/WinVST/DitherFloat/VSTProject.vcxproj.user b/plugins/WinVST/DitherFloat/VSTProject.vcxproj.user new file mode 100755 index 0000000..2216267 --- /dev/null +++ b/plugins/WinVST/DitherFloat/VSTProject.vcxproj.user @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/WinVST/DitherFloat/vstplug.def b/plugins/WinVST/DitherFloat/vstplug.def new file mode 100755 index 0000000..5bf499a --- /dev/null +++ b/plugins/WinVST/DitherFloat/vstplug.def @@ -0,0 +1,3 @@ +EXPORTS
+ VSTPluginMain
+ main=VSTPluginMain
\ No newline at end of file diff --git a/plugins/WinVST/Drive/.vs/VSTProject/v14/.suo b/plugins/WinVST/Drive/.vs/VSTProject/v14/.suo Binary files differindex da1c31d..7c0342c 100755 --- a/plugins/WinVST/Drive/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Drive/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Drive/Drive.cpp b/plugins/WinVST/Drive/Drive.cpp index 35d0594..ac5f228 100755 --- a/plugins/WinVST/Drive/Drive.cpp +++ b/plugins/WinVST/Drive/Drive.cpp @@ -20,12 +20,9 @@ Drive::Drive(audioMasterCallback audioMaster) : iirSampleBL = 0.0; iirSampleAR = 0.0; iirSampleBR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Drive/Drive.h b/plugins/WinVST/Drive/Drive.h index c7039c5..525a09e 100755 --- a/plugins/WinVST/Drive/Drive.h +++ b/plugins/WinVST/Drive/Drive.h @@ -55,17 +55,14 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double iirSampleAL; double iirSampleBL; double iirSampleAR; double iirSampleBR; - + bool fpFlip; float A; float B; float C; diff --git a/plugins/WinVST/Drive/DriveProc.cpp b/plugins/WinVST/Drive/DriveProc.cpp index 3670e85..074ccfd 100755 --- a/plugins/WinVST/Drive/DriveProc.cpp +++ b/plugins/WinVST/Drive/DriveProc.cpp @@ -26,9 +26,6 @@ void Drive::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double glitch = 0.60; double out; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -95,6 +92,7 @@ void Drive::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleR -= iirSampleBR; } //highpass section + fpFlip = !fpFlip; if (inputSampleL > 1.0) inputSampleL = 1.0; @@ -129,25 +127,14 @@ void Drive::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -178,9 +165,6 @@ void Drive::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double glitch = 0.60; double out; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -247,6 +231,7 @@ void Drive::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleR -= iirSampleBR; } //highpass section + fpFlip = !fpFlip; if (inputSampleL > 1.0) inputSampleL = 1.0; @@ -281,25 +266,16 @@ void Drive::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/DrumSlam/.vs/VSTProject/v14/.suo b/plugins/WinVST/DrumSlam/.vs/VSTProject/v14/.suo Binary files differindex a2b66ba..b712621 100755 --- a/plugins/WinVST/DrumSlam/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/DrumSlam/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/DrumSlam/DrumSlam.cpp b/plugins/WinVST/DrumSlam/DrumSlam.cpp index 8a6ae7b..5b88619 100755 --- a/plugins/WinVST/DrumSlam/DrumSlam.cpp +++ b/plugins/WinVST/DrumSlam/DrumSlam.cpp @@ -35,12 +35,9 @@ DrumSlam::DrumSlam(audioMasterCallback audioMaster) : iirSampleGR = 0.0; iirSampleHR = 0.0; lastSampleR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/DrumSlam/DrumSlam.h b/plugins/WinVST/DrumSlam/DrumSlam.h index 5ec2fda..418282d 100755 --- a/plugins/WinVST/DrumSlam/DrumSlam.h +++ b/plugins/WinVST/DrumSlam/DrumSlam.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double iirSampleAL; @@ -80,7 +77,7 @@ private: double iirSampleGR; double iirSampleHR; double lastSampleR; - + bool fpFlip; float A; float B; float C; diff --git a/plugins/WinVST/DrumSlam/DrumSlamProc.cpp b/plugins/WinVST/DrumSlam/DrumSlamProc.cpp index 171b353..2e86142 100755 --- a/plugins/WinVST/DrumSlam/DrumSlamProc.cpp +++ b/plugins/WinVST/DrumSlam/DrumSlamProc.cpp @@ -25,8 +25,6 @@ void DrumSlam::processReplacing(float **inputs, float **outputs, VstInt32 sample double out = B; double wet = C; double dry = 1.0 - wet; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -125,6 +123,8 @@ void DrumSlam::processReplacing(float **inputs, float **outputs, VstInt32 sample highSampleL = inputSampleL - iirSampleHL; highSampleR = inputSampleR - iirSampleHR; } + fpFlip = !fpFlip; + //generate the tone bands we're using if (lowSampleL > 1.0) {lowSampleL = 1.0;} if (lowSampleL < -1.0) {lowSampleL = -1.0;} @@ -219,26 +219,14 @@ void DrumSlam::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp; - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -268,8 +256,6 @@ void DrumSlam::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double out = B; double wet = C; double dry = 1.0 - wet; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -368,6 +354,8 @@ void DrumSlam::processDoubleReplacing(double **inputs, double **outputs, VstInt3 highSampleL = inputSampleL - iirSampleHL; highSampleR = inputSampleR - iirSampleHR; } + fpFlip = !fpFlip; + //generate the tone bands we're using if (lowSampleL > 1.0) {lowSampleL = 1.0;} if (lowSampleL < -1.0) {lowSampleL = -1.0;} @@ -462,26 +450,16 @@ void DrumSlam::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp; - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/DubCenter/.vs/VSTProject/v14/.suo b/plugins/WinVST/DubCenter/.vs/VSTProject/v14/.suo Binary files differindex 2d55292..78d0cd5 100755 --- a/plugins/WinVST/DubCenter/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/DubCenter/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/DubCenter/DubCenterProc.cpp b/plugins/WinVST/DubCenter/DubCenterProc.cpp index 75c162b..b0c49a3 100755 --- a/plugins/WinVST/DubCenter/DubCenterProc.cpp +++ b/plugins/WinVST/DubCenter/DubCenterProc.cpp @@ -306,18 +306,14 @@ void DubCenter::processReplacing(float **inputs, float **outputs, VstInt32 sampl bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -327,12 +323,6 @@ void DubCenter::processReplacing(float **inputs, float **outputs, VstInt32 sampl *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void DubCenter::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -633,18 +623,16 @@ void DubCenter::processDoubleReplacing(double **inputs, double **outputs, VstInt bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -654,10 +642,4 @@ void DubCenter::processDoubleReplacing(double **inputs, double **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/DubSub/.vs/VSTProject/v14/.suo b/plugins/WinVST/DubSub/.vs/VSTProject/v14/.suo Binary files differindex 0e2fce9..f7f4fd6 100755 --- a/plugins/WinVST/DubSub/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/DubSub/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/DubSub/DubSubProc.cpp b/plugins/WinVST/DubSub/DubSubProc.cpp index 037480c..7a0349d 100755 --- a/plugins/WinVST/DubSub/DubSubProc.cpp +++ b/plugins/WinVST/DubSub/DubSubProc.cpp @@ -392,18 +392,14 @@ void DubSub::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -413,12 +409,6 @@ void DubSub::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void DubSub::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -805,18 +795,16 @@ void DubSub::processDoubleReplacing(double **inputs, double **outputs, VstInt32 bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -826,10 +814,4 @@ void DubSub::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/DustBunny/.vs/VSTProject/v14/.suo b/plugins/WinVST/DustBunny/.vs/VSTProject/v14/.suo Binary files differindex 03ccec9..020c7ad 100755 --- a/plugins/WinVST/DustBunny/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/DustBunny/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/EQ/.vs/VSTProject/v14/.suo b/plugins/WinVST/EQ/.vs/VSTProject/v14/.suo Binary files differindex faccb3d..fec6949 100755 --- a/plugins/WinVST/EQ/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/EQ/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/EQ/EQ.cpp b/plugins/WinVST/EQ/EQ.cpp index ebdadaa..f2e4e01 100755 --- a/plugins/WinVST/EQ/EQ.cpp +++ b/plugins/WinVST/EQ/EQ.cpp @@ -111,11 +111,8 @@ EQ::EQ(audioMasterCallback audioMaster) : flip = false; flipthree = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/EQ/EQ.h b/plugins/WinVST/EQ/EQ.h index 4317a2d..26fade4 100755 --- a/plugins/WinVST/EQ/EQ.h +++ b/plugins/WinVST/EQ/EQ.h @@ -59,11 +59,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastSampleL; diff --git a/plugins/WinVST/EQ/EQProc.cpp b/plugins/WinVST/EQ/EQProc.cpp index 6d994a9..917dc7e 100755 --- a/plugins/WinVST/EQ/EQProc.cpp +++ b/plugins/WinVST/EQ/EQProc.cpp @@ -20,9 +20,6 @@ void EQ::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -434,25 +431,14 @@ void EQ::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames inputSampleR *= outputgain; } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -477,9 +463,6 @@ void EQ::processDoubleReplacing(double **inputs, double **outputs, VstInt32 samp overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -891,25 +874,16 @@ void EQ::processDoubleReplacing(double **inputs, double **outputs, VstInt32 samp inputSampleR *= outputgain; } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/EdIsDim/.vs/VSTProject/v14/.suo b/plugins/WinVST/EdIsDim/.vs/VSTProject/v14/.suo Binary files differindex d170019..bcd75a3 100755 --- a/plugins/WinVST/EdIsDim/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/EdIsDim/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/EdIsDim/EdIsDim.cpp b/plugins/WinVST/EdIsDim/EdIsDim.cpp index 6af5dd4..eb6abd3 100755 --- a/plugins/WinVST/EdIsDim/EdIsDim.cpp +++ b/plugins/WinVST/EdIsDim/EdIsDim.cpp @@ -13,11 +13,8 @@ EdIsDim::EdIsDim(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { A = 0.5; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/EdIsDim/EdIsDim.h b/plugins/WinVST/EdIsDim/EdIsDim.h index 8c51883..4f62705 100755 --- a/plugins/WinVST/EdIsDim/EdIsDim.h +++ b/plugins/WinVST/EdIsDim/EdIsDim.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/EdIsDim/EdIsDimProc.cpp b/plugins/WinVST/EdIsDim/EdIsDimProc.cpp index 8ee927d..0d033eb 100755 --- a/plugins/WinVST/EdIsDim/EdIsDimProc.cpp +++ b/plugins/WinVST/EdIsDim/EdIsDimProc.cpp @@ -14,9 +14,6 @@ void EdIsDim::processReplacing(float **inputs, float **outputs, VstInt32 sampleF float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -75,25 +72,14 @@ void EdIsDim::processReplacing(float **inputs, float **outputs, VstInt32 sampleF mid = (inputSampleL+inputSampleR)/2.0; side = (inputSampleL-inputSampleR)/2.0; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = mid; - fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLA; - fpTemp = side; - fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRA; - } - else { - fpTemp = mid; - fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLB; - fpTemp = side; - fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)mid, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + mid += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)side, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + side += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = mid; *out2 = side; @@ -112,9 +98,6 @@ void EdIsDim::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -174,25 +157,16 @@ void EdIsDim::processDoubleReplacing(double **inputs, double **outputs, VstInt32 mid = (inputSampleL+inputSampleR)/2.0; side = (inputSampleL-inputSampleR)/2.0; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = mid; - fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLA; - fpTemp = side; - fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRA; - } - else { - fpTemp = mid; - fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLB; - fpTemp = side; - fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)mid, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + mid += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)side, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + side += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = mid; *out2 = side; diff --git a/plugins/WinVST/ElectroHat/.vs/VSTProject/v14/.suo b/plugins/WinVST/ElectroHat/.vs/VSTProject/v14/.suo Binary files differindex 8d8d5e2..8b7bf64 100755 --- a/plugins/WinVST/ElectroHat/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ElectroHat/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ElectroHat/ElectroHat.cpp b/plugins/WinVST/ElectroHat/ElectroHat.cpp index 33d1058..6be41e4 100755 --- a/plugins/WinVST/ElectroHat/ElectroHat.cpp +++ b/plugins/WinVST/ElectroHat/ElectroHat.cpp @@ -25,11 +25,8 @@ ElectroHat::ElectroHat(audioMasterCallback audioMaster) : lok = 0; flip = true; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ElectroHat/ElectroHat.h b/plugins/WinVST/ElectroHat/ElectroHat.h index e8aa325..85315cd 100755 --- a/plugins/WinVST/ElectroHat/ElectroHat.h +++ b/plugins/WinVST/ElectroHat/ElectroHat.h @@ -56,11 +56,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double storedSampleL; diff --git a/plugins/WinVST/ElectroHat/ElectroHatProc.cpp b/plugins/WinVST/ElectroHat/ElectroHatProc.cpp index 69b1a00..ee5a307 100755 --- a/plugins/WinVST/ElectroHat/ElectroHatProc.cpp +++ b/plugins/WinVST/ElectroHat/ElectroHatProc.cpp @@ -20,9 +20,6 @@ void ElectroHat::processReplacing(float **inputs, float **outputs, VstInt32 samp bool highSample = false; if (getSampleRate() > 64000) highSample = true; //we will go to another dither for 88 and 96K - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -126,25 +123,14 @@ void ElectroHat::processReplacing(float **inputs, float **outputs, VstInt32 samp inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -169,9 +155,6 @@ void ElectroHat::processDoubleReplacing(double **inputs, double **outputs, VstIn bool highSample = false; if (getSampleRate() > 64000) highSample = true; //we will go to another dither for 88 and 96K - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -275,25 +258,16 @@ void ElectroHat::processDoubleReplacing(double **inputs, double **outputs, VstIn inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Energy/.vs/VSTProject/v14/.suo b/plugins/WinVST/Energy/.vs/VSTProject/v14/.suo Binary files differindex e7b1929..3b56035 100755 --- a/plugins/WinVST/Energy/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Energy/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Energy/EnergyProc.cpp b/plugins/WinVST/Energy/EnergyProc.cpp index a72b868..a0a86f8 100755 --- a/plugins/WinVST/Energy/EnergyProc.cpp +++ b/plugins/WinVST/Energy/EnergyProc.cpp @@ -742,18 +742,14 @@ void Energy::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr //we don't need a drySample because we never touched inputSample //so, this provides the inv/dry/wet control all by itself - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -763,12 +759,6 @@ void Energy::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Energy::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -1506,18 +1496,16 @@ void Energy::processDoubleReplacing(double **inputs, double **outputs, VstInt32 //we don't need a drySample because we never touched inputSample //so, this provides the inv/dry/wet control all by itself - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -1527,10 +1515,4 @@ void Energy::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/Ensemble/.vs/VSTProject/v14/.suo b/plugins/WinVST/Ensemble/.vs/VSTProject/v14/.suo Binary files differindex 6022e68..5f6df86 100755 --- a/plugins/WinVST/Ensemble/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Ensemble/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Ensemble/Ensemble.cpp b/plugins/WinVST/Ensemble/Ensemble.cpp index be624b2..b90bf6e 100755 --- a/plugins/WinVST/Ensemble/Ensemble.cpp +++ b/plugins/WinVST/Ensemble/Ensemble.cpp @@ -28,12 +28,9 @@ Ensemble::Ensemble(audioMasterCallback audioMaster) : airEvenR = 0.0; airOddR = 0.0; airFactorR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Ensemble/Ensemble.h b/plugins/WinVST/Ensemble/Ensemble.h index 32ba8c0..7697d93 100755 --- a/plugins/WinVST/Ensemble/Ensemble.h +++ b/plugins/WinVST/Ensemble/Ensemble.h @@ -55,11 +55,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff const static int totalsamples = 65540; float dL[totalsamples]; @@ -74,7 +71,7 @@ private: double airEvenR; double airOddR; double airFactorR; - + bool fpFlip; float A; float B; float C; diff --git a/plugins/WinVST/Ensemble/EnsembleProc.cpp b/plugins/WinVST/Ensemble/EnsembleProc.cpp index 679e868..e9a3a43 100755 --- a/plugins/WinVST/Ensemble/EnsembleProc.cpp +++ b/plugins/WinVST/Ensemble/EnsembleProc.cpp @@ -37,9 +37,6 @@ void Ensemble::processReplacing(float **inputs, float **outputs, VstInt32 sample double tempL; double tempR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -117,7 +114,8 @@ void Ensemble::processReplacing(float **inputs, float **outputs, VstInt32 sample airPrevR = inputSampleR; inputSampleR += (airFactorR*brighten); //air, compensates for loss of highs in flanger's interpolation - + fpFlip = !fpFlip; + if (gcount < 1 || gcount > 32767) {gcount = 32767;} count = gcount; dL[count+32767] = dL[count] = tempL = inputSampleL; @@ -155,25 +153,14 @@ void Ensemble::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -215,9 +202,6 @@ void Ensemble::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double tempL; double tempR; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -295,6 +279,7 @@ void Ensemble::processDoubleReplacing(double **inputs, double **outputs, VstInt3 airPrevR = inputSampleR; inputSampleR += (airFactorR*brighten); //air, compensates for loss of highs in flanger's interpolation + fpFlip = !fpFlip; if (gcount < 1 || gcount > 32767) {gcount = 32767;} count = gcount; @@ -333,25 +318,16 @@ void Ensemble::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/EveryTrim/.vs/VSTProject/v14/.suo b/plugins/WinVST/EveryTrim/.vs/VSTProject/v14/.suo Binary files differindex 649aa5c..29d586f 100755 --- a/plugins/WinVST/EveryTrim/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/EveryTrim/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/EveryTrim/EveryTrim.cpp b/plugins/WinVST/EveryTrim/EveryTrim.cpp index 1e81d35..b0a98d4 100755 --- a/plugins/WinVST/EveryTrim/EveryTrim.cpp +++ b/plugins/WinVST/EveryTrim/EveryTrim.cpp @@ -17,11 +17,8 @@ EveryTrim::EveryTrim(audioMasterCallback audioMaster) : C = 0.5; D = 0.5; E = 0.5; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/EveryTrim/EveryTrim.h b/plugins/WinVST/EveryTrim/EveryTrim.h index 28d9c27..4efc3cd 100755 --- a/plugins/WinVST/EveryTrim/EveryTrim.h +++ b/plugins/WinVST/EveryTrim/EveryTrim.h @@ -56,11 +56,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/EveryTrim/EveryTrimProc.cpp b/plugins/WinVST/EveryTrim/EveryTrimProc.cpp index 30d764f..3c30eda 100755 --- a/plugins/WinVST/EveryTrim/EveryTrimProc.cpp +++ b/plugins/WinVST/EveryTrim/EveryTrimProc.cpp @@ -14,9 +14,6 @@ void EveryTrim::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double leftgain = pow(10.0,((A*24.0)-12.0)/20.0); double rightgain = pow(10.0,((B*24.0)-12.0)/20.0); @@ -83,25 +80,14 @@ void EveryTrim::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR = (mid-side) * rightgain; //contains mastergain and the gain trim fixing the mid/side - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -120,9 +106,6 @@ void EveryTrim::processDoubleReplacing(double **inputs, double **outputs, VstInt double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double leftgain = pow(10.0,((A*24.0)-12.0)/20.0); double rightgain = pow(10.0,((B*24.0)-12.0)/20.0); @@ -189,25 +172,16 @@ void EveryTrim::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR = (mid-side) * rightgain; //contains mastergain and the gain trim fixing the mid/side - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/FathomFive/.vs/VSTProject/v14/.suo b/plugins/WinVST/FathomFive/.vs/VSTProject/v14/.suo Binary files differindex 42015e9..9a9ba63 100755 --- a/plugins/WinVST/FathomFive/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/FathomFive/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/FathomFive/FathomFive.cpp b/plugins/WinVST/FathomFive/FathomFive.cpp index 8cd3f52..fd04b6d 100755 --- a/plugins/WinVST/FathomFive/FathomFive.cpp +++ b/plugins/WinVST/FathomFive/FathomFive.cpp @@ -100,16 +100,6 @@ void FathomFive::setParameter(VstInt32 index, float value) { //variables can also be set in the processreplacing loop, and there they'll be set every buffersize //here they're set when a parameter's actually changed, which should be less frequent, but //you must use global variables in the FathomFive.h file to do it. -// switch((VstInt32)( D * 3.999 )) -// { -// case 0: fpFlip = true; break; //choice A -// case 1: fpFlip = false; break; //choice B -// case 2: break; //choice C -// case 3: break; //choice D -// default: break; //should not happen -// } - //this relates to using D as a 'popup' and changing things based on that switch. - //we are using fpFlip just because it's already there globally, as an example. } float FathomFive::getParameter(VstInt32 index) { diff --git a/plugins/WinVST/Floor/.vs/VSTProject/v14/.suo b/plugins/WinVST/Floor/.vs/VSTProject/v14/.suo Binary files differindex 9ba9265..65d9c96 100755 --- a/plugins/WinVST/Floor/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Floor/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Floor/FloorProc.cpp b/plugins/WinVST/Floor/FloorProc.cpp index 69a2ccb..865446b 100755 --- a/plugins/WinVST/Floor/FloorProc.cpp +++ b/plugins/WinVST/Floor/FloorProc.cpp @@ -247,18 +247,14 @@ void Floor::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -268,12 +264,6 @@ void Floor::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Floor::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -516,18 +506,16 @@ void Floor::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -537,10 +525,4 @@ void Floor::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/Fracture/.vs/VSTProject/v14/.suo b/plugins/WinVST/Fracture/.vs/VSTProject/v14/.suo Binary files differindex f5e4242..95ce6ca 100755 --- a/plugins/WinVST/Fracture/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Fracture/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Fracture/Fracture.cpp b/plugins/WinVST/Fracture/Fracture.cpp index 255475a..03f3b19 100755 --- a/plugins/WinVST/Fracture/Fracture.cpp +++ b/plugins/WinVST/Fracture/Fracture.cpp @@ -16,11 +16,8 @@ Fracture::Fracture(audioMasterCallback audioMaster) : B = 0.5; //2 from 1 to 3: (B*2.999)+1 C = 1.0; D = 1.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Fracture/Fracture.h b/plugins/WinVST/Fracture/Fracture.h index 659f94b..49d2718 100755 --- a/plugins/WinVST/Fracture/Fracture.h +++ b/plugins/WinVST/Fracture/Fracture.h @@ -55,11 +55,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Fracture/FractureProc.cpp b/plugins/WinVST/Fracture/FractureProc.cpp index 8e217d8..5c1aaa9 100755 --- a/plugins/WinVST/Fracture/FractureProc.cpp +++ b/plugins/WinVST/Fracture/FractureProc.cpp @@ -14,9 +14,6 @@ void Fracture::processReplacing(float **inputs, float **outputs, VstInt32 sample float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double density = A*4; double fracture = (((B*2.999)+1)*3.14159265358979); @@ -101,25 +98,14 @@ void Fracture::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = (drySampleL * dry)+(inputSampleL * wet); inputSampleR = (drySampleR * dry)+(inputSampleR * wet); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -141,9 +127,6 @@ void Fracture::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double density = A*4; double fracture = (((B*2.999)+1)*3.14159265358979); @@ -228,25 +211,16 @@ void Fracture::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (drySampleL * dry)+(inputSampleL * wet); inputSampleR = (drySampleR * dry)+(inputSampleR * wet); - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/FromTape/.vs/VSTProject/v14/.suo b/plugins/WinVST/FromTape/.vs/VSTProject/v14/.suo Binary files differindex f635737..cdcd603 100755 --- a/plugins/WinVST/FromTape/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/FromTape/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/FromTape/FromTape.cpp b/plugins/WinVST/FromTape/FromTape.cpp index 55c5ced..40b7876 100755 --- a/plugins/WinVST/FromTape/FromTape.cpp +++ b/plugins/WinVST/FromTape/FromTape.cpp @@ -82,11 +82,8 @@ FromTape::FromTape(audioMasterCallback audioMaster) : flip = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/FromTape/FromTape.h b/plugins/WinVST/FromTape/FromTape.h index 376b767..40efabc 100755 --- a/plugins/WinVST/FromTape/FromTape.h +++ b/plugins/WinVST/FromTape/FromTape.h @@ -120,11 +120,8 @@ private: double iirSampleYR; double iirSampleZR; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/FromTape/FromTapeProc.cpp b/plugins/WinVST/FromTape/FromTapeProc.cpp index 42753e5..2d268ef 100755 --- a/plugins/WinVST/FromTape/FromTapeProc.cpp +++ b/plugins/WinVST/FromTape/FromTapeProc.cpp @@ -37,9 +37,6 @@ void FromTape::processReplacing(float **inputs, float **outputs, VstInt32 sample double drySampleR; double randy; double invrandy; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -224,25 +221,14 @@ void FromTape::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -284,9 +270,6 @@ void FromTape::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double drySampleR; double randy; double invrandy; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -471,25 +454,16 @@ void FromTape::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Gatelope/.vs/VSTProject/v14/.suo b/plugins/WinVST/Gatelope/.vs/VSTProject/v14/.suo Binary files differindex e445e51..3cb4e6c 100755 --- a/plugins/WinVST/Gatelope/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Gatelope/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Gatelope/GatelopeProc.cpp b/plugins/WinVST/Gatelope/GatelopeProc.cpp index b32bddb..f429042 100755 --- a/plugins/WinVST/Gatelope/GatelopeProc.cpp +++ b/plugins/WinVST/Gatelope/GatelopeProc.cpp @@ -196,18 +196,14 @@ void Gatelope::processReplacing(float **inputs, float **outputs, VstInt32 sample flip = !flip; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -217,12 +213,6 @@ void Gatelope::processReplacing(float **inputs, float **outputs, VstInt32 sample *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Gatelope::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -414,18 +404,16 @@ void Gatelope::processDoubleReplacing(double **inputs, double **outputs, VstInt3 flip = !flip; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -435,10 +423,4 @@ void Gatelope::processDoubleReplacing(double **inputs, double **outputs, VstInt3 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/Golem/.vs/VSTProject/v14/.suo b/plugins/WinVST/Golem/.vs/VSTProject/v14/.suo Binary files differindex d595650..9e8f1c5 100755 --- a/plugins/WinVST/Golem/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Golem/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Golem/Golem.cpp b/plugins/WinVST/Golem/Golem.cpp index 8f63b48..c99c5cd 100755 --- a/plugins/WinVST/Golem/Golem.cpp +++ b/plugins/WinVST/Golem/Golem.cpp @@ -17,10 +17,8 @@ Golem::Golem(audioMasterCallback audioMaster) : C = 0.0; for(count = 0; count < 4098; count++) {p[count] = 0.0;} count = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; flip = true; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/WinVST/Golem/Golem.h b/plugins/WinVST/Golem/Golem.h index 8bb81d8..e02ab78 100755 --- a/plugins/WinVST/Golem/Golem.h +++ b/plugins/WinVST/Golem/Golem.h @@ -54,10 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; + long double fpNShapeL; + long double fpNShapeR; bool flip; //default stuff double p[4099]; diff --git a/plugins/WinVST/Golem/GolemProc.cpp b/plugins/WinVST/Golem/GolemProc.cpp index 9235869..1d7e9f5 100755 --- a/plugins/WinVST/Golem/GolemProc.cpp +++ b/plugins/WinVST/Golem/GolemProc.cpp @@ -14,9 +14,6 @@ void Golem::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; int phase = (int)((C * 5.999)+1); double balance = ((A*2.0)-1.0) / 2.0; double gainL = 0.5 - balance; @@ -115,25 +112,14 @@ void Golem::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleR = inputSampleL; //the output is totally mono - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -152,9 +138,6 @@ void Golem::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; int phase = (int)((C * 5.999)+1); double balance = ((A*2.0)-1.0) / 2.0; double gainL = 0.5 - balance; @@ -253,25 +236,16 @@ void Golem::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleR = inputSampleL; //the output is totally mono - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - flip = !flip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/GrooveWear/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/GrooveWear/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/GrooveWear/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/GrooveWear/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/GrooveWear/.vs/VSTProject/v14/.suo b/plugins/WinVST/GrooveWear/.vs/VSTProject/v14/.suo Binary files differindex 76a8251..526a0d5 100644..100755 --- a/plugins/WinVST/GrooveWear/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/GrooveWear/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/GrooveWear/GrooveWear.cpp b/plugins/WinVST/GrooveWear/GrooveWear.cpp index e553daa..cbe1fc5 100644..100755 --- a/plugins/WinVST/GrooveWear/GrooveWear.cpp +++ b/plugins/WinVST/GrooveWear/GrooveWear.cpp @@ -36,11 +36,8 @@ GrooveWear::GrooveWear(audioMasterCallback audioMaster) : cMidPrevR = 0.0; dMidPrevR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/GrooveWear/GrooveWear.h b/plugins/WinVST/GrooveWear/GrooveWear.h index 7b933c2..4bf9745 100644..100755 --- a/plugins/WinVST/GrooveWear/GrooveWear.h +++ b/plugins/WinVST/GrooveWear/GrooveWear.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double aMidL[21]; diff --git a/plugins/WinVST/GrooveWear/GrooveWearProc.cpp b/plugins/WinVST/GrooveWear/GrooveWearProc.cpp index a22f6df..e663203 100644..100755 --- a/plugins/WinVST/GrooveWear/GrooveWearProc.cpp +++ b/plugins/WinVST/GrooveWear/GrooveWearProc.cpp @@ -14,9 +14,6 @@ void GrooveWear::processReplacing(float **inputs, float **outputs, VstInt32 samp float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double overallscale = (pow(A,2)*19.0)+1.0; double gain = overallscale; @@ -433,25 +430,14 @@ void GrooveWear::processReplacing(float **inputs, float **outputs, VstInt32 samp drySampleR = inputSampleR; } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -470,9 +456,6 @@ void GrooveWear::processDoubleReplacing(double **inputs, double **outputs, VstIn double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double overallscale = (pow(A,2)*19.0)+1.0; double gain = overallscale; @@ -889,25 +872,16 @@ void GrooveWear::processDoubleReplacing(double **inputs, double **outputs, VstIn drySampleR = inputSampleR; } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/GrooveWear/VSTProject.VC.db b/plugins/WinVST/GrooveWear/VSTProject.VC.db Binary files differnew file mode 100755 index 0000000..677f802 --- /dev/null +++ b/plugins/WinVST/GrooveWear/VSTProject.VC.db diff --git a/plugins/WinVST/GrooveWear/VSTProject.vcxproj b/plugins/WinVST/GrooveWear/VSTProject.vcxproj index 88eb5f5..88eb5f5 100644..100755 --- a/plugins/WinVST/GrooveWear/VSTProject.vcxproj +++ b/plugins/WinVST/GrooveWear/VSTProject.vcxproj diff --git a/plugins/WinVST/GrooveWear/VSTProject.vcxproj.filters b/plugins/WinVST/GrooveWear/VSTProject.vcxproj.filters index 7946bd2..7946bd2 100644..100755 --- a/plugins/WinVST/GrooveWear/VSTProject.vcxproj.filters +++ b/plugins/WinVST/GrooveWear/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/GrooveWear/VSTProject.vcxproj.user b/plugins/WinVST/GrooveWear/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/GrooveWear/VSTProject.vcxproj.user +++ b/plugins/WinVST/GrooveWear/VSTProject.vcxproj.user diff --git a/plugins/WinVST/GrooveWear/vstplug.def b/plugins/WinVST/GrooveWear/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/GrooveWear/vstplug.def +++ b/plugins/WinVST/GrooveWear/vstplug.def diff --git a/plugins/WinVST/GuitarConditioner/.vs/VSTProject/v14/.suo b/plugins/WinVST/GuitarConditioner/.vs/VSTProject/v14/.suo Binary files differindex 9e37109..82c0a67 100755 --- a/plugins/WinVST/GuitarConditioner/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/GuitarConditioner/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/GuitarConditioner/GuitarConditioner.cpp b/plugins/WinVST/GuitarConditioner/GuitarConditioner.cpp index 8f3ccfc..b0388ab 100755 --- a/plugins/WinVST/GuitarConditioner/GuitarConditioner.cpp +++ b/plugins/WinVST/GuitarConditioner/GuitarConditioner.cpp @@ -12,12 +12,9 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new G GuitarConditioner::GuitarConditioner(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; - lastSampleTL = 0.0; lastSampleBL = 0.0; //for Slews. T for treble, B for bass iirSampleTAL = 0.0; diff --git a/plugins/WinVST/GuitarConditioner/GuitarConditioner.h b/plugins/WinVST/GuitarConditioner/GuitarConditioner.h index 7bd73ab..3be09e1 100755 --- a/plugins/WinVST/GuitarConditioner/GuitarConditioner.h +++ b/plugins/WinVST/GuitarConditioner/GuitarConditioner.h @@ -49,13 +49,10 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff - + bool fpFlip; double lastSampleTL; double lastSampleBL; //for Slews double iirSampleTAL; diff --git a/plugins/WinVST/GuitarConditioner/GuitarConditionerProc.cpp b/plugins/WinVST/GuitarConditioner/GuitarConditionerProc.cpp index 83970f2..b25d600 100755 --- a/plugins/WinVST/GuitarConditioner/GuitarConditionerProc.cpp +++ b/plugins/WinVST/GuitarConditioner/GuitarConditionerProc.cpp @@ -17,9 +17,6 @@ void GuitarConditioner::processReplacing(float **inputs, float **outputs, VstInt double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -164,26 +161,18 @@ void GuitarConditioner::processReplacing(float **inputs, float **outputs, VstInt lastSampleBR = bassR; //bassR slew inputSampleL = trebleL + bassL; //final merge - inputSampleR = trebleR + bassR; //final merge - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } + inputSampleR = trebleR + bassR; //final merge fpFlip = !fpFlip; - //end noise shaping on 32 bit output + + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -205,9 +194,6 @@ void GuitarConditioner::processDoubleReplacing(double **inputs, double **outputs double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -353,26 +339,19 @@ void GuitarConditioner::processDoubleReplacing(double **inputs, double **outputs lastSampleBR = bassR; //bassR slew inputSampleL = trebleL + bassL; //final merge - inputSampleR = trebleR + bassR; //final merge - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } + inputSampleR = trebleR + bassR; //final merge fpFlip = !fpFlip; - //end noise shaping on 64 bit output + + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/HardVacuum/.vs/VSTProject/v14/.suo b/plugins/WinVST/HardVacuum/.vs/VSTProject/v14/.suo Binary files differindex c83c797..33c256b 100755 --- a/plugins/WinVST/HardVacuum/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/HardVacuum/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/HardVacuum/HardVacuum.cpp b/plugins/WinVST/HardVacuum/HardVacuum.cpp index 2ad1a4a..9c14f89 100755 --- a/plugins/WinVST/HardVacuum/HardVacuum.cpp +++ b/plugins/WinVST/HardVacuum/HardVacuum.cpp @@ -19,11 +19,8 @@ HardVacuum::HardVacuum(audioMasterCallback audioMaster) : E = 1.0; lastSampleL = 0.0; lastSampleR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/HardVacuum/HardVacuum.h b/plugins/WinVST/HardVacuum/HardVacuum.h index 6321df6..7f4c098 100755 --- a/plugins/WinVST/HardVacuum/HardVacuum.h +++ b/plugins/WinVST/HardVacuum/HardVacuum.h @@ -56,11 +56,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastSampleL; diff --git a/plugins/WinVST/HardVacuum/HardVacuumProc.cpp b/plugins/WinVST/HardVacuum/HardVacuumProc.cpp index f8fe4fd..e0e07e2 100755 --- a/plugins/WinVST/HardVacuum/HardVacuumProc.cpp +++ b/plugins/WinVST/HardVacuum/HardVacuumProc.cpp @@ -33,9 +33,6 @@ void HardVacuum::processReplacing(float **inputs, float **outputs, VstInt32 samp double skewL; double skewR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -176,25 +173,14 @@ void HardVacuum::processReplacing(float **inputs, float **outputs, VstInt32 samp inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -232,9 +218,6 @@ void HardVacuum::processDoubleReplacing(double **inputs, double **outputs, VstIn double skewL; double skewR; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -376,25 +359,16 @@ void HardVacuum::processDoubleReplacing(double **inputs, double **outputs, VstIn inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/HermeTrim/.vs/VSTProject/v14/.suo b/plugins/WinVST/HermeTrim/.vs/VSTProject/v14/.suo Binary files differindex d06b803..7bf1a45 100755 --- a/plugins/WinVST/HermeTrim/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/HermeTrim/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/HermeTrim/HermeTrim.cpp b/plugins/WinVST/HermeTrim/HermeTrim.cpp index 562df2c..117cc45 100755 --- a/plugins/WinVST/HermeTrim/HermeTrim.cpp +++ b/plugins/WinVST/HermeTrim/HermeTrim.cpp @@ -17,11 +17,8 @@ HermeTrim::HermeTrim(audioMasterCallback audioMaster) : C = 0.5; D = 0.5; E = 0.5; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/HermeTrim/HermeTrim.h b/plugins/WinVST/HermeTrim/HermeTrim.h index b8503ca..f0bc8ed 100755 --- a/plugins/WinVST/HermeTrim/HermeTrim.h +++ b/plugins/WinVST/HermeTrim/HermeTrim.h @@ -56,11 +56,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/HermeTrim/HermeTrimProc.cpp b/plugins/WinVST/HermeTrim/HermeTrimProc.cpp index d920843..66d3144 100755 --- a/plugins/WinVST/HermeTrim/HermeTrimProc.cpp +++ b/plugins/WinVST/HermeTrim/HermeTrimProc.cpp @@ -14,9 +14,6 @@ void HermeTrim::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double leftgain = pow(10.0,((A*3.0)-1.5)/20.0); double rightgain = pow(10.0,((B*3.0)-1.5)/20.0); @@ -83,25 +80,14 @@ void HermeTrim::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR = (mid-side) * rightgain; //contains mastergain and the gain trim fixing the mid/side - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -120,9 +106,6 @@ void HermeTrim::processDoubleReplacing(double **inputs, double **outputs, VstInt double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double leftgain = pow(10.0,((A*3.0)-1.5)/20.0); double rightgain = pow(10.0,((B*3.0)-1.5)/20.0); @@ -189,25 +172,16 @@ void HermeTrim::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR = (mid-side) * rightgain; //contains mastergain and the gain trim fixing the mid/side - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Hermepass/.vs/VSTProject/v14/.suo b/plugins/WinVST/Hermepass/.vs/VSTProject/v14/.suo Binary files differindex 2a195c6..3564c29 100755 --- a/plugins/WinVST/Hermepass/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Hermepass/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Hermepass/Hermepass.cpp b/plugins/WinVST/Hermepass/Hermepass.cpp index 3bfb1aa..4e4a532 100755 --- a/plugins/WinVST/Hermepass/Hermepass.cpp +++ b/plugins/WinVST/Hermepass/Hermepass.cpp @@ -32,12 +32,9 @@ Hermepass::Hermepass(audioMasterCallback audioMaster) : iirFR = 0.0; iirGR = 0.0; iirHR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Hermepass/Hermepass.h b/plugins/WinVST/Hermepass/Hermepass.h index 4f29497..1000bb9 100755 --- a/plugins/WinVST/Hermepass/Hermepass.h +++ b/plugins/WinVST/Hermepass/Hermepass.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double iirAL; double iirBL; //first stage is the flipping one, for lowest slope. It is always engaged, and is the highest one @@ -76,7 +73,7 @@ private: double iirFR; //our slope control will have a pow() on it so that the high orders are way to the right side double iirGR; double iirHR; //seven poles max, and the final pole is always at 20hz directly. - + bool fpFlip; float A; diff --git a/plugins/WinVST/Hermepass/HermepassProc.cpp b/plugins/WinVST/Hermepass/HermepassProc.cpp index 01b35aa..fddffe3 100755 --- a/plugins/WinVST/Hermepass/HermepassProc.cpp +++ b/plugins/WinVST/Hermepass/HermepassProc.cpp @@ -17,10 +17,8 @@ void Hermepass::processReplacing(float **inputs, float **outputs, VstInt32 sampl double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double fpNew = 1.0 - fpOld; double rangescale = 0.1 / overallscale; double cutoff = pow(A,3); @@ -175,26 +173,17 @@ void Hermepass::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR -= correction; //end R channel - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 32 bit output + + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -216,10 +205,8 @@ void Hermepass::processDoubleReplacing(double **inputs, double **outputs, VstInt double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing long double fpOld = 0.618033988749894848204586; //golden ratio! long double fpNew = 1.0 - fpOld; - double rangescale = 0.1 / overallscale; double cutoff = pow(A,3); @@ -374,26 +361,19 @@ void Hermepass::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR -= correction; //end R channel - - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 64 bit output + + + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/HighImpact/.vs/VSTProject/v14/.suo b/plugins/WinVST/HighImpact/.vs/VSTProject/v14/.suo Binary files differindex 56b69ec..fadcdca 100755 --- a/plugins/WinVST/HighImpact/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/HighImpact/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/HighImpact/HighImpact.cpp b/plugins/WinVST/HighImpact/HighImpact.cpp index 0944b18..960d80c 100755 --- a/plugins/WinVST/HighImpact/HighImpact.cpp +++ b/plugins/WinVST/HighImpact/HighImpact.cpp @@ -17,11 +17,8 @@ HighImpact::HighImpact(audioMasterCallback audioMaster) : C = 0.0; lastSampleL = 0.0; lastSampleR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/HighImpact/HighImpact.h b/plugins/WinVST/HighImpact/HighImpact.h index 9c7a4a0..a57230b 100755 --- a/plugins/WinVST/HighImpact/HighImpact.h +++ b/plugins/WinVST/HighImpact/HighImpact.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastSampleL; diff --git a/plugins/WinVST/HighImpact/HighImpactProc.cpp b/plugins/WinVST/HighImpact/HighImpactProc.cpp index 037bbe9..f24804a 100755 --- a/plugins/WinVST/HighImpact/HighImpactProc.cpp +++ b/plugins/WinVST/HighImpact/HighImpactProc.cpp @@ -14,9 +14,6 @@ void HighImpact::processReplacing(float **inputs, float **outputs, VstInt32 samp float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -161,25 +158,14 @@ void HighImpact::processReplacing(float **inputs, float **outputs, VstInt32 samp //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -201,9 +187,6 @@ void HighImpact::processDoubleReplacing(double **inputs, double **outputs, VstIn double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -348,25 +331,16 @@ void HighImpact::processDoubleReplacing(double **inputs, double **outputs, VstIn //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Highpass/.vs/VSTProject/v14/.suo b/plugins/WinVST/Highpass/.vs/VSTProject/v14/.suo Binary files differindex 9f7300c..3a225dd 100755 --- a/plugins/WinVST/Highpass/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Highpass/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Highpass/Highpass.cpp b/plugins/WinVST/Highpass/Highpass.cpp index ed43f9d..86ebe24 100755 --- a/plugins/WinVST/Highpass/Highpass.cpp +++ b/plugins/WinVST/Highpass/Highpass.cpp @@ -19,10 +19,8 @@ Highpass::Highpass(audioMasterCallback audioMaster) : iirSampleBL = 0.0; iirSampleAR = 0.0; iirSampleBR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/WinVST/Highpass/Highpass.h b/plugins/WinVST/Highpass/Highpass.h index 03d8609..673f951 100755 --- a/plugins/WinVST/Highpass/Highpass.h +++ b/plugins/WinVST/Highpass/Highpass.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; @@ -68,7 +65,7 @@ private: double iirSampleBL; double iirSampleAR; double iirSampleBR; - + bool fpFlip; }; #endif diff --git a/plugins/WinVST/Highpass/HighpassProc.cpp b/plugins/WinVST/Highpass/HighpassProc.cpp index b1e7de9..371ed57 100755 --- a/plugins/WinVST/Highpass/HighpassProc.cpp +++ b/plugins/WinVST/Highpass/HighpassProc.cpp @@ -26,9 +26,6 @@ void Highpass::processReplacing(float **inputs, float **outputs, VstInt32 sample double inputSampleR; double outputSampleL; double outputSampleR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; iirAmount += (iirAmount * tight * tight); if (tight > 0) tight /= 1.5; @@ -114,33 +111,21 @@ void Highpass::processReplacing(float **inputs, float **outputs, VstInt32 sample iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount)); outputSampleR = outputSampleR - iirSampleBR; } + fpFlip = !fpFlip; if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry); if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = outputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLA; - - fpTemp = outputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRA; - } - else { - fpTemp = outputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLB; - - fpTemp = outputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = outputSampleL; *out2 = outputSampleR; @@ -171,9 +156,6 @@ void Highpass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double inputSampleR; double outputSampleL; double outputSampleR; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; iirAmount += (iirAmount * tight * tight); if (tight > 0) tight /= 1.5; @@ -259,33 +241,23 @@ void Highpass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount)); outputSampleR = outputSampleR - iirSampleBR; } + fpFlip = !fpFlip; if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry); if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = outputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLA; - - fpTemp = outputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRA; - } - else { - fpTemp = outputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLB; - - fpTemp = outputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = outputSampleL; *out2 = outputSampleR; diff --git a/plugins/WinVST/Hombre/.vs/VSTProject/v14/.suo b/plugins/WinVST/Hombre/.vs/VSTProject/v14/.suo Binary files differindex 1c81394..2fce309 100755 --- a/plugins/WinVST/Hombre/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Hombre/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Hombre/Hombre.cpp b/plugins/WinVST/Hombre/Hombre.cpp index 9ef8844..8b03ed1 100755 --- a/plugins/WinVST/Hombre/Hombre.cpp +++ b/plugins/WinVST/Hombre/Hombre.cpp @@ -17,11 +17,8 @@ Hombre::Hombre(audioMasterCallback audioMaster) : for(int count = 0; count < 4000; count++) {pL[count] = 0.0; pR[count] = 0.0;} gcount = 0; slide = 0.421; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Hombre/Hombre.h b/plugins/WinVST/Hombre/Hombre.h index 94e29b1..e23f6f3 100755 --- a/plugins/WinVST/Hombre/Hombre.h +++ b/plugins/WinVST/Hombre/Hombre.h @@ -58,11 +58,8 @@ private: double slide; int gcount; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Hombre/HombreProc.cpp b/plugins/WinVST/Hombre/HombreProc.cpp index 01e08bd..16bf513 100755 --- a/plugins/WinVST/Hombre/HombreProc.cpp +++ b/plugins/WinVST/Hombre/HombreProc.cpp @@ -17,9 +17,6 @@ void Hombre::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double target = A; double offsetA; @@ -134,25 +131,14 @@ void Hombre::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -174,9 +160,6 @@ void Hombre::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double target = A; double offsetA; @@ -291,25 +274,16 @@ void Hombre::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/IronOxide5/.vs/VSTProject/v14/.suo b/plugins/WinVST/IronOxide5/.vs/VSTProject/v14/.suo Binary files differindex 171a825..e1e2f87 100755 --- a/plugins/WinVST/IronOxide5/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/IronOxide5/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/IronOxide5/IronOxide5.cpp b/plugins/WinVST/IronOxide5/IronOxide5.cpp index 2d7c84f..914f53b 100755 --- a/plugins/WinVST/IronOxide5/IronOxide5.cpp +++ b/plugins/WinVST/IronOxide5/IronOxide5.cpp @@ -45,11 +45,8 @@ IronOxide5::IronOxide5(audioMasterCallback audioMaster) : rateof = 0.5; nextmax = 0.5; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/IronOxide5/IronOxide5.h b/plugins/WinVST/IronOxide5/IronOxide5.h index a7cad5d..82d4c9a 100755 --- a/plugins/WinVST/IronOxide5/IronOxide5.h +++ b/plugins/WinVST/IronOxide5/IronOxide5.h @@ -101,11 +101,8 @@ private: double nextmax; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/IronOxide5/IronOxide5Proc.cpp b/plugins/WinVST/IronOxide5/IronOxide5Proc.cpp index c0fbb35..e42d69f 100755 --- a/plugins/WinVST/IronOxide5/IronOxide5Proc.cpp +++ b/plugins/WinVST/IronOxide5/IronOxide5Proc.cpp @@ -17,9 +17,6 @@ void IronOxide5::processReplacing(float **inputs, float **outputs, VstInt32 samp double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = pow(10.0,((A*36.0)-18.0)/20.0); double outputgain = pow(10.0,((F*36.0)-18.0)/20.0); @@ -422,25 +419,14 @@ void IronOxide5::processReplacing(float **inputs, float **outputs, VstInt32 samp } //end invdrywet block with outputgain - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -462,9 +448,6 @@ void IronOxide5::processDoubleReplacing(double **inputs, double **outputs, VstIn double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = pow(10.0,((A*36.0)-18.0)/20.0); double outputgain = pow(10.0,((F*36.0)-18.0)/20.0); @@ -867,25 +850,16 @@ void IronOxide5::processDoubleReplacing(double **inputs, double **outputs, VstIn } //end invdrywet block with outputgain - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/IronOxideClassic/.vs/VSTProject/v14/.suo b/plugins/WinVST/IronOxideClassic/.vs/VSTProject/v14/.suo Binary files differindex b85b7c1..5e0f1e3 100755 --- a/plugins/WinVST/IronOxideClassic/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/IronOxideClassic/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/IronOxideClassic/IronOxideClassic.cpp b/plugins/WinVST/IronOxideClassic/IronOxideClassic.cpp index 012d8a3..8ce7103 100755 --- a/plugins/WinVST/IronOxideClassic/IronOxideClassic.cpp +++ b/plugins/WinVST/IronOxideClassic/IronOxideClassic.cpp @@ -22,12 +22,9 @@ IronOxideClassic::IronOxideClassic(audioMasterCallback audioMaster) : iirSampleAL = iirSampleBL = 0.0; fastIIRAR = fastIIRBR = slowIIRAR = slowIIRBR = 0.0; iirSampleAR = iirSampleBR = 0.0; - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/IronOxideClassic/IronOxideClassic.h b/plugins/WinVST/IronOxideClassic/IronOxideClassic.h index b7f8bfa..bafb457 100755 --- a/plugins/WinVST/IronOxideClassic/IronOxideClassic.h +++ b/plugins/WinVST/IronOxideClassic/IronOxideClassic.h @@ -71,12 +71,9 @@ private: double slowIIRBR; int gcount; - - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/IronOxideClassic/IronOxideClassicProc.cpp b/plugins/WinVST/IronOxideClassic/IronOxideClassicProc.cpp index c245166..97bbaca 100755 --- a/plugins/WinVST/IronOxideClassic/IronOxideClassicProc.cpp +++ b/plugins/WinVST/IronOxideClassic/IronOxideClassicProc.cpp @@ -17,9 +17,6 @@ void IronOxideClassic::processReplacing(float **inputs, float **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = pow(10.0,((A*36.0)-18.0)/20.0); double outputgain = pow(10.0,((C*36.0)-18.0)/20.0); @@ -343,26 +340,16 @@ void IronOxideClassic::processReplacing(float **inputs, float **outputs, VstInt3 inputSampleL *= outputgain; inputSampleR *= outputgain; } - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 32 bit output + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -384,9 +371,6 @@ void IronOxideClassic::processDoubleReplacing(double **inputs, double **outputs, double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = pow(10.0,((A*36.0)-18.0)/20.0); double outputgain = pow(10.0,((C*36.0)-18.0)/20.0); @@ -710,26 +694,18 @@ void IronOxideClassic::processDoubleReplacing(double **inputs, double **outputs, inputSampleL *= outputgain; inputSampleR *= outputgain; } - - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 64 bit output + + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Logical4/.vs/VSTProject/v14/.suo b/plugins/WinVST/Logical4/.vs/VSTProject/v14/.suo Binary files differindex 0a67ad3..34fa65c 100755 --- a/plugins/WinVST/Logical4/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Logical4/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Logical4/Logical4.cpp b/plugins/WinVST/Logical4/Logical4.cpp index b17cc55..15d185b 100755 --- a/plugins/WinVST/Logical4/Logical4.cpp +++ b/plugins/WinVST/Logical4/Logical4.cpp @@ -77,12 +77,9 @@ Logical4::Logical4(audioMasterCallback audioMaster) : gcount = 0; //end Power Sags - - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Logical4/Logical4.h b/plugins/WinVST/Logical4/Logical4.h index 71e118e..fd802c8 100755 --- a/plugins/WinVST/Logical4/Logical4.h +++ b/plugins/WinVST/Logical4/Logical4.h @@ -143,10 +143,8 @@ private: int gcount; - double fpNShapeLA; - double fpNShapeLB; - double fpNShapeRA; - double fpNShapeRB; + double fpNShapeL; + double fpNShapeR; bool fpFlip; //default stuff diff --git a/plugins/WinVST/Logical4/Logical4Proc.cpp b/plugins/WinVST/Logical4/Logical4Proc.cpp index 0d09fcf..5d079f3 100755 --- a/plugins/WinVST/Logical4/Logical4Proc.cpp +++ b/plugins/WinVST/Logical4/Logical4Proc.cpp @@ -17,9 +17,8 @@ void Logical4::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; + long double fpOld = 0.618033988749894848204586; //golden ratio! + long double fpNew = 1.0 - fpOld; float drySampleL; float drySampleR; @@ -869,27 +868,17 @@ void Logical4::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } + fpFlip = !fpFlip; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -911,9 +900,8 @@ void Logical4::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; + long double fpOld = 0.618033988749894848204586; //golden ratio! + long double fpNew = 1.0 - fpOld; float drySampleL; float drySampleR; @@ -1762,26 +1750,18 @@ void Logical4::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 64 bit output + + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Loud/.vs/VSTProject/v14/.suo b/plugins/WinVST/Loud/.vs/VSTProject/v14/.suo Binary files differindex abcac37..ae71242 100755 --- a/plugins/WinVST/Loud/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Loud/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Loud/Loud.cpp b/plugins/WinVST/Loud/Loud.cpp index 43f7ffc..009124d 100755 --- a/plugins/WinVST/Loud/Loud.cpp +++ b/plugins/WinVST/Loud/Loud.cpp @@ -15,11 +15,8 @@ Loud::Loud(audioMasterCallback audioMaster) : A = 0.0; B = 1.0; C = 1.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Loud/Loud.h b/plugins/WinVST/Loud/Loud.h index 85b66a2..17537c2 100755 --- a/plugins/WinVST/Loud/Loud.h +++ b/plugins/WinVST/Loud/Loud.h @@ -56,11 +56,8 @@ private: double lastSampleL; double lastSampleR; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Loud/LoudProc.cpp b/plugins/WinVST/Loud/LoudProc.cpp index 8aedede..35ee29b 100755 --- a/plugins/WinVST/Loud/LoudProc.cpp +++ b/plugins/WinVST/Loud/LoudProc.cpp @@ -18,9 +18,6 @@ void Loud::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram overallscale /= 44100.0; overallscale *= getSampleRate(); double boost = pow(A+1.0,5); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double output = B; double wet = C; double dry = 1.0-wet; @@ -143,25 +140,14 @@ void Loud::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -184,9 +170,6 @@ void Loud::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa overallscale /= 44100.0; overallscale *= getSampleRate(); double boost = pow(A+1.0,5); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double output = B; double wet = C; double dry = 1.0-wet; @@ -308,25 +291,16 @@ void Loud::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Lowpass/.vs/VSTProject/v14/.suo b/plugins/WinVST/Lowpass/.vs/VSTProject/v14/.suo Binary files differindex f5cbb3f..cf0ac15 100755 --- a/plugins/WinVST/Lowpass/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Lowpass/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Lowpass/Lowpass.cpp b/plugins/WinVST/Lowpass/Lowpass.cpp index 8178799..18064fc 100755 --- a/plugins/WinVST/Lowpass/Lowpass.cpp +++ b/plugins/WinVST/Lowpass/Lowpass.cpp @@ -19,10 +19,8 @@ Lowpass::Lowpass(audioMasterCallback audioMaster) : iirSampleBL = 0.0; iirSampleAR = 0.0; iirSampleBR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/WinVST/Lowpass/Lowpass.h b/plugins/WinVST/Lowpass/Lowpass.h index 1b99c55..40ac456 100755 --- a/plugins/WinVST/Lowpass/Lowpass.h +++ b/plugins/WinVST/Lowpass/Lowpass.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; @@ -68,7 +65,7 @@ private: double iirSampleBL; double iirSampleAR; double iirSampleBR; - + bool fpFlip; }; #endif diff --git a/plugins/WinVST/Lowpass/LowpassProc.cpp b/plugins/WinVST/Lowpass/LowpassProc.cpp index bcce714..bcc3690 100755 --- a/plugins/WinVST/Lowpass/LowpassProc.cpp +++ b/plugins/WinVST/Lowpass/LowpassProc.cpp @@ -27,9 +27,6 @@ void Lowpass::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double inputSampleR; double outputSampleL; double outputSampleR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; iirAmount += (iirAmount * tight * tight); if (tight > 0) tight /= 1.5; @@ -116,33 +113,21 @@ void Lowpass::processReplacing(float **inputs, float **outputs, VstInt32 sampleF iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount)); outputSampleR = iirSampleBR; } + fpFlip = !fpFlip; if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry); if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = outputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLA; - - fpTemp = outputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRA; - } - else { - fpTemp = outputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLB; - - fpTemp = outputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = outputSampleL; *out2 = outputSampleR; @@ -174,9 +159,6 @@ void Lowpass::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double inputSampleR; double outputSampleL; double outputSampleR; - double fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; iirAmount += (iirAmount * tight * tight); if (tight > 0) tight /= 1.5; @@ -263,33 +245,23 @@ void Lowpass::processDoubleReplacing(double **inputs, double **outputs, VstInt32 iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount)); outputSampleR = iirSampleBR; } + fpFlip = !fpFlip; if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry); if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry); - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = outputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLA; - - fpTemp = outputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRA; - } - else { - fpTemp = outputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLB; - - fpTemp = outputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = outputSampleL; *out2 = outputSampleR; diff --git a/plugins/WinVST/Melt/.vs/VSTProject/v14/.suo b/plugins/WinVST/Melt/.vs/VSTProject/v14/.suo Binary files differindex ee90f48..e2993f2 100755 --- a/plugins/WinVST/Melt/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Melt/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Melt/Melt.cpp b/plugins/WinVST/Melt/Melt.cpp index 9722e1f..35ede1e 100755 --- a/plugins/WinVST/Melt/Melt.cpp +++ b/plugins/WinVST/Melt/Melt.cpp @@ -26,11 +26,8 @@ Melt::Melt(audioMasterCallback audioMaster) : slowCount = 0; gcount = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Melt/Melt.h b/plugins/WinVST/Melt/Melt.h index a8e0f38..af11f0f 100755 --- a/plugins/WinVST/Melt/Melt.h +++ b/plugins/WinVST/Melt/Melt.h @@ -70,11 +70,8 @@ private: int slowCount; int gcount; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Melt/MeltProc.cpp b/plugins/WinVST/Melt/MeltProc.cpp index 48a1c11..8a55732 100755 --- a/plugins/WinVST/Melt/MeltProc.cpp +++ b/plugins/WinVST/Melt/MeltProc.cpp @@ -21,9 +21,6 @@ void Melt::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram double wet = D; double dry = 1.0-wet; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -271,25 +268,14 @@ void Melt::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -315,9 +301,6 @@ void Melt::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa double wet = D; double dry = 1.0-wet; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -565,25 +548,16 @@ void Melt::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/MidSide/.vs/VSTProject/v14/.suo b/plugins/WinVST/MidSide/.vs/VSTProject/v14/.suo Binary files differindex 652923f..9fdd1e3 100755 --- a/plugins/WinVST/MidSide/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/MidSide/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/MidSide/MidSide.cpp b/plugins/WinVST/MidSide/MidSide.cpp index bc37393..8f61cff 100755 --- a/plugins/WinVST/MidSide/MidSide.cpp +++ b/plugins/WinVST/MidSide/MidSide.cpp @@ -13,11 +13,8 @@ MidSide::MidSide(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { A = 0.5; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/MidSide/MidSide.h b/plugins/WinVST/MidSide/MidSide.h index 28b2ae7..4d139c8 100755 --- a/plugins/WinVST/MidSide/MidSide.h +++ b/plugins/WinVST/MidSide/MidSide.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/MidSide/MidSideProc.cpp b/plugins/WinVST/MidSide/MidSideProc.cpp index 2df14f4..cca7a5c 100755 --- a/plugins/WinVST/MidSide/MidSideProc.cpp +++ b/plugins/WinVST/MidSide/MidSideProc.cpp @@ -14,9 +14,6 @@ void MidSide::processReplacing(float **inputs, float **outputs, VstInt32 sampleF float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -76,25 +73,14 @@ void MidSide::processReplacing(float **inputs, float **outputs, VstInt32 sampleF mid *= midgain; side *= sidegain; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = mid; - fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLA; - fpTemp = side; - fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRA; - } - else { - fpTemp = mid; - fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLB; - fpTemp = side; - fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)mid, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + mid += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)side, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + side += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = mid; *out2 = side; @@ -113,9 +99,6 @@ void MidSide::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -175,25 +158,16 @@ void MidSide::processDoubleReplacing(double **inputs, double **outputs, VstInt32 mid *= midgain; side *= sidegain; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = mid; - fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLA; - fpTemp = side; - fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRA; - } - else { - fpTemp = mid; - fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLB; - fpTemp = side; - fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)mid, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + mid += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)side, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + side += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = mid; *out2 = side; diff --git a/plugins/WinVST/NC-17/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/NC-17/.vs/Console4Channel64/v14/.suo Binary files differnew file mode 100755 index 0000000..777b846 --- /dev/null +++ b/plugins/WinVST/NC-17/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/NC-17/.vs/VSTProject/v14/.suo b/plugins/WinVST/NC-17/.vs/VSTProject/v14/.suo Binary files differnew file mode 100755 index 0000000..eca2385 --- /dev/null +++ b/plugins/WinVST/NC-17/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/NC-17/NCSeventeen.cpp b/plugins/WinVST/NC-17/NCSeventeen.cpp new file mode 100755 index 0000000..409f983 --- /dev/null +++ b/plugins/WinVST/NC-17/NCSeventeen.cpp @@ -0,0 +1,144 @@ +/* ======================================== + * NCSeventeen - NCSeventeen.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __NCSeventeen_H +#include "NCSeventeen.h" +#endif + +AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new NCSeventeen(audioMaster);} + +NCSeventeen::NCSeventeen(audioMasterCallback audioMaster) : + AudioEffectX(audioMaster, kNumPrograms, kNumParameters) +{ + A = 0.0; + B = 1.0; + + lastSampleL = 0.0; + iirSampleAL = 0.0; + iirSampleBL = 0.0; + basslevL = 0.0; + treblevL = 0.0; + cheblevL = 0.0; + + lastSampleR = 0.0; + iirSampleAR = 0.0; + iirSampleBR = 0.0; + basslevR = 0.0; + treblevR = 0.0; + cheblevR = 0.0; + + flip = false; + + fpNShapeL = 0.0; + fpNShapeR = 0.0; + //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 +} + +NCSeventeen::~NCSeventeen() {} +VstInt32 NCSeventeen::getVendorVersion () {return 1000;} +void NCSeventeen::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);} +void NCSeventeen::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 NCSeventeen::getChunk (void** data, bool isPreset) +{ + float *chunkData = (float *)calloc(kNumParameters, sizeof(float)); + chunkData[0] = A; + chunkData[1] = B; + /* 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 NCSeventeen::setChunk (void* data, VstInt32 byteSize, bool isPreset) +{ + float *chunkData = (float *)data; + A = pinParameter(chunkData[0]); + B = pinParameter(chunkData[1]); + /* 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 NCSeventeen::setParameter(VstInt32 index, float value) { + switch (index) { + case kParamA: A = value; break; + case kParamB: B = value; break; + default: throw; // unknown parameter, shouldn't happen! + } +} + +float NCSeventeen::getParameter(VstInt32 index) { + switch (index) { + case kParamA: return A; break; + case kParamB: return B; 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 NCSeventeen::getParameterName(VstInt32 index, char *text) { + switch (index) { + case kParamA: vst_strncpy (text, "LOUDER", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "Output", kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } //this is our labels for displaying in the VST host +} + +void NCSeventeen::getParameterDisplay(VstInt32 index, char *text) { + switch (index) { + case kParamA: float2string (A*24.0, text, kVstMaxParamStrLen); break; + case kParamB: float2string (B, text, kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } //this displays the values and handles 'popups' where it's discrete choices +} + +void NCSeventeen::getParameterLabel(VstInt32 index, char *text) { + switch (index) { + case kParamA: vst_strncpy (text, "dB", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, " ", kVstMaxParamStrLen); break; + default: break; // unknown parameter, shouldn't happen! + } +} + +VstInt32 NCSeventeen::canDo(char *text) +{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know + +bool NCSeventeen::getEffectName(char* name) { + vst_strncpy(name, "NC-17", kVstMaxProductStrLen); return true; +} + +VstPlugCategory NCSeventeen::getPlugCategory() {return kPlugCategEffect;} + +bool NCSeventeen::getProductString(char* text) { + vst_strncpy (text, "airwindows NC-17", kVstMaxProductStrLen); return true; +} + +bool NCSeventeen::getVendorString(char* text) { + vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true; +} diff --git a/plugins/WinVST/NC-17/NCSeventeen.h b/plugins/WinVST/NC-17/NCSeventeen.h new file mode 100755 index 0000000..b3ecd94 --- /dev/null +++ b/plugins/WinVST/NC-17/NCSeventeen.h @@ -0,0 +1,81 @@ +/* ======================================== + * NCSeventeen - NCSeventeen.h + * Created 8/12/11 by SPIAdmin + * Copyright (c) 2011 __MyCompanyName__, All rights reserved + * ======================================== */ + +#ifndef __NCSeventeen_H +#define __NCSeventeen_H + +#ifndef __audioeffect__ +#include "audioeffectx.h" +#endif + +#include <set> +#include <string> +#include <math.h> + +enum { + kParamA = 0, + kParamB = 1, + kNumParameters = 2 +}; // + +const int kNumPrograms = 0; +const int kNumInputs = 2; +const int kNumOutputs = 2; +const unsigned long kUniqueId = 'ncse'; //Change this to what the AU identity is! + +class NCSeventeen : + public AudioEffectX +{ +public: + NCSeventeen(audioMasterCallback audioMaster); + ~NCSeventeen(); + 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; + +private: + double lastSampleL; + double iirSampleAL; + double iirSampleBL; + double basslevL; + double treblevL; + double cheblevL; + + double lastSampleR; + double iirSampleAR; + double iirSampleBR; + double basslevR; + double treblevR; + double cheblevR; + + bool flip; + + long double fpNShapeL; + long double fpNShapeR; + //default stuff + + float A; + float B; +}; + +#endif diff --git a/plugins/WinVST/NC-17/NCSeventeenProc.cpp b/plugins/WinVST/NC-17/NCSeventeenProc.cpp new file mode 100755 index 0000000..e124cb5 --- /dev/null +++ b/plugins/WinVST/NC-17/NCSeventeenProc.cpp @@ -0,0 +1,721 @@ +/* ======================================== + * NCSeventeen - NCSeventeen.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __NCSeventeen_H +#include "NCSeventeen.h" +#endif + +void NCSeventeen::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames) +{ + float* in1 = inputs[0]; + float* in2 = inputs[1]; + float* out1 = outputs[0]; + float* out2 = outputs[1]; + + double inP2; + double chebyshev; + double overallscale = 1.0; + overallscale /= 44100.0; + overallscale *= getSampleRate(); + + double IIRscaleback = 0.0004716; + double bassScaleback = 0.0002364; + double trebleScaleback = 0.0005484; + double addBassBuss = 0.000243; + double addTrebBuss = 0.000407; + double addShortBuss = 0.000326; + IIRscaleback /= overallscale; + bassScaleback /= overallscale; + trebleScaleback /= overallscale; + addBassBuss /= overallscale; + addTrebBuss /= overallscale; + addShortBuss /= overallscale; + double limitingBass = 0.39; + double limitingTreb = 0.6; + double limiting = 0.36; + double maxfeedBass = 0.972; + double maxfeedTreb = 0.972; + double maxfeed = 0.975; + double bridgerectifier; + long double inputSampleL; + double lowSampleL = 0.0; + double highSampleL; + double distSampleL; + double minusSampleL; + double plusSampleL; + long double inputSampleR; + double lowSampleR = 0.0; + double highSampleR; + double distSampleR; + double minusSampleR; + double plusSampleR; + double gain = pow(10.0,(A*24.0)/20); + double outlevel = B; + + + while (--sampleFrames >= 0) + { + inputSampleL = *in1; + inputSampleR = *in2; + if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) { + static int noisesource = 0; + //this declares a variable before anything else is compiled. It won't keep assigning + //it to 0 for every sample, it's as if the declaration doesn't exist in this context, + //but it lets me add this denormalization fix in a single place rather than updating + //it in three different locations. The variable isn't thread-safe but this is only + //a random seed and we can share it with whatever. + noisesource = noisesource % 1700021; noisesource++; + int residue = noisesource * noisesource; + residue = residue % 170003; residue *= residue; + residue = residue % 17011; residue *= residue; + residue = residue % 1709; residue *= residue; + residue = residue % 173; residue *= residue; + residue = residue % 17; + double applyresidue = residue; + applyresidue *= 0.00000001; + applyresidue *= 0.00000001; + inputSampleL = applyresidue; + } + if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) { + static int noisesource = 0; + noisesource = noisesource % 1700021; noisesource++; + int residue = noisesource * noisesource; + residue = residue % 170003; residue *= residue; + residue = residue % 17011; residue *= residue; + residue = residue % 1709; residue *= residue; + residue = residue % 173; residue *= residue; + residue = residue % 17; + double applyresidue = residue; + applyresidue *= 0.00000001; + applyresidue *= 0.00000001; + inputSampleR = applyresidue; + //this denormalization routine produces a white noise at -300 dB which the noise + //shaping will interact with to produce a bipolar output, but the noise is actually + //all positive. That should stop any variables from going denormal, and the routine + //only kicks in if digital black is input. As a final touch, if you save to 24-bit + //the silence will return to being digital black again. + } + + inputSampleL *= gain; + inputSampleR *= gain; + + if (flip) + { + iirSampleAL = (iirSampleAL * 0.9) + (inputSampleL * 0.1); + lowSampleL = iirSampleAL; + iirSampleAR = (iirSampleAR * 0.9) + (inputSampleR * 0.1); + lowSampleR = iirSampleAR; + } + else + { + iirSampleBL = (iirSampleBL * 0.9) + (inputSampleL * 0.1); + lowSampleL = iirSampleBL; + iirSampleBR = (iirSampleBR * 0.9) + (inputSampleR * 0.1); + lowSampleR = iirSampleBR; + } + highSampleL = inputSampleL - lowSampleL; + highSampleR = inputSampleR - lowSampleR; + flip = !flip; + //we now have two bands and the original source + + inP2 = lowSampleL * lowSampleL; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= basslevL; + //second harmonic max +1 + if (basslevL > 0) basslevL -= bassScaleback; + if (basslevL < 0) basslevL += bassScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(lowSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleL > 0.0) distSampleL = bridgerectifier; + else distSampleL = -bridgerectifier; + minusSampleL = lowSampleL - distSampleL; + plusSampleL = lowSampleL + distSampleL; + if (minusSampleL > maxfeedBass) minusSampleL = maxfeedBass; + if (plusSampleL > maxfeedBass) plusSampleL = maxfeedBass; + if (plusSampleL < -maxfeedBass) plusSampleL = -maxfeedBass; + if (minusSampleL < -maxfeedBass) minusSampleL = -maxfeedBass; + if (lowSampleL > distSampleL) basslevL += (minusSampleL*addBassBuss); + if (lowSampleL < -distSampleL) basslevL -= (plusSampleL*addBassBuss); + if (basslevL > 1.0) basslevL = 1.0; + if (basslevL < -1.0) basslevL = -1.0; + bridgerectifier = fabs(lowSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleL > 0.0) lowSampleL = bridgerectifier; + else lowSampleL = -bridgerectifier; + //apply the distortion transform for reals + lowSampleL /= (1.0+fabs(basslevL*limitingBass)); + lowSampleL += chebyshev; + //apply the correction measuresL + + inP2 = lowSampleR * lowSampleR; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= basslevR; + //second harmonic max +1 + if (basslevR > 0) basslevR -= bassScaleback; + if (basslevR < 0) basslevR += bassScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(lowSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleR > 0.0) distSampleR = bridgerectifier; + else distSampleR = -bridgerectifier; + minusSampleR = lowSampleR - distSampleR; + plusSampleR = lowSampleR + distSampleR; + if (minusSampleR > maxfeedBass) minusSampleR = maxfeedBass; + if (plusSampleR > maxfeedBass) plusSampleR = maxfeedBass; + if (plusSampleR < -maxfeedBass) plusSampleR = -maxfeedBass; + if (minusSampleR < -maxfeedBass) minusSampleR = -maxfeedBass; + if (lowSampleR > distSampleR) basslevR += (minusSampleR*addBassBuss); + if (lowSampleR < -distSampleR) basslevR -= (plusSampleR*addBassBuss); + if (basslevR > 1.0) basslevR = 1.0; + if (basslevR < -1.0) basslevR = -1.0; + bridgerectifier = fabs(lowSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleR > 0.0) lowSampleR = bridgerectifier; + else lowSampleR = -bridgerectifier; + //apply the distortion transform for reals + lowSampleR /= (1.0+fabs(basslevR*limitingBass)); + lowSampleR += chebyshev; + //apply the correction measuresR + + inP2 = highSampleL * highSampleL; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= treblevL; + //second harmonic max +1 + if (treblevL > 0) treblevL -= trebleScaleback; + if (treblevL < 0) treblevL += trebleScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(highSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleL > 0.0) distSampleL = bridgerectifier; + else distSampleL = -bridgerectifier; + minusSampleL = highSampleL - distSampleL; + plusSampleL = highSampleL + distSampleL; + if (minusSampleL > maxfeedTreb) minusSampleL = maxfeedTreb; + if (plusSampleL > maxfeedTreb) plusSampleL = maxfeedTreb; + if (plusSampleL < -maxfeedTreb) plusSampleL = -maxfeedTreb; + if (minusSampleL < -maxfeedTreb) minusSampleL = -maxfeedTreb; + if (highSampleL > distSampleL) treblevL += (minusSampleL*addTrebBuss); + if (highSampleL < -distSampleL) treblevL -= (plusSampleL*addTrebBuss); + if (treblevL > 1.0) treblevL = 1.0; + if (treblevL < -1.0) treblevL = -1.0; + bridgerectifier = fabs(highSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleL > 0.0) highSampleL = bridgerectifier; + else highSampleL = -bridgerectifier; + //apply the distortion transform for reals + highSampleL /= (1.0+fabs(treblevL*limitingTreb)); + highSampleL += chebyshev; + //apply the correction measuresL + + inP2 = highSampleR * highSampleR; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= treblevR; + //second harmonic max +1 + if (treblevR > 0) treblevR -= trebleScaleback; + if (treblevR < 0) treblevR += trebleScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(highSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleR > 0.0) distSampleR = bridgerectifier; + else distSampleR = -bridgerectifier; + minusSampleR = highSampleR - distSampleR; + plusSampleR = highSampleR + distSampleR; + if (minusSampleR > maxfeedTreb) minusSampleR = maxfeedTreb; + if (plusSampleR > maxfeedTreb) plusSampleR = maxfeedTreb; + if (plusSampleR < -maxfeedTreb) plusSampleR = -maxfeedTreb; + if (minusSampleR < -maxfeedTreb) minusSampleR = -maxfeedTreb; + if (highSampleR > distSampleR) treblevR += (minusSampleR*addTrebBuss); + if (highSampleR < -distSampleR) treblevR -= (plusSampleR*addTrebBuss); + if (treblevR > 1.0) treblevR = 1.0; + if (treblevR < -1.0) treblevR = -1.0; + bridgerectifier = fabs(highSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleR > 0.0) highSampleR = bridgerectifier; + else highSampleR = -bridgerectifier; + //apply the distortion transform for reals + highSampleR /= (1.0+fabs(treblevR*limitingTreb)); + highSampleR += chebyshev; + //apply the correction measuresR + + inputSampleL = lowSampleL + highSampleL; + inputSampleR = lowSampleR + highSampleR; + + inP2 = inputSampleL * inputSampleL; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= cheblevL; + //third harmonic max -1 + if (cheblevL > 0) cheblevL -= (IIRscaleback); + if (cheblevL < 0) cheblevL += (IIRscaleback); + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(inputSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) distSampleL = bridgerectifier; + else distSampleL = -bridgerectifier; + minusSampleL = inputSampleL - distSampleL; + plusSampleL = inputSampleL + distSampleL; + if (minusSampleL > maxfeed) minusSampleL = maxfeed; + if (plusSampleL > maxfeed) plusSampleL = maxfeed; + if (plusSampleL < -maxfeed) plusSampleL = -maxfeed; + if (minusSampleL < -maxfeed) minusSampleL = -maxfeed; + if (inputSampleL > distSampleL) cheblevL += (minusSampleL*addShortBuss); + if (inputSampleL < -distSampleL) cheblevL -= (plusSampleL*addShortBuss); + if (cheblevL > 1.0) cheblevL = 1.0; + if (cheblevL < -1.0) cheblevL = -1.0; + bridgerectifier = fabs(inputSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) inputSampleL = bridgerectifier; + else inputSampleL = -bridgerectifier; + //apply the distortion transform for reals + inputSampleL /= (1.0+fabs(cheblevL*limiting)); + inputSampleL += chebyshev; + //apply the correction measuresL + + inP2 = inputSampleR * inputSampleR; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= cheblevR; + //third harmonic max -1 + if (cheblevR > 0) cheblevR -= IIRscaleback; + if (cheblevR < 0) cheblevR += IIRscaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(inputSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) distSampleR = bridgerectifier; + else distSampleR = -bridgerectifier; + minusSampleR = inputSampleR - distSampleR; + plusSampleR = inputSampleR + distSampleR; + if (minusSampleR > maxfeed) minusSampleR = maxfeed; + if (plusSampleR > maxfeed) plusSampleR = maxfeed; + if (plusSampleR < -maxfeed) plusSampleR = -maxfeed; + if (minusSampleR < -maxfeed) minusSampleR = -maxfeed; + if (inputSampleR > distSampleR) cheblevR += (minusSampleR*addShortBuss); + if (inputSampleR < -distSampleR) cheblevR -= (plusSampleR*addShortBuss); + if (cheblevR > 1.0) cheblevR = 1.0; + if (cheblevR < -1.0) cheblevR = -1.0; + bridgerectifier = fabs(inputSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) inputSampleR = bridgerectifier; + else inputSampleR = -bridgerectifier; + //apply the distortion transform for reals + inputSampleR /= (1.0+fabs(cheblevR*limiting)); + inputSampleR += chebyshev; + //apply the correction measuresR + + if (outlevel < 1.0) { + inputSampleL *= outlevel; + inputSampleR *= outlevel; + } + + if (inputSampleL > 0.95) inputSampleL = 0.95; + if (inputSampleL < -0.95) inputSampleL = -0.95; + if (inputSampleR > 0.95) inputSampleR = 0.95; + if (inputSampleR < -0.95) inputSampleR = -0.95; + //iron bar + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither + + *out1 = inputSampleL; + *out2 = inputSampleR; + + *in1++; + *in2++; + *out1++; + *out2++; + } +} + +void NCSeventeen::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) +{ + double* in1 = inputs[0]; + double* in2 = inputs[1]; + double* out1 = outputs[0]; + double* out2 = outputs[1]; + + double inP2; + double chebyshev; + double overallscale = 1.0; + overallscale /= 44100.0; + overallscale *= getSampleRate(); + + double IIRscaleback = 0.0004716; + double bassScaleback = 0.0002364; + double trebleScaleback = 0.0005484; + double addBassBuss = 0.000243; + double addTrebBuss = 0.000407; + double addShortBuss = 0.000326; + IIRscaleback /= overallscale; + bassScaleback /= overallscale; + trebleScaleback /= overallscale; + addBassBuss /= overallscale; + addTrebBuss /= overallscale; + addShortBuss /= overallscale; + double limitingBass = 0.39; + double limitingTreb = 0.6; + double limiting = 0.36; + double maxfeedBass = 0.972; + double maxfeedTreb = 0.972; + double maxfeed = 0.975; + double bridgerectifier; + long double inputSampleL; + double lowSampleL = 0.0; + double highSampleL; + double distSampleL; + double minusSampleL; + double plusSampleL; + long double inputSampleR; + double lowSampleR = 0.0; + double highSampleR; + double distSampleR; + double minusSampleR; + double plusSampleR; + double gain = pow(10.0,(A*24.0)/20); + double outlevel = B; + + while (--sampleFrames >= 0) + { + inputSampleL = *in1; + inputSampleR = *in2; + if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) { + static int noisesource = 0; + //this declares a variable before anything else is compiled. It won't keep assigning + //it to 0 for every sample, it's as if the declaration doesn't exist in this context, + //but it lets me add this denormalization fix in a single place rather than updating + //it in three different locations. The variable isn't thread-safe but this is only + //a random seed and we can share it with whatever. + noisesource = noisesource % 1700021; noisesource++; + int residue = noisesource * noisesource; + residue = residue % 170003; residue *= residue; + residue = residue % 17011; residue *= residue; + residue = residue % 1709; residue *= residue; + residue = residue % 173; residue *= residue; + residue = residue % 17; + double applyresidue = residue; + applyresidue *= 0.00000001; + applyresidue *= 0.00000001; + inputSampleL = applyresidue; + } + if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) { + static int noisesource = 0; + noisesource = noisesource % 1700021; noisesource++; + int residue = noisesource * noisesource; + residue = residue % 170003; residue *= residue; + residue = residue % 17011; residue *= residue; + residue = residue % 1709; residue *= residue; + residue = residue % 173; residue *= residue; + residue = residue % 17; + double applyresidue = residue; + applyresidue *= 0.00000001; + applyresidue *= 0.00000001; + inputSampleR = applyresidue; + //this denormalization routine produces a white noise at -300 dB which the noise + //shaping will interact with to produce a bipolar output, but the noise is actually + //all positive. That should stop any variables from going denormal, and the routine + //only kicks in if digital black is input. As a final touch, if you save to 24-bit + //the silence will return to being digital black again. + } + + inputSampleL *= gain; + inputSampleR *= gain; + + if (flip) + { + iirSampleAL = (iirSampleAL * 0.9) + (inputSampleL * 0.1); + lowSampleL = iirSampleAL; + iirSampleAR = (iirSampleAR * 0.9) + (inputSampleR * 0.1); + lowSampleR = iirSampleAR; + } + else + { + iirSampleBL = (iirSampleBL * 0.9) + (inputSampleL * 0.1); + lowSampleL = iirSampleBL; + iirSampleBR = (iirSampleBR * 0.9) + (inputSampleR * 0.1); + lowSampleR = iirSampleBR; + } + highSampleL = inputSampleL - lowSampleL; + highSampleR = inputSampleR - lowSampleR; + flip = !flip; + //we now have two bands and the original source + + inP2 = lowSampleL * lowSampleL; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= basslevL; + //second harmonic max +1 + if (basslevL > 0) basslevL -= bassScaleback; + if (basslevL < 0) basslevL += bassScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(lowSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleL > 0.0) distSampleL = bridgerectifier; + else distSampleL = -bridgerectifier; + minusSampleL = lowSampleL - distSampleL; + plusSampleL = lowSampleL + distSampleL; + if (minusSampleL > maxfeedBass) minusSampleL = maxfeedBass; + if (plusSampleL > maxfeedBass) plusSampleL = maxfeedBass; + if (plusSampleL < -maxfeedBass) plusSampleL = -maxfeedBass; + if (minusSampleL < -maxfeedBass) minusSampleL = -maxfeedBass; + if (lowSampleL > distSampleL) basslevL += (minusSampleL*addBassBuss); + if (lowSampleL < -distSampleL) basslevL -= (plusSampleL*addBassBuss); + if (basslevL > 1.0) basslevL = 1.0; + if (basslevL < -1.0) basslevL = -1.0; + bridgerectifier = fabs(lowSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleL > 0.0) lowSampleL = bridgerectifier; + else lowSampleL = -bridgerectifier; + //apply the distortion transform for reals + lowSampleL /= (1.0+fabs(basslevL*limitingBass)); + lowSampleL += chebyshev; + //apply the correction measuresL + + inP2 = lowSampleR * lowSampleR; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= basslevR; + //second harmonic max +1 + if (basslevR > 0) basslevR -= bassScaleback; + if (basslevR < 0) basslevR += bassScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(lowSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleR > 0.0) distSampleR = bridgerectifier; + else distSampleR = -bridgerectifier; + minusSampleR = lowSampleR - distSampleR; + plusSampleR = lowSampleR + distSampleR; + if (minusSampleR > maxfeedBass) minusSampleR = maxfeedBass; + if (plusSampleR > maxfeedBass) plusSampleR = maxfeedBass; + if (plusSampleR < -maxfeedBass) plusSampleR = -maxfeedBass; + if (minusSampleR < -maxfeedBass) minusSampleR = -maxfeedBass; + if (lowSampleR > distSampleR) basslevR += (minusSampleR*addBassBuss); + if (lowSampleR < -distSampleR) basslevR -= (plusSampleR*addBassBuss); + if (basslevR > 1.0) basslevR = 1.0; + if (basslevR < -1.0) basslevR = -1.0; + bridgerectifier = fabs(lowSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (lowSampleR > 0.0) lowSampleR = bridgerectifier; + else lowSampleR = -bridgerectifier; + //apply the distortion transform for reals + lowSampleR /= (1.0+fabs(basslevR*limitingBass)); + lowSampleR += chebyshev; + //apply the correction measuresR + + inP2 = highSampleL * highSampleL; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= treblevL; + //second harmonic max +1 + if (treblevL > 0) treblevL -= trebleScaleback; + if (treblevL < 0) treblevL += trebleScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(highSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleL > 0.0) distSampleL = bridgerectifier; + else distSampleL = -bridgerectifier; + minusSampleL = highSampleL - distSampleL; + plusSampleL = highSampleL + distSampleL; + if (minusSampleL > maxfeedTreb) minusSampleL = maxfeedTreb; + if (plusSampleL > maxfeedTreb) plusSampleL = maxfeedTreb; + if (plusSampleL < -maxfeedTreb) plusSampleL = -maxfeedTreb; + if (minusSampleL < -maxfeedTreb) minusSampleL = -maxfeedTreb; + if (highSampleL > distSampleL) treblevL += (minusSampleL*addTrebBuss); + if (highSampleL < -distSampleL) treblevL -= (plusSampleL*addTrebBuss); + if (treblevL > 1.0) treblevL = 1.0; + if (treblevL < -1.0) treblevL = -1.0; + bridgerectifier = fabs(highSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleL > 0.0) highSampleL = bridgerectifier; + else highSampleL = -bridgerectifier; + //apply the distortion transform for reals + highSampleL /= (1.0+fabs(treblevL*limitingTreb)); + highSampleL += chebyshev; + //apply the correction measuresL + + inP2 = highSampleR * highSampleR; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= treblevR; + //second harmonic max +1 + if (treblevR > 0) treblevR -= trebleScaleback; + if (treblevR < 0) treblevR += trebleScaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(highSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleR > 0.0) distSampleR = bridgerectifier; + else distSampleR = -bridgerectifier; + minusSampleR = highSampleR - distSampleR; + plusSampleR = highSampleR + distSampleR; + if (minusSampleR > maxfeedTreb) minusSampleR = maxfeedTreb; + if (plusSampleR > maxfeedTreb) plusSampleR = maxfeedTreb; + if (plusSampleR < -maxfeedTreb) plusSampleR = -maxfeedTreb; + if (minusSampleR < -maxfeedTreb) minusSampleR = -maxfeedTreb; + if (highSampleR > distSampleR) treblevR += (minusSampleR*addTrebBuss); + if (highSampleR < -distSampleR) treblevR -= (plusSampleR*addTrebBuss); + if (treblevR > 1.0) treblevR = 1.0; + if (treblevR < -1.0) treblevR = -1.0; + bridgerectifier = fabs(highSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (highSampleR > 0.0) highSampleR = bridgerectifier; + else highSampleR = -bridgerectifier; + //apply the distortion transform for reals + highSampleR /= (1.0+fabs(treblevR*limitingTreb)); + highSampleR += chebyshev; + //apply the correction measuresR + + inputSampleL = lowSampleL + highSampleL; + inputSampleR = lowSampleR + highSampleR; + + inP2 = inputSampleL * inputSampleL; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= cheblevL; + //third harmonic max -1 + if (cheblevL > 0) cheblevL -= (IIRscaleback); + if (cheblevL < 0) cheblevL += (IIRscaleback); + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(inputSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) distSampleL = bridgerectifier; + else distSampleL = -bridgerectifier; + minusSampleL = inputSampleL - distSampleL; + plusSampleL = inputSampleL + distSampleL; + if (minusSampleL > maxfeed) minusSampleL = maxfeed; + if (plusSampleL > maxfeed) plusSampleL = maxfeed; + if (plusSampleL < -maxfeed) plusSampleL = -maxfeed; + if (minusSampleL < -maxfeed) minusSampleL = -maxfeed; + if (inputSampleL > distSampleL) cheblevL += (minusSampleL*addShortBuss); + if (inputSampleL < -distSampleL) cheblevL -= (plusSampleL*addShortBuss); + if (cheblevL > 1.0) cheblevL = 1.0; + if (cheblevL < -1.0) cheblevL = -1.0; + bridgerectifier = fabs(inputSampleL); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleL > 0.0) inputSampleL = bridgerectifier; + else inputSampleL = -bridgerectifier; + //apply the distortion transform for reals + inputSampleL /= (1.0+fabs(cheblevL*limiting)); + inputSampleL += chebyshev; + //apply the correction measuresL + + inP2 = inputSampleR * inputSampleR; + if (inP2 > 1.0) inP2 = 1.0; if (inP2 < -1.0) inP2 = -1.0; + chebyshev = (2 * inP2); + chebyshev *= cheblevR; + //third harmonic max -1 + if (cheblevR > 0) cheblevR -= IIRscaleback; + if (cheblevR < 0) cheblevR += IIRscaleback; + //this is ShortBuss, IIRscaleback is the decay speed. *2 for second harmonic, and so on + bridgerectifier = fabs(inputSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) distSampleR = bridgerectifier; + else distSampleR = -bridgerectifier; + minusSampleR = inputSampleR - distSampleR; + plusSampleR = inputSampleR + distSampleR; + if (minusSampleR > maxfeed) minusSampleR = maxfeed; + if (plusSampleR > maxfeed) plusSampleR = maxfeed; + if (plusSampleR < -maxfeed) plusSampleR = -maxfeed; + if (minusSampleR < -maxfeed) minusSampleR = -maxfeed; + if (inputSampleR > distSampleR) cheblevR += (minusSampleR*addShortBuss); + if (inputSampleR < -distSampleR) cheblevR -= (plusSampleR*addShortBuss); + if (cheblevR > 1.0) cheblevR = 1.0; + if (cheblevR < -1.0) cheblevR = -1.0; + bridgerectifier = fabs(inputSampleR); + if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633; + //max value for sine function + bridgerectifier = sin(bridgerectifier); + if (inputSampleR > 0.0) inputSampleR = bridgerectifier; + else inputSampleR = -bridgerectifier; + //apply the distortion transform for reals + inputSampleR /= (1.0+fabs(cheblevR*limiting)); + inputSampleR += chebyshev; + //apply the correction measuresR + + if (outlevel < 1.0) { + inputSampleL *= outlevel; + inputSampleR *= outlevel; + } + + if (inputSampleL > 0.95) inputSampleL = 0.95; + if (inputSampleL < -0.95) inputSampleL = -0.95; + if (inputSampleR > 0.95) inputSampleR = 0.95; + if (inputSampleR < -0.95) inputSampleR = -0.95; + //iron bar + + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither + + *out1 = inputSampleL; + *out2 = inputSampleR; + + *in1++; + *in2++; + *out1++; + *out2++; + } +}
\ No newline at end of file diff --git a/plugins/WinVST/NC-17/VSTProject.sln b/plugins/WinVST/NC-17/VSTProject.sln new file mode 100755 index 0000000..694b424 --- /dev/null +++ b/plugins/WinVST/NC-17/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/NC-17/VSTProject.vcxproj b/plugins/WinVST/NC-17/VSTProject.vcxproj new file mode 100755 index 0000000..06ea4cd --- /dev/null +++ b/plugins/WinVST/NC-17/VSTProject.vcxproj @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.cpp" />
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.cpp" />
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\vstplugmain.cpp" />
+ <ClCompile Include="NCSeventeen.cpp" />
+ <ClCompile Include="NCSeventeenProc.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\aeffeditor.h" />
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.h" />
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.h" />
+ <ClInclude Include="NCSeventeen.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{16F7AB3C-1AE0-4574-B60C-7B4DED82938C}</ProjectGuid>
+ <RootNamespace>VSTProject</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ <ProjectName>NC-1764</ProjectName>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140</PlatformToolset>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <TargetExt>.dll</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+ <IntDir>$(Configuration)\</IntDir>
+ <ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH)</ExecutablePath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <MinimalRebuild>false</MinimalRebuild>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>false</MinimalRebuild>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;libc.lib;libcd.lib;libcmt.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>false</FunctionLevelLinking>
+ <IntrinsicFunctions>false</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <AdditionalIncludeDirectories>C:\Users\christopherjohnson\Documents\Visual Studio 2015\Projects\VSTProject\vst2.x;C:\Users\christopherjohnson\Documents\vstsdk2.4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>WINDOWS;_WINDOWS;WIN32;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;VST_FORCE_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <IgnoreSpecificDefaultLibraries>libcmt.dll;libcmtd.dll;msvcrt.lib;libc.lib;libcd.lib;libcmt.lib;msvcrtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
+ <AdditionalDependencies>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)</AdditionalDependencies>
+ <ModuleDefinitionFile>vstplug.def</ModuleDefinitionFile>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/WinVST/NC-17/VSTProject.vcxproj.filters b/plugins/WinVST/NC-17/VSTProject.vcxproj.filters new file mode 100755 index 0000000..266110e --- /dev/null +++ b/plugins/WinVST/NC-17/VSTProject.vcxproj.filters @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\vstplugmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="NCSeventeen.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="NCSeventeenProc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\aeffeditor.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffect.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\..\vstsdk2.4\public.sdk\source\vst2.x\audioeffectx.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="NCSeventeen.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/WinVST/NC-17/VSTProject.vcxproj.user b/plugins/WinVST/NC-17/VSTProject.vcxproj.user new file mode 100755 index 0000000..2216267 --- /dev/null +++ b/plugins/WinVST/NC-17/VSTProject.vcxproj.user @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator>
+ <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+</Project>
\ No newline at end of file diff --git a/plugins/WinVST/NC-17/vstplug.def b/plugins/WinVST/NC-17/vstplug.def new file mode 100755 index 0000000..5bf499a --- /dev/null +++ b/plugins/WinVST/NC-17/vstplug.def @@ -0,0 +1,3 @@ +EXPORTS
+ VSTPluginMain
+ main=VSTPluginMain
\ No newline at end of file diff --git a/plugins/WinVST/Noise/.vs/VSTProject/v14/.suo b/plugins/WinVST/Noise/.vs/VSTProject/v14/.suo Binary files differindex 78a0fe9..082f829 100755 --- a/plugins/WinVST/Noise/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Noise/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Noise/Noise.cpp b/plugins/WinVST/Noise/Noise.cpp index 76d00c8..d955a29 100755 --- a/plugins/WinVST/Noise/Noise.cpp +++ b/plugins/WinVST/Noise/Noise.cpp @@ -36,11 +36,8 @@ Noise::Noise(audioMasterCallback audioMaster) : flipR = false; filterflip = false; for(int count = 0; count < 11; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;} - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Noise/Noise.h b/plugins/WinVST/Noise/Noise.h index 0ee4d76..67c32bc 100755 --- a/plugins/WinVST/Noise/Noise.h +++ b/plugins/WinVST/Noise/Noise.h @@ -81,11 +81,8 @@ private: double f[11]; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Noise/NoiseProc.cpp b/plugins/WinVST/Noise/NoiseProc.cpp index e185120..31cba20 100755 --- a/plugins/WinVST/Noise/NoiseProc.cpp +++ b/plugins/WinVST/Noise/NoiseProc.cpp @@ -104,9 +104,6 @@ void Noise::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra f[9] /= overallscale; //and now it's neatly scaled, too - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; @@ -299,25 +296,14 @@ void Noise::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra //sometimes I'm really tired and can't do stuff, and I remember trying to simplify this //and breaking it somehow. So, there ya go, strange obtuse code. - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -426,9 +412,6 @@ void Noise::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s f[9] /= overallscale; //and now it's neatly scaled, too - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -619,25 +602,16 @@ void Noise::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s //sometimes I'm really tired and can't do stuff, and I remember trying to simplify this //and breaking it somehow. So, there ya go, strange obtuse code. - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/NonlinearSpace/.vs/VSTProject/v14/.suo b/plugins/WinVST/NonlinearSpace/.vs/VSTProject/v14/.suo Binary files differindex 7a7784d..975efbe 100755 --- a/plugins/WinVST/NonlinearSpace/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/NonlinearSpace/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/NonlinearSpace/NonlinearSpace.cpp b/plugins/WinVST/NonlinearSpace/NonlinearSpace.cpp index 6941556..eb05bc3 100755 --- a/plugins/WinVST/NonlinearSpace/NonlinearSpace.cpp +++ b/plugins/WinVST/NonlinearSpace/NonlinearSpace.cpp @@ -195,11 +195,8 @@ NonlinearSpace::NonlinearSpace(audioMasterCallback audioMaster) : countdown = -1; flip = true; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/NonlinearSpace/NonlinearSpace.h b/plugins/WinVST/NonlinearSpace/NonlinearSpace.h index e915b21..dbaa0b3 100755 --- a/plugins/WinVST/NonlinearSpace/NonlinearSpace.h +++ b/plugins/WinVST/NonlinearSpace/NonlinearSpace.h @@ -208,11 +208,8 @@ private: double nonlin; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/NonlinearSpace/NonlinearSpaceProc.cpp b/plugins/WinVST/NonlinearSpace/NonlinearSpaceProc.cpp index 597e184..f9df9fc 100755 --- a/plugins/WinVST/NonlinearSpace/NonlinearSpaceProc.cpp +++ b/plugins/WinVST/NonlinearSpace/NonlinearSpaceProc.cpp @@ -14,9 +14,6 @@ void NonlinearSpace::processReplacing(float **inputs, float **outputs, VstInt32 float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -746,25 +743,14 @@ void NonlinearSpace::processReplacing(float **inputs, float **outputs, VstInt32 inputSampleR += drySampleR; //here we combine the tanks with the dry signal - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither flip = !flip; *out1 = inputSampleL; @@ -784,9 +770,6 @@ void NonlinearSpace::processDoubleReplacing(double **inputs, double **outputs, V double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -1516,25 +1499,16 @@ void NonlinearSpace::processDoubleReplacing(double **inputs, double **outputs, V inputSampleR += drySampleR; //here we combine the tanks with the dry signal - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither flip = !flip; *out1 = inputSampleL; diff --git a/plugins/WinVST/OneCornerClip/.vs/VSTProject/v14/.suo b/plugins/WinVST/OneCornerClip/.vs/VSTProject/v14/.suo Binary files differindex 18173df..f5ef448 100755 --- a/plugins/WinVST/OneCornerClip/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/OneCornerClip/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/OneCornerClip/OneCornerClip.cpp b/plugins/WinVST/OneCornerClip/OneCornerClip.cpp index bf8828e..59e2824 100755 --- a/plugins/WinVST/OneCornerClip/OneCornerClip.cpp +++ b/plugins/WinVST/OneCornerClip/OneCornerClip.cpp @@ -25,11 +25,8 @@ OneCornerClip::OneCornerClip(audioMasterCallback audioMaster) : limitPosR = 0.0; limitNegR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/OneCornerClip/OneCornerClip.h b/plugins/WinVST/OneCornerClip/OneCornerClip.h index 07f480a..4f039fa 100755 --- a/plugins/WinVST/OneCornerClip/OneCornerClip.h +++ b/plugins/WinVST/OneCornerClip/OneCornerClip.h @@ -56,11 +56,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double lastSampleL; diff --git a/plugins/WinVST/OneCornerClip/OneCornerClipProc.cpp b/plugins/WinVST/OneCornerClip/OneCornerClipProc.cpp index 0398b60..c45c69b 100755 --- a/plugins/WinVST/OneCornerClip/OneCornerClipProc.cpp +++ b/plugins/WinVST/OneCornerClip/OneCornerClipProc.cpp @@ -17,9 +17,6 @@ void OneCornerClip::processReplacing(float **inputs, float **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputGain = pow(10.0,(((A*36.0)-12.0)/20.0)); double posThreshold = B; @@ -157,25 +154,14 @@ void OneCornerClip::processReplacing(float **inputs, float **outputs, VstInt32 s inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither if (clipEngage == false) { @@ -204,9 +190,6 @@ void OneCornerClip::processDoubleReplacing(double **inputs, double **outputs, Vs double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputGain = pow(10.0,(((A*36.0)-12.0)/20.0)); double posThreshold = B; @@ -345,25 +328,16 @@ void OneCornerClip::processDoubleReplacing(double **inputs, double **outputs, Vs inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither if (clipEngage == false) { diff --git a/plugins/WinVST/PDBuss/.vs/VSTProject/v14/.suo b/plugins/WinVST/PDBuss/.vs/VSTProject/v14/.suo Binary files differindex ac1db30..dc3eb7b 100755 --- a/plugins/WinVST/PDBuss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PDBuss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PDBuss/PDBuss.cpp b/plugins/WinVST/PDBuss/PDBuss.cpp index 323d8cf..8b31d8b 100755 --- a/plugins/WinVST/PDBuss/PDBuss.cpp +++ b/plugins/WinVST/PDBuss/PDBuss.cpp @@ -21,11 +21,8 @@ PDBuss::PDBuss(audioMasterCallback audioMaster) : previousSampleL = 0.0; previousSampleR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PDBuss/PDBuss.h b/plugins/WinVST/PDBuss/PDBuss.h index 5c7a504..3e6d9b8 100755 --- a/plugins/WinVST/PDBuss/PDBuss.h +++ b/plugins/WinVST/PDBuss/PDBuss.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double gainchase; double settingchase; diff --git a/plugins/WinVST/PDBuss/PDBussProc.cpp b/plugins/WinVST/PDBuss/PDBussProc.cpp index c099057..6da8fa0 100755 --- a/plugins/WinVST/PDBuss/PDBussProc.cpp +++ b/plugins/WinVST/PDBuss/PDBussProc.cpp @@ -13,9 +13,6 @@ void PDBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double intensity = B; @@ -122,25 +119,14 @@ void PDBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -158,9 +144,6 @@ void PDBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double intensity = B; @@ -267,25 +250,16 @@ void PDBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/PDChannel/.vs/VSTProject/v14/.suo b/plugins/WinVST/PDChannel/.vs/VSTProject/v14/.suo Binary files differindex 5debbed..3c18924 100755 --- a/plugins/WinVST/PDChannel/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PDChannel/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PDChannel/PDChannel.cpp b/plugins/WinVST/PDChannel/PDChannel.cpp index d300fc8..aef639d 100755 --- a/plugins/WinVST/PDChannel/PDChannel.cpp +++ b/plugins/WinVST/PDChannel/PDChannel.cpp @@ -21,11 +21,8 @@ PDChannel::PDChannel(audioMasterCallback audioMaster) : previousSampleL = 0.0; previousSampleR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PDChannel/PDChannel.h b/plugins/WinVST/PDChannel/PDChannel.h index e92117c..ea233e2 100755 --- a/plugins/WinVST/PDChannel/PDChannel.h +++ b/plugins/WinVST/PDChannel/PDChannel.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double gainchase; double settingchase; diff --git a/plugins/WinVST/PDChannel/PDChannelProc.cpp b/plugins/WinVST/PDChannel/PDChannelProc.cpp index d8f79df..fb5932d 100755 --- a/plugins/WinVST/PDChannel/PDChannelProc.cpp +++ b/plugins/WinVST/PDChannel/PDChannelProc.cpp @@ -13,9 +13,6 @@ void PDChannel::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double intensity = B; @@ -115,25 +112,14 @@ void PDChannel::processReplacing(float **inputs, float **outputs, VstInt32 sampl previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -151,9 +137,6 @@ void PDChannel::processDoubleReplacing(double **inputs, double **outputs, VstInt double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputgain = A; double intensity = B; @@ -253,25 +236,16 @@ void PDChannel::processDoubleReplacing(double **inputs, double **outputs, VstInt previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/PhaseNudge/.vs/VSTProject/v14/.suo b/plugins/WinVST/PhaseNudge/.vs/VSTProject/v14/.suo Binary files differindex 11ae01b..f0b5d94 100755 --- a/plugins/WinVST/PhaseNudge/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PhaseNudge/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PhaseNudge/PhaseNudge.cpp b/plugins/WinVST/PhaseNudge/PhaseNudge.cpp index 8a77175..e9e5c8d 100755 --- a/plugins/WinVST/PhaseNudge/PhaseNudge.cpp +++ b/plugins/WinVST/PhaseNudge/PhaseNudge.cpp @@ -16,11 +16,8 @@ PhaseNudge::PhaseNudge(audioMasterCallback audioMaster) : B = 1.0; for(int count = 0; count < 1502; count++) {dL[count] = 0.0; dR[count] = 0.0;} one = 1; maxdelay = 9001; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PhaseNudge/PhaseNudge.h b/plugins/WinVST/PhaseNudge/PhaseNudge.h index cba0ac8..2926ccb 100755 --- a/plugins/WinVST/PhaseNudge/PhaseNudge.h +++ b/plugins/WinVST/PhaseNudge/PhaseNudge.h @@ -57,11 +57,8 @@ private: double dR[1503]; int one, maxdelay; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/PhaseNudge/PhaseNudgeProc.cpp b/plugins/WinVST/PhaseNudge/PhaseNudgeProc.cpp index 494c841..150ecd5 100755 --- a/plugins/WinVST/PhaseNudge/PhaseNudgeProc.cpp +++ b/plugins/WinVST/PhaseNudge/PhaseNudgeProc.cpp @@ -14,9 +14,6 @@ void PhaseNudge::processReplacing(float **inputs, float **outputs, VstInt32 samp float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; int allpasstemp; double outallpass = 0.618033988749894848204586; //golden ratio! @@ -136,25 +133,14 @@ void PhaseNudge::processReplacing(float **inputs, float **outputs, VstInt32 samp inputSampleR = (drySampleR * dry)+(inputSampleR * wet); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -173,9 +159,6 @@ void PhaseNudge::processDoubleReplacing(double **inputs, double **outputs, VstIn double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; int allpasstemp; double outallpass = 0.618033988749894848204586; //golden ratio! @@ -294,25 +277,16 @@ void PhaseNudge::processDoubleReplacing(double **inputs, double **outputs, VstIn inputSampleR = (drySampleR * dry)+(inputSampleR * wet); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Point/.vs/VSTProject/v14/.suo b/plugins/WinVST/Point/.vs/VSTProject/v14/.suo Binary files differindex 8ad608b..b4a9ec3 100755 --- a/plugins/WinVST/Point/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Point/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Point/Point.cpp b/plugins/WinVST/Point/Point.cpp index 22885b5..f795470 100755 --- a/plugins/WinVST/Point/Point.cpp +++ b/plugins/WinVST/Point/Point.cpp @@ -24,10 +24,8 @@ Point::Point(audioMasterCallback audioMaster) : nibBR = 0.0; nobBR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/WinVST/Point/Point.h b/plugins/WinVST/Point/Point.h index 12c8001..ff898cb 100755 --- a/plugins/WinVST/Point/Point.h +++ b/plugins/WinVST/Point/Point.h @@ -54,10 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; + long double fpNShapeL; + long double fpNShapeR; bool fpFlip; //default stuff double nibAL; diff --git a/plugins/WinVST/Point/PointProc.cpp b/plugins/WinVST/Point/PointProc.cpp index a00263d..a3bbe3c 100755 --- a/plugins/WinVST/Point/PointProc.cpp +++ b/plugins/WinVST/Point/PointProc.cpp @@ -27,9 +27,6 @@ void Point::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double nibnobFactor = 0.0; //start with the fallthrough value, why not double absolute; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -128,26 +125,16 @@ void Point::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra } } inputSampleR *= nibnobFactor; - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 32 bit output + + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -179,9 +166,6 @@ void Point::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double nibnobFactor = 0.0; //start with the fallthrough value, why not double absolute; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -280,26 +264,18 @@ void Point::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s } } inputSampleR *= nibnobFactor; - - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } fpFlip = !fpFlip; - //end noise shaping on 64 bit output + + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Pop/.vs/VSTProject/v14/.suo b/plugins/WinVST/Pop/.vs/VSTProject/v14/.suo Binary files differindex 3af8535..4126984 100755 --- a/plugins/WinVST/Pop/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Pop/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Pop/PopProc.cpp b/plugins/WinVST/Pop/PopProc.cpp index ae7dd4d..baa9420 100755 --- a/plugins/WinVST/Pop/PopProc.cpp +++ b/plugins/WinVST/Pop/PopProc.cpp @@ -268,18 +268,14 @@ void Pop::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame inputSampleR = (drySampleR*(1.0-wet))+(inputSampleR*wet); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -289,12 +285,6 @@ void Pop::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Pop::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -558,18 +548,16 @@ void Pop::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam inputSampleR = (drySampleR*(1.0-wet))+(inputSampleR*wet); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -579,10 +567,4 @@ void Pop::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/PowerSag/.vs/VSTProject/v14/.suo b/plugins/WinVST/PowerSag/.vs/VSTProject/v14/.suo Binary files differindex b1569f1..b258318 100755 --- a/plugins/WinVST/PowerSag/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PowerSag/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PowerSag/PowerSag.cpp b/plugins/WinVST/PowerSag/PowerSag.cpp index 0218186..d1d0745 100755 --- a/plugins/WinVST/PowerSag/PowerSag.cpp +++ b/plugins/WinVST/PowerSag/PowerSag.cpp @@ -18,11 +18,8 @@ PowerSag::PowerSag(audioMasterCallback audioMaster) : gcount = 0; A = 0.0; B = 0.3; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PowerSag/PowerSag.h b/plugins/WinVST/PowerSag/PowerSag.h index 930f05b..38839b6 100755 --- a/plugins/WinVST/PowerSag/PowerSag.h +++ b/plugins/WinVST/PowerSag/PowerSag.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double dL[9000]; double dR[9000]; diff --git a/plugins/WinVST/PowerSag/PowerSagProc.cpp b/plugins/WinVST/PowerSag/PowerSagProc.cpp index d1afa31..de43be6 100755 --- a/plugins/WinVST/PowerSag/PowerSagProc.cpp +++ b/plugins/WinVST/PowerSag/PowerSagProc.cpp @@ -22,9 +22,6 @@ void PowerSag::processReplacing(float **inputs, float **outputs, VstInt32 sample double out; double bridgerectifier; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -123,25 +120,14 @@ void PowerSag::processReplacing(float **inputs, float **outputs, VstInt32 sample gcount--; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -168,9 +154,6 @@ void PowerSag::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double out; double bridgerectifier; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -269,25 +252,16 @@ void PowerSag::processDoubleReplacing(double **inputs, double **outputs, VstInt3 gcount--; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo b/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo Binary files differindex a911044..b3e9f08 100755 --- a/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Pressure4/Pressure4.cpp b/plugins/WinVST/Pressure4/Pressure4.cpp index 8ae2adc..10ed5fa 100755 --- a/plugins/WinVST/Pressure4/Pressure4.cpp +++ b/plugins/WinVST/Pressure4/Pressure4.cpp @@ -16,10 +16,8 @@ Pressure4::Pressure4(audioMasterCallback audioMaster) : B = 0.2; C = 1.0; D = 1.0; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; muSpeedA = 10000; muSpeedB = 10000; muCoefficientA = 1; diff --git a/plugins/WinVST/Pressure4/Pressure4.h b/plugins/WinVST/Pressure4/Pressure4.h index 29d20eb..6cf3448 100755 --- a/plugins/WinVST/Pressure4/Pressure4.h +++ b/plugins/WinVST/Pressure4/Pressure4.h @@ -62,10 +62,8 @@ private: double muSpeedB; double muCoefficientA; double muCoefficientB; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; bool flip; float A; diff --git a/plugins/WinVST/Pressure4/Pressure4Proc.cpp b/plugins/WinVST/Pressure4/Pressure4Proc.cpp index 02b8a78..7e285df 100755 --- a/plugins/WinVST/Pressure4/Pressure4Proc.cpp +++ b/plugins/WinVST/Pressure4/Pressure4Proc.cpp @@ -43,9 +43,6 @@ void Pressure4::processReplacing(float **inputs, float **outputs, VstInt32 sampl unmewiness = 1.0-mewiness; } // µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~ - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -195,27 +192,14 @@ void Pressure4::processReplacing(float **inputs, float **outputs, VstInt32 sampl else {inputSampleR = -bridgerectifier;} //second stage of overdrive to prevent overs and allow bloody loud extremeness - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *outputL = inputSampleL; *outputR = inputSampleR; @@ -263,9 +247,6 @@ void Pressure4::processDoubleReplacing(double **inputs, double **outputs, VstInt unmewiness = 1.0-mewiness; } // µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~ - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -416,27 +397,16 @@ void Pressure4::processDoubleReplacing(double **inputs, double **outputs, VstInt else {inputSampleR = -bridgerectifier;} //second stage of overdrive to prevent overs and allow bloody loud extremeness - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *outputL = inputSampleL; *outputR = inputSampleR; diff --git a/plugins/WinVST/PurestConsoleBuss/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/PurestConsoleBuss/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/PurestConsoleBuss/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/PurestConsoleBuss/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestConsoleBuss/.vs/VSTProject/v14/.suo Binary files differindex be45c22..892a377 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestConsoleBuss/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.cpp b/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.cpp index ed0b223..2d8e619 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.cpp +++ b/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.cpp @@ -12,11 +12,8 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new P PurestConsoleBuss::PurestConsoleBuss(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.h b/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.h index 0d237ec..51495fc 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.h +++ b/plugins/WinVST/PurestConsoleBuss/PurestConsoleBuss.h @@ -51,11 +51,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff }; diff --git a/plugins/WinVST/PurestConsoleBuss/PurestConsoleBussProc.cpp b/plugins/WinVST/PurestConsoleBuss/PurestConsoleBussProc.cpp index c06258a..6211eeb 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/PurestConsoleBussProc.cpp +++ b/plugins/WinVST/PurestConsoleBuss/PurestConsoleBussProc.cpp @@ -14,9 +14,6 @@ void PurestConsoleBuss::processReplacing(float **inputs, float **outputs, VstInt float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -74,25 +71,14 @@ void PurestConsoleBuss::processReplacing(float **inputs, float **outputs, VstInt inputSampleR = asin(inputSampleR); //amplitude aspect - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -111,9 +97,6 @@ void PurestConsoleBuss::processDoubleReplacing(double **inputs, double **outputs double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -171,25 +154,16 @@ void PurestConsoleBuss::processDoubleReplacing(double **inputs, double **outputs inputSampleR = asin(inputSampleR); //amplitude aspect - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/PurestConsoleBuss/VSTProject.sln b/plugins/WinVST/PurestConsoleBuss/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/VSTProject.sln +++ b/plugins/WinVST/PurestConsoleBuss/VSTProject.sln diff --git a/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj b/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj index c4c86ff..c4c86ff 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj +++ b/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj diff --git a/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.filters b/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.filters index 9a9d0ad..9a9d0ad 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.filters +++ b/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.user b/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.user +++ b/plugins/WinVST/PurestConsoleBuss/VSTProject.vcxproj.user diff --git a/plugins/WinVST/PurestConsoleBuss/vstplug.def b/plugins/WinVST/PurestConsoleBuss/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/PurestConsoleBuss/vstplug.def +++ b/plugins/WinVST/PurestConsoleBuss/vstplug.def diff --git a/plugins/WinVST/PurestConsoleChannel/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/PurestConsoleChannel/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/PurestConsoleChannel/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/PurestConsoleChannel/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestConsoleChannel/.vs/VSTProject/v14/.suo Binary files differindex 506b762..1bcc2a5 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestConsoleChannel/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.cpp b/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.cpp index b9f3e04..35649a6 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.cpp +++ b/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.cpp @@ -12,11 +12,8 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new P PurestConsoleChannel::PurestConsoleChannel(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.h b/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.h index c0a1648..51e728f 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.h +++ b/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannel.h @@ -51,11 +51,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff }; diff --git a/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannelProc.cpp b/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannelProc.cpp index 630cba7..2fc513a 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannelProc.cpp +++ b/plugins/WinVST/PurestConsoleChannel/PurestConsoleChannelProc.cpp @@ -14,9 +14,6 @@ void PurestConsoleChannel::processReplacing(float **inputs, float **outputs, Vst float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -68,25 +65,14 @@ void PurestConsoleChannel::processReplacing(float **inputs, float **outputs, Vst inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -105,9 +91,6 @@ void PurestConsoleChannel::processDoubleReplacing(double **inputs, double **outp double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -159,25 +142,16 @@ void PurestConsoleChannel::processDoubleReplacing(double **inputs, double **outp inputSampleR = sin(inputSampleR); //amplitude aspect - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/PurestConsoleChannel/VSTProject.sln b/plugins/WinVST/PurestConsoleChannel/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/VSTProject.sln +++ b/plugins/WinVST/PurestConsoleChannel/VSTProject.sln diff --git a/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj b/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj index 8ed20f5..8ed20f5 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj +++ b/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj diff --git a/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.filters b/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.filters index 2e64344..2e64344 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.filters +++ b/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.user b/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.user +++ b/plugins/WinVST/PurestConsoleChannel/VSTProject.vcxproj.user diff --git a/plugins/WinVST/PurestConsoleChannel/vstplug.def b/plugins/WinVST/PurestConsoleChannel/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/PurestConsoleChannel/vstplug.def +++ b/plugins/WinVST/PurestConsoleChannel/vstplug.def diff --git a/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo Binary files differindex 2c7648b..b079ddd 100644..100755 --- a/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestDrive/PurestDrive.cpp b/plugins/WinVST/PurestDrive/PurestDrive.cpp index e2451fe..a1d9264 100644..100755 --- a/plugins/WinVST/PurestDrive/PurestDrive.cpp +++ b/plugins/WinVST/PurestDrive/PurestDrive.cpp @@ -17,11 +17,8 @@ PurestDrive::PurestDrive(audioMasterCallback audioMaster) : previousSampleL = 0.0; previousSampleR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PurestDrive/PurestDrive.h b/plugins/WinVST/PurestDrive/PurestDrive.h index 1f5b349..abcd65b 100644..100755 --- a/plugins/WinVST/PurestDrive/PurestDrive.h +++ b/plugins/WinVST/PurestDrive/PurestDrive.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double previousSampleL; diff --git a/plugins/WinVST/PurestDrive/PurestDriveProc.cpp b/plugins/WinVST/PurestDrive/PurestDriveProc.cpp index e453883..f5cc804 100644..100755 --- a/plugins/WinVST/PurestDrive/PurestDriveProc.cpp +++ b/plugins/WinVST/PurestDrive/PurestDriveProc.cpp @@ -14,9 +14,6 @@ void PurestDrive::processReplacing(float **inputs, float **outputs, VstInt32 sam float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = A; double drySampleL; @@ -90,25 +87,14 @@ void PurestDrive::processReplacing(float **inputs, float **outputs, VstInt32 sam previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -127,9 +113,6 @@ void PurestDrive::processDoubleReplacing(double **inputs, double **outputs, VstI double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = A; double drySampleL; @@ -204,25 +187,16 @@ void PurestDrive::processDoubleReplacing(double **inputs, double **outputs, VstI previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/PurestDrive/VSTProject.sln b/plugins/WinVST/PurestDrive/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.sln +++ b/plugins/WinVST/PurestDrive/VSTProject.sln diff --git a/plugins/WinVST/PurestDrive/VSTProject.vcxproj b/plugins/WinVST/PurestDrive/VSTProject.vcxproj index 15515bd..15515bd 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.vcxproj +++ b/plugins/WinVST/PurestDrive/VSTProject.vcxproj diff --git a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters index 1f8d945..1f8d945 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters +++ b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user +++ b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user diff --git a/plugins/WinVST/PurestDrive/vstplug.def b/plugins/WinVST/PurestDrive/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/PurestDrive/vstplug.def +++ b/plugins/WinVST/PurestDrive/vstplug.def diff --git a/plugins/WinVST/PurestEcho/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestEcho/.vs/VSTProject/v14/.suo Binary files differindex 1ddbf82..8746b94 100755 --- a/plugins/WinVST/PurestEcho/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestEcho/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestEcho/PurestEcho.cpp b/plugins/WinVST/PurestEcho/PurestEcho.cpp index 6b8c302..6bcaa3f 100755 --- a/plugins/WinVST/PurestEcho/PurestEcho.cpp +++ b/plugins/WinVST/PurestEcho/PurestEcho.cpp @@ -19,11 +19,8 @@ PurestEcho::PurestEcho(audioMasterCallback audioMaster) : E = 0.0; for(int count = 0; count < totalsamples-1; count++) {dL[count] = 0;dR[count] = 0;} gcount = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PurestEcho/PurestEcho.h b/plugins/WinVST/PurestEcho/PurestEcho.h index a298dd2..870e158 100755 --- a/plugins/WinVST/PurestEcho/PurestEcho.h +++ b/plugins/WinVST/PurestEcho/PurestEcho.h @@ -62,11 +62,8 @@ private: int gcount; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/PurestEcho/PurestEchoProc.cpp b/plugins/WinVST/PurestEcho/PurestEchoProc.cpp index 77e4b2f..e8e141c 100755 --- a/plugins/WinVST/PurestEcho/PurestEchoProc.cpp +++ b/plugins/WinVST/PurestEcho/PurestEchoProc.cpp @@ -76,9 +76,6 @@ void PurestEcho::processReplacing(float **inputs, float **outputs, VstInt32 samp double delaysBufferL; double delaysBufferR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -177,25 +174,14 @@ void PurestEcho::processReplacing(float **inputs, float **outputs, VstInt32 samp gcount--; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -276,9 +262,6 @@ void PurestEcho::processDoubleReplacing(double **inputs, double **outputs, VstIn double delaysBufferL; double delaysBufferR; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -377,25 +360,16 @@ void PurestEcho::processDoubleReplacing(double **inputs, double **outputs, VstIn gcount--; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/PurestGain/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/PurestGain/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/PurestGain/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/PurestGain/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/PurestGain/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestGain/.vs/VSTProject/v14/.suo Binary files differindex 60f3507..774fc5c 100644..100755 --- a/plugins/WinVST/PurestGain/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestGain/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestGain/PurestGain.cpp b/plugins/WinVST/PurestGain/PurestGain.cpp index 3091a12..b1b77fe 100644..100755 --- a/plugins/WinVST/PurestGain/PurestGain.cpp +++ b/plugins/WinVST/PurestGain/PurestGain.cpp @@ -18,11 +18,8 @@ PurestGain::PurestGain(audioMasterCallback audioMaster) : settingchase = -90.0; gainBchase = -90.0; chasespeed = 350.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PurestGain/PurestGain.h b/plugins/WinVST/PurestGain/PurestGain.h index 7869425..9e2baea 100644..100755 --- a/plugins/WinVST/PurestGain/PurestGain.h +++ b/plugins/WinVST/PurestGain/PurestGain.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double gainchase; double settingchase; diff --git a/plugins/WinVST/PurestGain/PurestGainProc.cpp b/plugins/WinVST/PurestGain/PurestGainProc.cpp index 38f2849..4aa6d96 100644..100755 --- a/plugins/WinVST/PurestGain/PurestGainProc.cpp +++ b/plugins/WinVST/PurestGain/PurestGainProc.cpp @@ -43,9 +43,6 @@ void PurestGain::processReplacing(float **inputs, float **outputs, VstInt32 samp //done with slow fade controller double outputgain; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -118,45 +115,19 @@ void PurestGain::processReplacing(float **inputs, float **outputs, VstInt32 samp if (1.0 == outputgain) { - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output *out1 = *in1; *out2 = *in2; } else { inputSampleL *= outputgain; inputSampleR *= outputgain; - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; } @@ -204,9 +175,6 @@ void PurestGain::processDoubleReplacing(double **inputs, double **outputs, VstIn //done with slow fade controller double outputgain; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -273,45 +241,21 @@ void PurestGain::processDoubleReplacing(double **inputs, double **outputs, VstIn if (1.0 == outputgain) { - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output *out1 = *in1; *out2 = *in2; } else { inputSampleL *= outputgain; inputSampleR *= outputgain; - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; } diff --git a/plugins/WinVST/PurestGain/VSTProject.sln b/plugins/WinVST/PurestGain/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/PurestGain/VSTProject.sln +++ b/plugins/WinVST/PurestGain/VSTProject.sln diff --git a/plugins/WinVST/PurestGain/VSTProject.vcxproj b/plugins/WinVST/PurestGain/VSTProject.vcxproj index 4c5b244..4c5b244 100644..100755 --- a/plugins/WinVST/PurestGain/VSTProject.vcxproj +++ b/plugins/WinVST/PurestGain/VSTProject.vcxproj diff --git a/plugins/WinVST/PurestGain/VSTProject.vcxproj.filters b/plugins/WinVST/PurestGain/VSTProject.vcxproj.filters index 9b1f09e..9b1f09e 100644..100755 --- a/plugins/WinVST/PurestGain/VSTProject.vcxproj.filters +++ b/plugins/WinVST/PurestGain/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/PurestGain/VSTProject.vcxproj.user b/plugins/WinVST/PurestGain/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/PurestGain/VSTProject.vcxproj.user +++ b/plugins/WinVST/PurestGain/VSTProject.vcxproj.user diff --git a/plugins/WinVST/PurestGain/vstplug.def b/plugins/WinVST/PurestGain/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/PurestGain/vstplug.def +++ b/plugins/WinVST/PurestGain/vstplug.def diff --git a/plugins/WinVST/PurestWarm/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestWarm/.vs/VSTProject/v14/.suo Binary files differindex 91f4254..4f4d82d 100755 --- a/plugins/WinVST/PurestWarm/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestWarm/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestWarm/PurestWarm.cpp b/plugins/WinVST/PurestWarm/PurestWarm.cpp index 475e845..eeee37b 100755 --- a/plugins/WinVST/PurestWarm/PurestWarm.cpp +++ b/plugins/WinVST/PurestWarm/PurestWarm.cpp @@ -13,11 +13,8 @@ PurestWarm::PurestWarm(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { A = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/PurestWarm/PurestWarm.h b/plugins/WinVST/PurestWarm/PurestWarm.h index c67a91e..98bb0ce 100755 --- a/plugins/WinVST/PurestWarm/PurestWarm.h +++ b/plugins/WinVST/PurestWarm/PurestWarm.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/PurestWarm/PurestWarmProc.cpp b/plugins/WinVST/PurestWarm/PurestWarmProc.cpp index b5a5070..101c931 100755 --- a/plugins/WinVST/PurestWarm/PurestWarmProc.cpp +++ b/plugins/WinVST/PurestWarm/PurestWarmProc.cpp @@ -14,9 +14,6 @@ void PurestWarm::processReplacing(float **inputs, float **outputs, VstInt32 samp float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; int polarity = (int) ( A * 1.999 ); @@ -71,103 +68,55 @@ void PurestWarm::processReplacing(float **inputs, float **outputs, VstInt32 samp if (inputSampleL < 0) { inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - } + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither } - if (inputSampleR < 0) { inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - } + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither } - } else { - if (inputSampleL > 0) { inputSampleL = sin(inputSampleL*1.57079634)/1.57079634; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - } - } + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither + } if (inputSampleR > 0) { inputSampleR = sin(inputSampleR*1.57079634)/1.57079634; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - } - } - + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither + } } //that's it. Only applies on one half of the waveform, other half is passthrough untouched. - //even the floating point noise shaping to the 32 bit buss is only applied as needed. - - fpFlip = !fpFlip; - //end noise shaping on 32 bit output *out1 = inputSampleL; *out2 = inputSampleR; @@ -186,9 +135,6 @@ void PurestWarm::processDoubleReplacing(double **inputs, double **outputs, VstIn double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; int polarity = (int) ( A * 1.999 ); @@ -243,103 +189,63 @@ void PurestWarm::processDoubleReplacing(double **inputs, double **outputs, VstIn if (inputSampleL < 0) { inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634); - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither } if (inputSampleR < 0) { inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634); - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither } - } else { - if (inputSampleL > 0) { inputSampleL = sin(inputSampleL*1.57079634)/1.57079634; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - } else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither } - if (inputSampleR > 0) { inputSampleR = sin(inputSampleR*1.57079634)/1.57079634; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - } else { - if (fpFlip) { - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - } else { - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither } - } //that's it. Only applies on one half of the waveform, other half is passthrough untouched. - //even the floating point noise shaping to the 32 bit buss is only applied as needed. - - fpFlip = !fpFlip; - //end noise shaping on 64 bit output *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Pyewacket/.vs/VSTProject/v14/.suo b/plugins/WinVST/Pyewacket/.vs/VSTProject/v14/.suo Binary files differindex be9ac10..ac34ff7 100755 --- a/plugins/WinVST/Pyewacket/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Pyewacket/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Pyewacket/Pyewacket.cpp b/plugins/WinVST/Pyewacket/Pyewacket.cpp index ee2db40..d500e74 100755 --- a/plugins/WinVST/Pyewacket/Pyewacket.cpp +++ b/plugins/WinVST/Pyewacket/Pyewacket.cpp @@ -18,11 +18,8 @@ Pyewacket::Pyewacket(audioMasterCallback audioMaster) : chase = 1.0; lastrectifierL = 0.0; lastrectifierR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Pyewacket/Pyewacket.h b/plugins/WinVST/Pyewacket/Pyewacket.h index 593001f..087a198 100755 --- a/plugins/WinVST/Pyewacket/Pyewacket.h +++ b/plugins/WinVST/Pyewacket/Pyewacket.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double chase; double lastrectifierL; diff --git a/plugins/WinVST/Pyewacket/PyewacketProc.cpp b/plugins/WinVST/Pyewacket/PyewacketProc.cpp index 83112a2..8b3021a 100755 --- a/plugins/WinVST/Pyewacket/PyewacketProc.cpp +++ b/plugins/WinVST/Pyewacket/PyewacketProc.cpp @@ -17,9 +17,8 @@ void Pyewacket::processReplacing(float **inputs, float **outputs, VstInt32 sampl double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; + long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double drySampleL; @@ -134,25 +133,14 @@ void Pyewacket::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR *= outputGain; } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -174,9 +162,8 @@ void Pyewacket::processDoubleReplacing(double **inputs, double **outputs, VstInt double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; + long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double drySampleL; @@ -291,25 +278,16 @@ void Pyewacket::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR *= outputGain; } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Righteous4/.vs/VSTProject/v14/.suo b/plugins/WinVST/Righteous4/.vs/VSTProject/v14/.suo Binary files differindex f2ac424..4b43c9e 100755 --- a/plugins/WinVST/Righteous4/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Righteous4/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Righteous4/Righteous4Proc.cpp b/plugins/WinVST/Righteous4/Righteous4Proc.cpp index 7ed44cf..630360f 100755 --- a/plugins/WinVST/Righteous4/Righteous4Proc.cpp +++ b/plugins/WinVST/Righteous4/Righteous4Proc.cpp @@ -300,17 +300,14 @@ void Righteous4::processReplacing(float **inputs, float **outputs, VstInt32 samp //output dither section if (bitDepth == 3) { - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither } else { //entire Naturalize section used when not on 32 bit out @@ -515,12 +512,6 @@ void Righteous4::processReplacing(float **inputs, float **outputs, VstInt32 samp *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Righteous4::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -529,11 +520,11 @@ void Righteous4::processDoubleReplacing(double **inputs, double **outputs, VstIn double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); + long double fpOld = 0.618033988749894848204586; //golden ratio! + long double fpNew = 1.0 - fpOld; double IIRscaleback = 0.0002597;//scaleback of harmonic avg IIRscaleback /= overallscale; IIRscaleback = 1.0 - IIRscaleback; @@ -816,17 +807,16 @@ void Righteous4::processDoubleReplacing(double **inputs, double **outputs, VstIn //output dither section if (bitDepth == 3) { - //noise shaping to 32-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither } else { //entire Naturalize section used when not on 32 bit out @@ -1031,10 +1021,4 @@ void Righteous4::processDoubleReplacing(double **inputs, double **outputs, VstIn *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. }
\ No newline at end of file diff --git a/plugins/WinVST/SideDull/.vs/VSTProject/v14/.suo b/plugins/WinVST/SideDull/.vs/VSTProject/v14/.suo Binary files differindex 68a45bd..20df521 100755 --- a/plugins/WinVST/SideDull/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/SideDull/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/SideDull/SideDull.cpp b/plugins/WinVST/SideDull/SideDull.cpp index 547f1fd..479bdfd 100755 --- a/plugins/WinVST/SideDull/SideDull.cpp +++ b/plugins/WinVST/SideDull/SideDull.cpp @@ -16,10 +16,8 @@ SideDull::SideDull(audioMasterCallback audioMaster) : iirSampleA = 0.0; iirSampleB = 0.0; flip = true; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/SideDull/SideDull.h b/plugins/WinVST/SideDull/SideDull.h index 6f431ac..ef5e892 100755 --- a/plugins/WinVST/SideDull/SideDull.h +++ b/plugins/WinVST/SideDull/SideDull.h @@ -55,10 +55,8 @@ private: double iirSampleA; double iirSampleB; bool flip; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; float A; }; diff --git a/plugins/WinVST/SideDull/SideDullProc.cpp b/plugins/WinVST/SideDull/SideDullProc.cpp index 347e5e8..7b77744 100755 --- a/plugins/WinVST/SideDull/SideDullProc.cpp +++ b/plugins/WinVST/SideDull/SideDullProc.cpp @@ -17,9 +17,6 @@ void SideDull::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -88,27 +85,14 @@ void SideDull::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -130,9 +114,6 @@ void SideDull::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -201,27 +182,16 @@ void SideDull::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Sidepass/.vs/VSTProject/v14/.suo b/plugins/WinVST/Sidepass/.vs/VSTProject/v14/.suo Binary files differindex 5aee656..f8060d2 100755 --- a/plugins/WinVST/Sidepass/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Sidepass/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Sidepass/Sidepass.cpp b/plugins/WinVST/Sidepass/Sidepass.cpp index 98f6f3a..a28c212 100755 --- a/plugins/WinVST/Sidepass/Sidepass.cpp +++ b/plugins/WinVST/Sidepass/Sidepass.cpp @@ -16,10 +16,8 @@ Sidepass::Sidepass(audioMasterCallback audioMaster) : iirSampleA = 0.0; iirSampleB = 0.0; flip = true; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Sidepass/Sidepass.h b/plugins/WinVST/Sidepass/Sidepass.h index 0e496f5..1b31b91 100755 --- a/plugins/WinVST/Sidepass/Sidepass.h +++ b/plugins/WinVST/Sidepass/Sidepass.h @@ -55,10 +55,8 @@ private: double iirSampleA; double iirSampleB; bool flip; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/Sidepass/SidepassProc.cpp b/plugins/WinVST/Sidepass/SidepassProc.cpp index d022df3..834ae3e 100755 --- a/plugins/WinVST/Sidepass/SidepassProc.cpp +++ b/plugins/WinVST/Sidepass/SidepassProc.cpp @@ -17,9 +17,6 @@ void Sidepass::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double iirAmount = pow(A,3)/overallscale; long double inputSampleL; long double inputSampleR; @@ -87,25 +84,14 @@ void Sidepass::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -127,9 +113,6 @@ void Sidepass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double iirAmount = pow(A,3)/overallscale; long double inputSampleL; long double inputSampleR; @@ -197,25 +180,16 @@ void Sidepass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo b/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo Binary files differindex 43b7f80..bb9d2da 100755 --- a/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/SingleEndedTriode/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp b/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp index 5781165..ef6694c 100755 --- a/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp +++ b/plugins/WinVST/SingleEndedTriode/SingleEndedTriodeProc.cpp @@ -127,18 +127,14 @@ void SingleEndedTriode::processReplacing(float **inputs, float **outputs, VstInt inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -148,12 +144,6 @@ void SingleEndedTriode::processReplacing(float **inputs, float **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void SingleEndedTriode::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -276,18 +266,16 @@ void SingleEndedTriode::processDoubleReplacing(double **inputs, double **outputs inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -297,10 +285,4 @@ void SingleEndedTriode::processDoubleReplacing(double **inputs, double **outputs *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. }
\ No newline at end of file diff --git a/plugins/WinVST/Slew/.vs/VSTProject/v14/.suo b/plugins/WinVST/Slew/.vs/VSTProject/v14/.suo Binary files differindex 95f3018..8207f2c 100755 --- a/plugins/WinVST/Slew/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Slew/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Slew2/.vs/VSTProject/v14/.suo b/plugins/WinVST/Slew2/.vs/VSTProject/v14/.suo Binary files differindex b0d4c72..24ab216 100755 --- a/plugins/WinVST/Slew2/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Slew2/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/SlewOnly/.vs/VSTProject/v14/.suo b/plugins/WinVST/SlewOnly/.vs/VSTProject/v14/.suo Binary files differindex 19a25dd..1a25a67 100755 --- a/plugins/WinVST/SlewOnly/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/SlewOnly/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Spiral/.vs/VSTProject/v14/.suo b/plugins/WinVST/Spiral/.vs/VSTProject/v14/.suo Binary files differindex 396d743..f9037d1 100755 --- a/plugins/WinVST/Spiral/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Spiral/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Spiral/SpiralProc.cpp b/plugins/WinVST/Spiral/SpiralProc.cpp index d43a93a..4aea5bc 100755 --- a/plugins/WinVST/Spiral/SpiralProc.cpp +++ b/plugins/WinVST/Spiral/SpiralProc.cpp @@ -60,18 +60,14 @@ void Spiral::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr inputSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((inputSampleL == 0.0) ?1:fabs(inputSampleL)); inputSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((inputSampleR == 0.0) ?1:fabs(inputSampleR)); - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -81,12 +77,6 @@ void Spiral::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Spiral::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -142,18 +132,16 @@ void Spiral::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((inputSampleL == 0.0) ?1:fabs(inputSampleL)); inputSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((inputSampleR == 0.0) ?1:fabs(inputSampleR)); - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -163,10 +151,4 @@ void Spiral::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/Spiral2/.vs/VSTProject/v14/.suo b/plugins/WinVST/Spiral2/.vs/VSTProject/v14/.suo Binary files differindex 7779c05..41c371a 100755 --- a/plugins/WinVST/Spiral2/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Spiral2/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Spiral2/Spiral2Proc.cpp b/plugins/WinVST/Spiral2/Spiral2Proc.cpp index d309448..a8669c5 100755 --- a/plugins/WinVST/Spiral2/Spiral2Proc.cpp +++ b/plugins/WinVST/Spiral2/Spiral2Proc.cpp @@ -118,18 +118,14 @@ void Spiral2::processReplacing(float **inputs, float **outputs, VstInt32 sampleF prevSampleR = drySampleR; flip = !flip; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -139,12 +135,6 @@ void Spiral2::processReplacing(float **inputs, float **outputs, VstInt32 sampleF *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Spiral2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -259,18 +249,16 @@ void Spiral2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 prevSampleR = drySampleR; flip = !flip; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -280,10 +268,4 @@ void Spiral2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/StarChild/.vs/VSTProject/v14/.suo b/plugins/WinVST/StarChild/.vs/VSTProject/v14/.suo Binary files differindex 1c72906..c3b6d23 100755 --- a/plugins/WinVST/StarChild/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/StarChild/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/StarChild/StarChild.cpp b/plugins/WinVST/StarChild/StarChild.cpp index 84becbc..1b29d50 100755 --- a/plugins/WinVST/StarChild/StarChild.cpp +++ b/plugins/WinVST/StarChild/StarChild.cpp @@ -65,11 +65,8 @@ StarChild::StarChild(audioMasterCallback audioMaster) : increment = 1; dutyCycle = 1; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/StarChild/StarChild.h b/plugins/WinVST/StarChild/StarChild.h index 7ae986a..630be3c 100755 --- a/plugins/WinVST/StarChild/StarChild.h +++ b/plugins/WinVST/StarChild/StarChild.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double d[45102]; diff --git a/plugins/WinVST/StarChild/StarChildProc.cpp b/plugins/WinVST/StarChild/StarChildProc.cpp index 03c8e31..047948a 100755 --- a/plugins/WinVST/StarChild/StarChildProc.cpp +++ b/plugins/WinVST/StarChild/StarChildProc.cpp @@ -14,9 +14,6 @@ void StarChild::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -392,25 +389,14 @@ void StarChild::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR += drySampleR; //here we combine the tanks with the dry signal - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -429,9 +415,6 @@ void StarChild::processDoubleReplacing(double **inputs, double **outputs, VstInt double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double drySampleL; double drySampleR; @@ -807,25 +790,16 @@ void StarChild::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR += drySampleR; //here we combine the tanks with the dry signal - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/StereoFX/.vs/VSTProject/v14/.suo b/plugins/WinVST/StereoFX/.vs/VSTProject/v14/.suo Binary files differindex 61fb690..3d0e385 100755 --- a/plugins/WinVST/StereoFX/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/StereoFX/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/StereoFX/StereoFX.cpp b/plugins/WinVST/StereoFX/StereoFX.cpp index 63c23db..704cbf3 100755 --- a/plugins/WinVST/StereoFX/StereoFX.cpp +++ b/plugins/WinVST/StereoFX/StereoFX.cpp @@ -17,10 +17,8 @@ StereoFX::StereoFX(audioMasterCallback audioMaster) : C = 0.0; iirSampleA = 0.0; iirSampleB = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; flip = false; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/WinVST/StereoFX/StereoFX.h b/plugins/WinVST/StereoFX/StereoFX.h index 6748d1e..7a36059 100755 --- a/plugins/WinVST/StereoFX/StereoFX.h +++ b/plugins/WinVST/StereoFX/StereoFX.h @@ -56,10 +56,8 @@ private: double iirSampleA; double iirSampleB; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; + long double fpNShapeL; + long double fpNShapeR; bool flip; //default stuff diff --git a/plugins/WinVST/StereoFX/StereoFXProc.cpp b/plugins/WinVST/StereoFX/StereoFXProc.cpp index 49be44f..0e9de74 100755 --- a/plugins/WinVST/StereoFX/StereoFXProc.cpp +++ b/plugins/WinVST/StereoFX/StereoFXProc.cpp @@ -17,9 +17,6 @@ void StereoFX::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double mid; @@ -138,25 +135,14 @@ void StereoFX::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -178,9 +164,6 @@ void StereoFX::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double mid; @@ -299,25 +282,16 @@ void StereoFX::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - flip = !flip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/SubsOnly/.vs/VSTProject/v14/.suo b/plugins/WinVST/SubsOnly/.vs/VSTProject/v14/.suo Binary files differindex 62beaf4..048e45d 100755 --- a/plugins/WinVST/SubsOnly/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/SubsOnly/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Surge/.vs/VSTProject/v14/.suo b/plugins/WinVST/Surge/.vs/VSTProject/v14/.suo Binary files differindex 03e6045..5bdfe99 100755 --- a/plugins/WinVST/Surge/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Surge/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Surge/Surge.cpp b/plugins/WinVST/Surge/Surge.cpp index 711c0df..222fbcf 100755 --- a/plugins/WinVST/Surge/Surge.cpp +++ b/plugins/WinVST/Surge/Surge.cpp @@ -12,10 +12,8 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new S Surge::Surge(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; flip = true; chaseA = 0.0; chaseB = 0.0; diff --git a/plugins/WinVST/Surge/Surge.h b/plugins/WinVST/Surge/Surge.h index 0e485c3..7f42c9f 100755 --- a/plugins/WinVST/Surge/Surge.h +++ b/plugins/WinVST/Surge/Surge.h @@ -53,10 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; bool flip; long double chaseA; long double chaseB; diff --git a/plugins/WinVST/Surge/SurgeProc.cpp b/plugins/WinVST/Surge/SurgeProc.cpp index 7a72b2f..cd82bad 100755 --- a/plugins/WinVST/Surge/SurgeProc.cpp +++ b/plugins/WinVST/Surge/SurgeProc.cpp @@ -17,9 +17,6 @@ void Surge::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -120,27 +117,14 @@ void Surge::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -162,9 +146,6 @@ void Surge::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -264,27 +245,16 @@ void Surge::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/SurgeTide/.vs/VSTProject/v14/.suo b/plugins/WinVST/SurgeTide/.vs/VSTProject/v14/.suo Binary files differindex 17702f9..c4b7709 100755 --- a/plugins/WinVST/SurgeTide/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/SurgeTide/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/SurgeTide/SurgeTide.cpp b/plugins/WinVST/SurgeTide/SurgeTide.cpp index 8df46c0..494e886 100755 --- a/plugins/WinVST/SurgeTide/SurgeTide.cpp +++ b/plugins/WinVST/SurgeTide/SurgeTide.cpp @@ -15,10 +15,8 @@ SurgeTide::SurgeTide(audioMasterCallback audioMaster) : A = 0.5; B = 0.3; C = 1.0; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; flip = true; chaseA = 0.0; chaseB = 0.0; diff --git a/plugins/WinVST/SurgeTide/SurgeTide.h b/plugins/WinVST/SurgeTide/SurgeTide.h index 27495d7..8f8cd42 100755 --- a/plugins/WinVST/SurgeTide/SurgeTide.h +++ b/plugins/WinVST/SurgeTide/SurgeTide.h @@ -54,10 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; bool flip; long double chaseA; long double chaseB; diff --git a/plugins/WinVST/SurgeTide/SurgeTideProc.cpp b/plugins/WinVST/SurgeTide/SurgeTideProc.cpp index 2fc6a1a..59a92aa 100755 --- a/plugins/WinVST/SurgeTide/SurgeTideProc.cpp +++ b/plugins/WinVST/SurgeTide/SurgeTideProc.cpp @@ -17,9 +17,6 @@ void SurgeTide::processReplacing(float **inputs, float **outputs, VstInt32 sampl double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -110,27 +107,14 @@ void SurgeTide::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -152,9 +136,6 @@ void SurgeTide::processDoubleReplacing(double **inputs, double **outputs, VstInt double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -245,27 +226,16 @@ void SurgeTide::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Swell/.vs/VSTProject/v14/.suo b/plugins/WinVST/Swell/.vs/VSTProject/v14/.suo Binary files differindex f1f16de..3124884 100755 --- a/plugins/WinVST/Swell/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Swell/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Swell/Swell.cpp b/plugins/WinVST/Swell/Swell.cpp index 30518d8..e197cfb 100755 --- a/plugins/WinVST/Swell/Swell.cpp +++ b/plugins/WinVST/Swell/Swell.cpp @@ -21,11 +21,8 @@ Swell::Swell(audioMasterCallback audioMaster) : louderL = false; louderR = false; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Swell/Swell.h b/plugins/WinVST/Swell/Swell.h index c383df2..7c108b7 100755 --- a/plugins/WinVST/Swell/Swell.h +++ b/plugins/WinVST/Swell/Swell.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff diff --git a/plugins/WinVST/Swell/SwellProc.cpp b/plugins/WinVST/Swell/SwellProc.cpp index 28c0aba..3ab1e9b 100755 --- a/plugins/WinVST/Swell/SwellProc.cpp +++ b/plugins/WinVST/Swell/SwellProc.cpp @@ -17,9 +17,6 @@ void Swell::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double thresholdOn = pow(A,2) * B; double speedOn = (pow(B,2)*0.001)/overallscale; @@ -97,25 +94,14 @@ void Swell::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -137,9 +123,6 @@ void Swell::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double thresholdOn = pow(A,2) * B; double speedOn = (pow(B,2)*0.001)/overallscale; @@ -217,25 +200,16 @@ void Swell::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/TapeDelay/.vs/VSTProject/v14/.suo b/plugins/WinVST/TapeDelay/.vs/VSTProject/v14/.suo Binary files differindex 0fe2d39..9acad64 100755 --- a/plugins/WinVST/TapeDelay/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/TapeDelay/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/TapeDelay/TapeDelayProc.cpp b/plugins/WinVST/TapeDelay/TapeDelayProc.cpp index 43fa743..e2f1ade 100755 --- a/plugins/WinVST/TapeDelay/TapeDelayProc.cpp +++ b/plugins/WinVST/TapeDelay/TapeDelayProc.cpp @@ -156,18 +156,14 @@ void TapeDelay::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleL = (inputSampleL * dry) + (dL[delay] * wet); inputSampleR = (inputSampleR * dry) + (dR[delay] * wet); - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -177,12 +173,6 @@ void TapeDelay::processReplacing(float **inputs, float **outputs, VstInt32 sampl *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void TapeDelay::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -333,18 +323,16 @@ void TapeDelay::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleL = (inputSampleL * dry) + (dL[delay] * wet); inputSampleR = (inputSampleR * dry) + (dR[delay] * wet); - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -354,10 +342,4 @@ void TapeDelay::processDoubleReplacing(double **inputs, double **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/TapeDust/.vs/VSTProject/v14/.suo b/plugins/WinVST/TapeDust/.vs/VSTProject/v14/.suo Binary files differindex df95641..26bc0ab 100755 --- a/plugins/WinVST/TapeDust/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/TapeDust/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/TapeDust/TapeDust.cpp b/plugins/WinVST/TapeDust/TapeDust.cpp index 9638c14..0ce16e0 100755 --- a/plugins/WinVST/TapeDust/TapeDust.cpp +++ b/plugins/WinVST/TapeDust/TapeDust.cpp @@ -22,10 +22,8 @@ TapeDust::TapeDust(audioMasterCallback audioMaster) : fR[count] = 0.0; } - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/WinVST/TapeDust/TapeDust.h b/plugins/WinVST/TapeDust/TapeDust.h index 7b3a7fd..facbf40 100755 --- a/plugins/WinVST/TapeDust/TapeDust.h +++ b/plugins/WinVST/TapeDust/TapeDust.h @@ -53,10 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; + long double fpNShapeL; + long double fpNShapeR; bool fpFlip; //default stuff diff --git a/plugins/WinVST/TapeDust/TapeDustProc.cpp b/plugins/WinVST/TapeDust/TapeDustProc.cpp index 3d6588d..429a366 100755 --- a/plugins/WinVST/TapeDust/TapeDustProc.cpp +++ b/plugins/WinVST/TapeDust/TapeDustProc.cpp @@ -13,9 +13,6 @@ void TapeDust::processReplacing(float **inputs, float **outputs, VstInt32 sample float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -93,6 +90,7 @@ void TapeDust::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = -inputSampleL; inputSampleR = -inputSampleR; } + fpFlip = !fpFlip; for(int count = 0; count < 9; count++) { if (gainL > 1.0) { @@ -120,25 +118,14 @@ void TapeDust::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -156,9 +143,6 @@ void TapeDust::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -236,6 +220,7 @@ void TapeDust::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = -inputSampleL; inputSampleR = -inputSampleR; } + fpFlip = !fpFlip; for(int count = 0; count < 9; count++) { if (gainL > 1.0) { @@ -263,25 +248,16 @@ void TapeDust::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/TapeFat/.vs/VSTProject/v14/.suo b/plugins/WinVST/TapeFat/.vs/VSTProject/v14/.suo Binary files differindex e41410c..39f1ea5 100755 --- a/plugins/WinVST/TapeFat/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/TapeFat/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/TapeFat/TapeFatProc.cpp b/plugins/WinVST/TapeFat/TapeFatProc.cpp index 3f81d20..8eb0e98 100755 --- a/plugins/WinVST/TapeFat/TapeFatProc.cpp +++ b/plugins/WinVST/TapeFat/TapeFatProc.cpp @@ -119,18 +119,14 @@ void TapeFat::processReplacing(float **inputs, float **outputs, VstInt32 sampleF gcount--; - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -140,12 +136,6 @@ void TapeFat::processReplacing(float **inputs, float **outputs, VstInt32 sampleF *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void TapeFat::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -260,18 +250,16 @@ void TapeFat::processDoubleReplacing(double **inputs, double **outputs, VstInt32 gcount--; - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -281,10 +269,4 @@ void TapeFat::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/Thunder/.vs/VSTProject/v14/.suo b/plugins/WinVST/Thunder/.vs/VSTProject/v14/.suo Binary files differindex b01488d..a6a6a16 100755 --- a/plugins/WinVST/Thunder/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Thunder/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Thunder/Thunder.cpp b/plugins/WinVST/Thunder/Thunder.cpp index 015eabd..7bc8226 100755 --- a/plugins/WinVST/Thunder/Thunder.cpp +++ b/plugins/WinVST/Thunder/Thunder.cpp @@ -15,10 +15,8 @@ Thunder::Thunder(audioMasterCallback audioMaster) : A = 0.0; B = 1.0; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; muSpeedA = 10000; muSpeedB = 10000; muCoefficientA = 1; diff --git a/plugins/WinVST/Thunder/Thunder.h b/plugins/WinVST/Thunder/Thunder.h index 1ef1d03..9e49054 100755 --- a/plugins/WinVST/Thunder/Thunder.h +++ b/plugins/WinVST/Thunder/Thunder.h @@ -69,10 +69,8 @@ private: double iirSampleAM; double iirSampleBM; double iirSampleCM; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; bool flip; float A; diff --git a/plugins/WinVST/Thunder/ThunderProc.cpp b/plugins/WinVST/Thunder/ThunderProc.cpp index bd401d4..2cf454d 100755 --- a/plugins/WinVST/Thunder/ThunderProc.cpp +++ b/plugins/WinVST/Thunder/ThunderProc.cpp @@ -40,9 +40,6 @@ void Thunder::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double resultML; double resultMR; - float fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -225,27 +222,14 @@ void Thunder::processReplacing(float **inputs, float **outputs, VstInt32 sampleF inputSampleR *= outputGain; } - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; @@ -291,9 +275,6 @@ void Thunder::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double resultML; double resultMR; - double fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -476,27 +457,16 @@ void Thunder::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR *= outputGain; } - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; diff --git a/plugins/WinVST/ToTape5/.vs/VSTProject/v14/.suo b/plugins/WinVST/ToTape5/.vs/VSTProject/v14/.suo Binary files differindex b0c4487..f15fde2 100755 --- a/plugins/WinVST/ToTape5/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ToTape5/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ToTape5/ToTape5.cpp b/plugins/WinVST/ToTape5/ToTape5.cpp index 01f61cb..6136aaf 100755 --- a/plugins/WinVST/ToTape5/ToTape5.cpp +++ b/plugins/WinVST/ToTape5/ToTape5.cpp @@ -98,11 +98,8 @@ ToTape5::ToTape5(audioMasterCallback audioMaster) : hcount = 0; flip = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ToTape5/ToTape5.h b/plugins/WinVST/ToTape5/ToTape5.h index ac26df5..d049014 100755 --- a/plugins/WinVST/ToTape5/ToTape5.h +++ b/plugins/WinVST/ToTape5/ToTape5.h @@ -140,11 +140,8 @@ private: double iirSampleZR; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/ToTape5/ToTape5Proc.cpp b/plugins/WinVST/ToTape5/ToTape5Proc.cpp index 4d2d5c7..5824f80 100755 --- a/plugins/WinVST/ToTape5/ToTape5Proc.cpp +++ b/plugins/WinVST/ToTape5/ToTape5Proc.cpp @@ -17,7 +17,7 @@ void ToTape5::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - + long double fpOld = 0.618033988749894848204586; //golden ratio! double inputgain = pow(A+1.0,3); double outputgain = E; double wet = F; @@ -63,9 +63,6 @@ void ToTape5::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double tempSampleR; double drySampleR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -358,25 +355,14 @@ void ToTape5::processReplacing(float **inputs, float **outputs, VstInt32 sampleF inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -398,7 +384,7 @@ void ToTape5::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - + long double fpOld = 0.618033988749894848204586; //golden ratio! double inputgain = pow(A+1.0,3); double outputgain = E; double wet = F; @@ -443,10 +429,6 @@ void ToTape5::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double bridgerectifierR; double tempSampleR; double drySampleR; - - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -738,25 +720,16 @@ void ToTape5::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ToVinyl4/.vs/VSTProject/v14/.suo b/plugins/WinVST/ToVinyl4/.vs/VSTProject/v14/.suo Binary files differindex 33b5837..2369dee 100755 --- a/plugins/WinVST/ToVinyl4/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ToVinyl4/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ToVinyl4/ToVinyl4.cpp b/plugins/WinVST/ToVinyl4/ToVinyl4.cpp index b0c91f8..429187c 100755 --- a/plugins/WinVST/ToVinyl4/ToVinyl4.cpp +++ b/plugins/WinVST/ToVinyl4/ToVinyl4.cpp @@ -87,11 +87,8 @@ ToVinyl4::ToVinyl4(audioMasterCallback audioMaster) : B = 0.3424051; //44.0 hz = ((B*B)*290)+10 (B*B)*290 = 34 (B*B) = 0.1172413 sqrt() = 0.3424051 C = 0.32; D = 0.064; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ToVinyl4/ToVinyl4.h b/plugins/WinVST/ToVinyl4/ToVinyl4.h index 57bffac..6a2dc26 100755 --- a/plugins/WinVST/ToVinyl4/ToVinyl4.h +++ b/plugins/WinVST/ToVinyl4/ToVinyl4.h @@ -142,11 +142,8 @@ private: double bMidPrev; double bSidePrev; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/ToVinyl4/ToVinyl4Proc.cpp b/plugins/WinVST/ToVinyl4/ToVinyl4Proc.cpp index 8d9dc0c..a67af99 100755 --- a/plugins/WinVST/ToVinyl4/ToVinyl4Proc.cpp +++ b/plugins/WinVST/ToVinyl4/ToVinyl4Proc.cpp @@ -17,9 +17,6 @@ void ToVinyl4::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double fusswithscale = 50000; //corrected double cutofffreq = ((A*A)*290.0)+10.0; @@ -464,25 +461,14 @@ void ToVinyl4::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = accumulatorSample; //we just re-use accumulatorSample to do this little shuffle - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -504,9 +490,6 @@ void ToVinyl4::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double fusswithscale = 50000; //corrected double cutofffreq = ((A*A)*290.0)+10.0; @@ -950,25 +933,16 @@ void ToVinyl4::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = accumulatorSample; //we just re-use accumulatorSample to do this little shuffle - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/ToneSlant/.vs/VSTProject/v14/.suo b/plugins/WinVST/ToneSlant/.vs/VSTProject/v14/.suo Binary files differindex b31a1bb..4d673ae 100755 --- a/plugins/WinVST/ToneSlant/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/ToneSlant/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/ToneSlant/ToneSlant.cpp b/plugins/WinVST/ToneSlant/ToneSlant.cpp index 0ed3618..d99fa60 100755 --- a/plugins/WinVST/ToneSlant/ToneSlant.cpp +++ b/plugins/WinVST/ToneSlant/ToneSlant.cpp @@ -15,11 +15,8 @@ ToneSlant::ToneSlant(audioMasterCallback audioMaster) : A = 0.0; B = 0.0; for(int count = 0; count < 102; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;} - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/ToneSlant/ToneSlant.h b/plugins/WinVST/ToneSlant/ToneSlant.h index 655cc55..7c52bca 100755 --- a/plugins/WinVST/ToneSlant/ToneSlant.h +++ b/plugins/WinVST/ToneSlant/ToneSlant.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/ToneSlant/ToneSlantProc.cpp b/plugins/WinVST/ToneSlant/ToneSlantProc.cpp index b594b05..d78cfb5 100755 --- a/plugins/WinVST/ToneSlant/ToneSlantProc.cpp +++ b/plugins/WinVST/ToneSlant/ToneSlantProc.cpp @@ -14,9 +14,6 @@ void ToneSlant::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputSampleL; double inputSampleR; @@ -109,25 +106,14 @@ void ToneSlant::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR += (correctionSampleR * applySlant); //our one math operation on the input data coming in - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -146,9 +132,6 @@ void ToneSlant::processDoubleReplacing(double **inputs, double **outputs, VstInt double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double inputSampleL; double inputSampleR; @@ -240,25 +223,16 @@ void ToneSlant::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR += (correctionSampleR * applySlant); //our one math operation on the input data coming in - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/TransDesk/.vs/VSTProject/v14/.suo b/plugins/WinVST/TransDesk/.vs/VSTProject/v14/.suo Binary files differindex 1e5676d..831f593 100755 --- a/plugins/WinVST/TransDesk/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/TransDesk/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/TransDesk/TransDesk.cpp b/plugins/WinVST/TransDesk/TransDesk.cpp index 24443bd..3f352f7 100755 --- a/plugins/WinVST/TransDesk/TransDesk.cpp +++ b/plugins/WinVST/TransDesk/TransDesk.cpp @@ -25,11 +25,8 @@ TransDesk::TransDesk(audioMasterCallback audioMaster) : lastOutSampleR = 0.0; lastSlewR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/TransDesk/TransDesk.h b/plugins/WinVST/TransDesk/TransDesk.h index b3b891d..5729b4c 100755 --- a/plugins/WinVST/TransDesk/TransDesk.h +++ b/plugins/WinVST/TransDesk/TransDesk.h @@ -51,11 +51,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff int gcount; diff --git a/plugins/WinVST/TransDesk/TransDeskProc.cpp b/plugins/WinVST/TransDesk/TransDeskProc.cpp index c7df5e8..c8b45c2 100755 --- a/plugins/WinVST/TransDesk/TransDeskProc.cpp +++ b/plugins/WinVST/TransDesk/TransDeskProc.cpp @@ -17,9 +17,6 @@ void TransDesk::processReplacing(float **inputs, float **outputs, VstInt32 sampl double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = 0.02198359; double depthA = 3.0; @@ -200,25 +197,14 @@ void TransDesk::processReplacing(float **inputs, float **outputs, VstInt32 sampl gcount--; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -240,9 +226,6 @@ void TransDesk::processDoubleReplacing(double **inputs, double **outputs, VstInt double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = 0.02198359; double depthA = 3.0; @@ -423,25 +406,16 @@ void TransDesk::processDoubleReplacing(double **inputs, double **outputs, VstInt gcount--; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/Tremolo/.vs/VSTProject/v14/.suo b/plugins/WinVST/Tremolo/.vs/VSTProject/v14/.suo Binary files differindex 9d04545..5806490 100755 --- a/plugins/WinVST/Tremolo/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Tremolo/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Tremolo/Tremolo.cpp b/plugins/WinVST/Tremolo/Tremolo.cpp index be5d06d..f0b649d 100755 --- a/plugins/WinVST/Tremolo/Tremolo.cpp +++ b/plugins/WinVST/Tremolo/Tremolo.cpp @@ -21,11 +21,8 @@ Tremolo::Tremolo(audioMasterCallback audioMaster) : depthAmount = 0.0; lastSpeed = 1000.0; lastDepth = 1000.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Tremolo/Tremolo.h b/plugins/WinVST/Tremolo/Tremolo.h index ea40aa6..11fc718 100755 --- a/plugins/WinVST/Tremolo/Tremolo.h +++ b/plugins/WinVST/Tremolo/Tremolo.h @@ -53,11 +53,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double sweep; diff --git a/plugins/WinVST/Tremolo/TremoloProc.cpp b/plugins/WinVST/Tremolo/TremoloProc.cpp index d0de7cc..d27dc86 100755 --- a/plugins/WinVST/Tremolo/TremoloProc.cpp +++ b/plugins/WinVST/Tremolo/TremoloProc.cpp @@ -17,9 +17,6 @@ void Tremolo::processReplacing(float **inputs, float **outputs, VstInt32 sampleF double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; speedChase = pow(A,4); depthChase = B; @@ -151,25 +148,14 @@ void Tremolo::processReplacing(float **inputs, float **outputs, VstInt32 sampleF inputSampleR = (drySampleR * (1-depth)) + (inputSampleR*depth); //end R - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -191,9 +177,6 @@ void Tremolo::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; speedChase = pow(A,4); depthChase = B; @@ -326,25 +309,16 @@ void Tremolo::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR = (drySampleR * (1-depth)) + (inputSampleR*depth); //end R - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/TubeDesk/.vs/VSTProject/v14/.suo b/plugins/WinVST/TubeDesk/.vs/VSTProject/v14/.suo Binary files differindex 318d2bc..7d02701 100755 --- a/plugins/WinVST/TubeDesk/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/TubeDesk/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/TubeDesk/TubeDesk.cpp b/plugins/WinVST/TubeDesk/TubeDesk.cpp index fc4bd75..5a7465c 100755 --- a/plugins/WinVST/TubeDesk/TubeDesk.cpp +++ b/plugins/WinVST/TubeDesk/TubeDesk.cpp @@ -25,11 +25,8 @@ TubeDesk::TubeDesk(audioMasterCallback audioMaster) : lastOutSampleR = 0.0; lastSlewR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/TubeDesk/TubeDesk.h b/plugins/WinVST/TubeDesk/TubeDesk.h index b41b283..fb15768 100755 --- a/plugins/WinVST/TubeDesk/TubeDesk.h +++ b/plugins/WinVST/TubeDesk/TubeDesk.h @@ -51,11 +51,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff int gcount; diff --git a/plugins/WinVST/TubeDesk/TubeDeskProc.cpp b/plugins/WinVST/TubeDesk/TubeDeskProc.cpp index 2636076..cccf6e2 100755 --- a/plugins/WinVST/TubeDesk/TubeDeskProc.cpp +++ b/plugins/WinVST/TubeDesk/TubeDeskProc.cpp @@ -17,9 +17,6 @@ void TubeDesk::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = 0.4384938; double depthA = 549.0; @@ -199,25 +196,14 @@ void TubeDesk::processReplacing(float **inputs, float **outputs, VstInt32 sample gcount--; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -239,9 +225,6 @@ void TubeDesk::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = 0.4384938; double depthA = 549.0; @@ -421,25 +404,16 @@ void TubeDesk::processDoubleReplacing(double **inputs, double **outputs, VstInt3 gcount--; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/UnBox/.vs/VSTProject/v14/.suo b/plugins/WinVST/UnBox/.vs/VSTProject/v14/.suo Binary files differindex b96b3ed..a8edae0 100755 --- a/plugins/WinVST/UnBox/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/UnBox/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/UnBox/UnBoxProc.cpp b/plugins/WinVST/UnBox/UnBoxProc.cpp index 12133dc..3cb3aab 100755 --- a/plugins/WinVST/UnBox/UnBoxProc.cpp +++ b/plugins/WinVST/UnBox/UnBoxProc.cpp @@ -218,18 +218,14 @@ void UnBox::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra if (output != 1.0) {inputSampleL *= output; inputSampleR *= output;} - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -239,12 +235,6 @@ void UnBox::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void UnBox::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -458,18 +448,16 @@ void UnBox::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s if (output != 1.0) {inputSampleL *= output; inputSampleR *= output;} - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -479,10 +467,4 @@ void UnBox::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/VariMu/.vs/VSTProject/v14/.suo b/plugins/WinVST/VariMu/.vs/VSTProject/v14/.suo Binary files differindex 408eef5..a15cfa9 100755 --- a/plugins/WinVST/VariMu/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/VariMu/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/VariMu/VariMuProc.cpp b/plugins/WinVST/VariMu/VariMuProc.cpp index b966cd8..323b5e4 100755 --- a/plugins/WinVST/VariMu/VariMuProc.cpp +++ b/plugins/WinVST/VariMu/VariMuProc.cpp @@ -233,18 +233,14 @@ void VariMu::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -254,12 +250,6 @@ void VariMu::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void VariMu::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -488,18 +478,16 @@ void VariMu::processDoubleReplacing(double **inputs, double **outputs, VstInt32 //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -509,10 +497,4 @@ void VariMu::processDoubleReplacing(double **inputs, double **outputs, VstInt32 *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/VoiceOfTheStarship/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/VoiceOfTheStarship/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/VoiceOfTheStarship/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/VoiceOfTheStarship/.vs/VSTProject/v14/.suo b/plugins/WinVST/VoiceOfTheStarship/.vs/VSTProject/v14/.suo Binary files differindex 29e8736..f4a0cef 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/VoiceOfTheStarship/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/VoiceOfTheStarship/VSTProject.sln b/plugins/WinVST/VoiceOfTheStarship/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VSTProject.sln +++ b/plugins/WinVST/VoiceOfTheStarship/VSTProject.sln diff --git a/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj b/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj index a7192f5..a7192f5 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj +++ b/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj diff --git a/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.filters b/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.filters index 56f5e91..56f5e91 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.filters +++ b/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.user b/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.user +++ b/plugins/WinVST/VoiceOfTheStarship/VSTProject.vcxproj.user diff --git a/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.cpp b/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.cpp index c30bd47..19f1d94 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.cpp +++ b/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.cpp @@ -28,11 +28,8 @@ VoiceOfTheStarship::VoiceOfTheStarship(audioMasterCallback audioMaster) : for(int count = 0; count < 11; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;} lastAlgorithm = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.h b/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.h index febb344..519923b 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.h +++ b/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarship.h @@ -73,11 +73,8 @@ private: int lastAlgorithm; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarshipProc.cpp b/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarshipProc.cpp index 32979d0..bbb14fa 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarshipProc.cpp +++ b/plugins/WinVST/VoiceOfTheStarship/VoiceOfTheStarshipProc.cpp @@ -79,9 +79,6 @@ void VoiceOfTheStarship::processReplacing(float **inputs, float **outputs, VstIn double inputSampleL; double inputSampleR; - float fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -181,25 +178,14 @@ void VoiceOfTheStarship::processReplacing(float **inputs, float **outputs, VstIn filterflip = !filterflip; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -283,9 +269,6 @@ void VoiceOfTheStarship::processDoubleReplacing(double **inputs, double **output double inputSampleL; double inputSampleR; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -384,25 +367,16 @@ void VoiceOfTheStarship::processDoubleReplacing(double **inputs, double **output flipR = !flipR; filterflip = !filterflip; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/VoiceOfTheStarship/vstplug.def b/plugins/WinVST/VoiceOfTheStarship/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/VoiceOfTheStarship/vstplug.def +++ b/plugins/WinVST/VoiceOfTheStarship/vstplug.def diff --git a/plugins/WinVST/Wider/.vs/VSTProject/v14/.suo b/plugins/WinVST/Wider/.vs/VSTProject/v14/.suo Binary files differindex 6a45209..d5f3d7e 100755 --- a/plugins/WinVST/Wider/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/Wider/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/Wider/Wider.cpp b/plugins/WinVST/Wider/Wider.cpp index c1e57d0..26d4d47 100755 --- a/plugins/WinVST/Wider/Wider.cpp +++ b/plugins/WinVST/Wider/Wider.cpp @@ -17,11 +17,8 @@ Wider::Wider(audioMasterCallback audioMaster) : C = 1.0; for(int fcount = 0; fcount < 4098; fcount++) {p[fcount] = 0.0;} count = 0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //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. diff --git a/plugins/WinVST/Wider/Wider.h b/plugins/WinVST/Wider/Wider.h index 8b04cfb..6a6a2df 100755 --- a/plugins/WinVST/Wider/Wider.h +++ b/plugins/WinVST/Wider/Wider.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double p[4099]; diff --git a/plugins/WinVST/Wider/WiderProc.cpp b/plugins/WinVST/Wider/WiderProc.cpp index 618e651..f90fa21 100755 --- a/plugins/WinVST/Wider/WiderProc.cpp +++ b/plugins/WinVST/Wider/WiderProc.cpp @@ -17,9 +17,6 @@ void Wider::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -141,25 +138,14 @@ void Wider::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleL = (drySampleL * dry) + ((mid+side) * wet); inputSampleR = (drySampleR * dry) + ((mid-side) * wet); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -181,9 +167,6 @@ void Wider::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -305,25 +288,16 @@ void Wider::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleL = (drySampleL * dry) + ((mid+side) * wet); inputSampleR = (drySampleR * dry) + ((mid-side) * wet); - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; diff --git a/plugins/WinVST/uLawDecode/.vs/VSTProject/v14/.suo b/plugins/WinVST/uLawDecode/.vs/VSTProject/v14/.suo Binary files differindex 4259e19..28c1f4a 100755 --- a/plugins/WinVST/uLawDecode/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/uLawDecode/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/uLawDecode/uLawDecodeProc.cpp b/plugins/WinVST/uLawDecode/uLawDecodeProc.cpp index a78b3c2..1835623 100755 --- a/plugins/WinVST/uLawDecode/uLawDecodeProc.cpp +++ b/plugins/WinVST/uLawDecode/uLawDecodeProc.cpp @@ -88,18 +88,14 @@ void uLawDecode::processReplacing(float **inputs, float **outputs, VstInt32 samp inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -109,12 +105,6 @@ void uLawDecode::processReplacing(float **inputs, float **outputs, VstInt32 samp *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void uLawDecode::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -198,18 +188,16 @@ void uLawDecode::processDoubleReplacing(double **inputs, double **outputs, VstIn inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -219,10 +207,4 @@ void uLawDecode::processDoubleReplacing(double **inputs, double **outputs, VstIn *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } diff --git a/plugins/WinVST/uLawEncode/.vs/VSTProject/v14/.suo b/plugins/WinVST/uLawEncode/.vs/VSTProject/v14/.suo Binary files differindex c50088b..4c66819 100755 --- a/plugins/WinVST/uLawEncode/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/uLawEncode/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/uLawEncode/uLawEncodeProc.cpp b/plugins/WinVST/uLawEncode/uLawEncodeProc.cpp index 3d86a7f..c5dd74d 100755 --- a/plugins/WinVST/uLawEncode/uLawEncodeProc.cpp +++ b/plugins/WinVST/uLawEncode/uLawEncodeProc.cpp @@ -88,18 +88,14 @@ void uLawEncode::processReplacing(float **inputs, float **outputs, VstInt32 samp inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -109,12 +105,6 @@ void uLawEncode::processReplacing(float **inputs, float **outputs, VstInt32 samp *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void uLawEncode::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -198,18 +188,16 @@ void uLawEncode::processDoubleReplacing(double **inputs, double **outputs, VstIn inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -219,10 +207,4 @@ void uLawEncode::processDoubleReplacing(double **inputs, double **outputs, VstIn *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } |