aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/EQ/EQ.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/EQ/EQ.cpp')
-rwxr-xr-xplugins/MacAU/EQ/EQ.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/plugins/MacAU/EQ/EQ.cpp b/plugins/MacAU/EQ/EQ.cpp
index eecaa38..4b2d40b 100755
--- a/plugins/MacAU/EQ/EQ.cpp
+++ b/plugins/MacAU/EQ/EQ.cpp
@@ -222,9 +222,7 @@ ComponentResult EQ::Initialize()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void EQ::EQKernel::Reset()
{
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
iirHighSampleA = 0.0;
iirHighSampleB = 0.0;
@@ -285,10 +283,6 @@ void EQ::EQKernel::Process( const Float32 *inSourceP,
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
Float64 overallscale = GetSampleRate();
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
-
Float64 inputSample;
Float64 highSample = 0.0;
Float64 midSample = 0.0;
@@ -354,7 +348,7 @@ void EQ::EQKernel::Process( const Float32 *inSourceP,
last2Sample = lastSample;
lastSample = inputSample;
- flip = not flip;
+ flip = !flip;
flipthree++;
if (flipthree < 1 || flipthree > 3) flipthree = 1;
//counters
@@ -522,19 +516,11 @@ void EQ::EQKernel::Process( const Float32 *inSourceP,
//built in output trim and dry/wet if desired
if (outputgain != 1.0) inputSample *= outputgain;
- //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 = not 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;