aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Hermepass/Hermepass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Hermepass/Hermepass.cpp')
-rwxr-xr-xplugins/MacAU/Hermepass/Hermepass.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/plugins/MacAU/Hermepass/Hermepass.cpp b/plugins/MacAU/Hermepass/Hermepass.cpp
index 8c8da5d..c969719 100755
--- a/plugins/MacAU/Hermepass/Hermepass.cpp
+++ b/plugins/MacAU/Hermepass/Hermepass.cpp
@@ -174,8 +174,7 @@ void Hermepass::HermepassKernel::Reset()
iirF = 0.0;
iirG = 0.0;
iirH = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
+ fpNShape = 0.0;
fpFlip = true;
}
@@ -194,10 +193,9 @@ void Hermepass::HermepassKernel::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 rangescale = 0.1 / overallscale;
Float64 cutoff = pow(GetParameter( kParam_One ),3);
@@ -301,20 +299,13 @@ void Hermepass::HermepassKernel::Process( const Float32 *inSourceP,
//with everything an array value. However, this makes just as much sense for this few poles.
inputSample -= correction;
-
- //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;