diff options
Diffstat (limited to 'plugins/MacAU/PowerSag/PowerSag.cpp')
-rwxr-xr-x | plugins/MacAU/PowerSag/PowerSag.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/plugins/MacAU/PowerSag/PowerSag.cpp b/plugins/MacAU/PowerSag/PowerSag.cpp index 8bd8b1e..95f70d2 100755 --- a/plugins/MacAU/PowerSag/PowerSag.cpp +++ b/plugins/MacAU/PowerSag/PowerSag.cpp @@ -169,9 +169,7 @@ void PowerSag::PowerSagKernel::Reset() for(int count = 0; count < 8999; count++) {d[count] = 0;} control = 0; gcount = 0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -193,11 +191,6 @@ void PowerSag::PowerSagKernel::Process( const Float32 *inSourceP, Float64 thickness; Float64 out; Float64 bridgerectifier; - - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - long double inputSample; while (nSampleFrames-- > 0) { @@ -256,20 +249,11 @@ void PowerSag::PowerSagKernel::Process( const Float32 *inSourceP, inputSample *= clamp; - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSample; - fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeA; - } - else { - fpTemp = inputSample; - fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeB; - } - fpFlip = !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; |