aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/NCSeventeen/NCSeventeen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/NCSeventeen/NCSeventeen.cpp')
-rwxr-xr-xplugins/MacAU/NCSeventeen/NCSeventeen.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/plugins/MacAU/NCSeventeen/NCSeventeen.cpp b/plugins/MacAU/NCSeventeen/NCSeventeen.cpp
index cc27033..14f0cf2 100755
--- a/plugins/MacAU/NCSeventeen/NCSeventeen.cpp
+++ b/plugins/MacAU/NCSeventeen/NCSeventeen.cpp
@@ -173,9 +173,7 @@ void NCSeventeen::NCSeventeenKernel::Reset()
basslev = 0.0;
treblev = 0.0;
cheblev = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -189,12 +187,7 @@ void NCSeventeen::NCSeventeenKernel::Process( const Float32 *inSourceP,
{
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 inP2;
Float64 chebyshev;
Float64 overallscale = 1.0;
@@ -389,19 +382,11 @@ void NCSeventeen::NCSeventeenKernel::Process( const Float32 *inSourceP,
if (inputSample < -0.95) inputSample = -0.95;
//iron bar
- //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;
//built in output trim and dry/wet by default