diff options
Diffstat (limited to 'plugins/MacAU/PurestEcho/PurestEcho.cpp')
-rwxr-xr-x | plugins/MacAU/PurestEcho/PurestEcho.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/plugins/MacAU/PurestEcho/PurestEcho.cpp b/plugins/MacAU/PurestEcho/PurestEcho.cpp index 86ef0f6..cfbb9fd 100755 --- a/plugins/MacAU/PurestEcho/PurestEcho.cpp +++ b/plugins/MacAU/PurestEcho/PurestEcho.cpp @@ -197,9 +197,7 @@ void PurestEcho::PurestEchoKernel::Reset() for(int count = 0; count < totalsamples-1; count++) {d[count] = 0;} gcount = 0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -275,11 +273,7 @@ void PurestEcho::PurestEchoKernel::Process( const Float32 *inSourceP, //you zero attenuation at 22 kilohertz: forget this at your peril ;) Float64 delaysBuffer; - - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double inputSample; while (nSampleFrames-- > 0) { @@ -344,19 +338,11 @@ void PurestEcho::PurestEchoKernel::Process( const Float32 *inSourceP, gcount--; - //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; |