aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Slew/Slew.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Slew/Slew.cpp')
-rwxr-xr-xplugins/MacAU/Slew/Slew.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/MacAU/Slew/Slew.cpp b/plugins/MacAU/Slew/Slew.cpp
index 3c1a7bf..5eee0ab 100755
--- a/plugins/MacAU/Slew/Slew.cpp
+++ b/plugins/MacAU/Slew/Slew.cpp
@@ -159,6 +159,7 @@ ComponentResult Slew::Initialize()
void Slew::SlewKernel::Reset()
{
lastSample = 0.0;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -224,6 +225,12 @@ void Slew::SlewKernel::Process( const Float32 *inSourceP,
outputSample = lastSample - threshold;
lastSample = outputSample;
+ //32 bit dither, made small and tidy.
+ int expon; frexpf((Float32)outputSample, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ outputSample += (dither-fpNShape); fpNShape = dither;
+ //end 32 bit dither
+
*destP = outputSample;
destP += inNumChannels;
}