aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Swell/Swell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Swell/Swell.cpp')
-rwxr-xr-xplugins/MacAU/Swell/Swell.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/plugins/MacAU/Swell/Swell.cpp b/plugins/MacAU/Swell/Swell.cpp
index 821b33d..09dec89 100755
--- a/plugins/MacAU/Swell/Swell.cpp
+++ b/plugins/MacAU/Swell/Swell.cpp
@@ -176,10 +176,7 @@ void Swell::SwellKernel::Reset()
{
swell = 0.0;
louder = false;
-
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -197,10 +194,6 @@ void Swell::SwellKernel::Process( const Float32 *inSourceP,
long double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= GetSampleRate();
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
-
Float64 thresholdOn = pow(GetParameter( kParam_One ),2) * GetParameter( kParam_Two );
Float64 speedOn = (pow(GetParameter( kParam_Two ),2)*0.001)/overallscale;
Float64 thresholdOff = thresholdOn * GetParameter( kParam_Two );
@@ -252,20 +245,11 @@ void Swell::SwellKernel::Process( const Float32 *inSourceP,
inputSample = (inputSample * wet) + (drySample * dry);
}
-
- //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;