aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Pressure4/Pressure4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Pressure4/Pressure4.cpp')
-rwxr-xr-xplugins/MacAU/Pressure4/Pressure4.cpp38
1 files changed, 11 insertions, 27 deletions
diff --git a/plugins/MacAU/Pressure4/Pressure4.cpp b/plugins/MacAU/Pressure4/Pressure4.cpp
index 4780f45..9fbbe85 100755
--- a/plugins/MacAU/Pressure4/Pressure4.cpp
+++ b/plugins/MacAU/Pressure4/Pressure4.cpp
@@ -198,10 +198,8 @@ ComponentResult Pressure4::Initialize()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Pressure4::Reset(AudioUnitScope inScope, AudioUnitElement inElement)
{
- fpNShapeAL = 0.0;
- fpNShapeBL = 0.0;
- fpNShapeAR = 0.0;
- fpNShapeBR = 0.0;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
muSpeedA = 10000;
muSpeedB = 10000;
muCoefficientA = 1;
@@ -257,9 +255,6 @@ OSStatus Pressure4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
unmewiness = 1.0-mewiness;
}
// µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -407,27 +402,16 @@ OSStatus Pressure4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
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((Float32)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((Float32)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;