aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacVST/Pressure4/source/Pressure4Proc.cpp')
-rwxr-xr-xplugins/MacVST/Pressure4/source/Pressure4Proc.cpp66
1 files changed, 18 insertions, 48 deletions
diff --git a/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp b/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp
index 02b8a78..7e285df 100755
--- a/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp
+++ b/plugins/MacVST/Pressure4/source/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;