aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Air/Air.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Air/Air.cpp')
-rwxr-xr-xplugins/MacAU/Air/Air.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/plugins/MacAU/Air/Air.cpp b/plugins/MacAU/Air/Air.cpp
index 716f907..7ba3efe 100755
--- a/plugins/MacAU/Air/Air.cpp
+++ b/plugins/MacAU/Air/Air.cpp
@@ -222,11 +222,7 @@ void Air::AirKernel::Reset()
tripletC = 0.0;
tripletFactor = 0.0;
count = 1;
-
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
-
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -254,11 +250,6 @@ void Air::AirKernel::Process( const Float32 *inSourceP,
Float64 wet = GetParameter( kParam_Six );
Float64 dry = 1.0-wet;
-
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
- Float32 fpTemp;
-
long double inputSample;
Float64 drySample;
Float64 correction;
@@ -399,19 +390,11 @@ void Air::AirKernel::Process( const Float32 *inSourceP,
//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.
- if (fpFlip) {
- fpTemp = inputSample;
- fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew);
- inputSample += fpNShapeA;
- }
- else {
- fpTemp = inputSample;
- fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew);
- inputSample += fpNShapeB;
- }
- fpFlip = not fpFlip;
- //end noise shaping on 32 bit output
-
+ //32 bit dither, made small and tidy.
+ int expon; frexpf((Float32)inputSample, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSample += (dither-fpNShape); fpNShape = dither;
+ //end 32 bit dither
*destP = inputSample;
destP += inNumChannels;