aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/C5RawBuss/C5RawBuss.cpp
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
committerChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
commit966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch)
treeb0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/MacAU/C5RawBuss/C5RawBuss.cpp
parent0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff)
downloadairwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip
Floating Point Dither For All
Diffstat (limited to 'plugins/MacAU/C5RawBuss/C5RawBuss.cpp')
-rwxr-xr-xplugins/MacAU/C5RawBuss/C5RawBuss.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/plugins/MacAU/C5RawBuss/C5RawBuss.cpp b/plugins/MacAU/C5RawBuss/C5RawBuss.cpp
index 4f45ac0..9cca2dd 100755
--- a/plugins/MacAU/C5RawBuss/C5RawBuss.cpp
+++ b/plugins/MacAU/C5RawBuss/C5RawBuss.cpp
@@ -160,9 +160,7 @@ void C5RawBuss::C5RawBussKernel::Reset()
{
lastFXBuss = 0.0;
lastSampleBuss = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -177,9 +175,6 @@ void C5RawBuss::C5RawBussKernel::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;
long double centering = GetParameter( kParam_One ) * 0.5;
centering = 1.0 - pow(centering,5);
@@ -237,19 +232,11 @@ void C5RawBuss::C5RawBussKernel::Process( const Float32 *inSourceP,
//build new signal off what was present in output last time
//slew aspect
- //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;