aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Tremolo/Tremolo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Tremolo/Tremolo.cpp')
-rwxr-xr-xplugins/MacAU/Tremolo/Tremolo.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/plugins/MacAU/Tremolo/Tremolo.cpp b/plugins/MacAU/Tremolo/Tremolo.cpp
index e70b244..6e1f644 100755
--- a/plugins/MacAU/Tremolo/Tremolo.cpp
+++ b/plugins/MacAU/Tremolo/Tremolo.cpp
@@ -173,9 +173,7 @@ void Tremolo::TremoloKernel::Reset()
depthAmount = 0.0;
lastSpeed = 1000.0;
lastDepth = 1000.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -216,9 +214,6 @@ void Tremolo::TremoloKernel::Process( const Float32 *inSourceP,
Float64 out;
Float64 bridgerectifier;
Float64 offset;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
while (nSampleFrames-- > 0) {
inputSample = *sourceP;
@@ -289,22 +284,12 @@ void Tremolo::TremoloKernel::Process( const Float32 *inSourceP,
//apply tremolo, apply gain boost to compensate for volume loss
inputSample = (drySample * (1-depth)) + (inputSample*depth);
- //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;
destP += inNumChannels;
sourceP += inNumChannels;