aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/PurestDrive/PurestDrive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/PurestDrive/PurestDrive.cpp')
-rwxr-xr-x[-rw-r--r--]plugins/MacAU/PurestDrive/PurestDrive.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/plugins/MacAU/PurestDrive/PurestDrive.cpp b/plugins/MacAU/PurestDrive/PurestDrive.cpp
index fe73631..7f6d0a0 100644..100755
--- a/plugins/MacAU/PurestDrive/PurestDrive.cpp
+++ b/plugins/MacAU/PurestDrive/PurestDrive.cpp
@@ -159,9 +159,7 @@ ComponentResult PurestDrive::Initialize()
void PurestDrive::PurestDriveKernel::Reset()
{
previousSample = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
@@ -182,9 +180,6 @@ void PurestDrive::PurestDriveKernel::Process( const Float32 *inSourceP,
long double inputSample;
long double drySample;
Float64 apply;
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
while (nSampleFrames-- > 0) {
inputSample = *sourceP;
@@ -227,19 +222,11 @@ void PurestDrive::PurestDriveKernel::Process( const Float32 *inSourceP,
previousSample = sin(drySample);
//apply the sine while storing previous sample
- //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;