aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp')
-rwxr-xr-xplugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/plugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp b/plugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp
index 847c101..be4cd10 100755
--- a/plugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp
+++ b/plugins/MacAU/CrunchyGrooveWear/CrunchyGrooveWear.cpp
@@ -177,9 +177,7 @@ void CrunchyGrooveWear::CrunchyGrooveWearKernel::Reset()
bMidPrev = 0.0;
cMidPrev = 0.0;
dMidPrev = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -193,11 +191,7 @@ void CrunchyGrooveWear::CrunchyGrooveWearKernel::Process( const Float32 *inSou
{
UInt32 nSampleFrames = inFramesToProcess;
const Float32 *sourceP = inSourceP;
- Float32 *destP = inDestP;
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
-
+ Float32 *destP = inDestP;
Float64 overallscale = (pow(GetParameter( kParam_One ),2)*19.0)+1.0;
Float64 gain = overallscale;
//mid groove wear
@@ -450,19 +444,11 @@ void CrunchyGrooveWear::CrunchyGrooveWearKernel::Process( const Float32 *inSou
inputSample = (inputSample * dWet) + (drySample * dDry);
}
- //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;