aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/WinVST/Pressure4
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
committerChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
commit966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch)
treeb0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/WinVST/Pressure4
parent0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff)
downloadairwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip
Floating Point Dither For All
Diffstat (limited to 'plugins/WinVST/Pressure4')
-rwxr-xr-xplugins/WinVST/Pressure4/.vs/VSTProject/v14/.suobin23040 -> 22528 bytes
-rwxr-xr-xplugins/WinVST/Pressure4/Pressure4.cpp6
-rwxr-xr-xplugins/WinVST/Pressure4/Pressure4.h6
-rwxr-xr-xplugins/WinVST/Pressure4/Pressure4Proc.cpp66
4 files changed, 22 insertions, 56 deletions
diff --git a/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo b/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo
index a911044..b3e9f08 100755
--- a/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo
+++ b/plugins/WinVST/Pressure4/.vs/VSTProject/v14/.suo
Binary files differ
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;