aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/TubeDesk/TubeDesk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/TubeDesk/TubeDesk.cpp')
-rwxr-xr-xplugins/MacAU/TubeDesk/TubeDesk.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/plugins/MacAU/TubeDesk/TubeDesk.cpp b/plugins/MacAU/TubeDesk/TubeDesk.cpp
index 4b730c4..cf2c042 100755
--- a/plugins/MacAU/TubeDesk/TubeDesk.cpp
+++ b/plugins/MacAU/TubeDesk/TubeDesk.cpp
@@ -157,9 +157,7 @@ void TubeDesk::TubeDeskKernel::Reset()
lastSample = 0.0;
lastOutSample = 0.0;
lastSlew = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -200,9 +198,6 @@ void TubeDesk::TubeDeskKernel::Process( const Float32 *inSourceP,
Float64 combSample;
long double inputSample;
long double drySample;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
while (nSampleFrames-- > 0) {
inputSample = *sourceP;
@@ -295,20 +290,11 @@ void TubeDesk::TubeDeskKernel::Process( const Float32 *inSourceP,
inputSample /= gain;
//end of Desk section
- //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;
sourceP += inNumChannels;