diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
commit | 966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch) | |
tree | b0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp | |
parent | 0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff) | |
download | airwindows-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/Console5DarkCh/Console5DarkCh.cpp')
-rwxr-xr-x | plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp b/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp index 2ad03c3..4b1cefd 100755 --- a/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp +++ b/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp @@ -165,9 +165,7 @@ void Console5DarkCh::Console5DarkChKernel::Reset() settingchase = -90.0; chasespeed = 350.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -184,11 +182,7 @@ void Console5DarkCh::Console5DarkChKernel::Process( const Float32 *inSourceP, Float32 *destP = inDestP; long double overallscale = 1.0; overallscale /= 44100.0; - overallscale *= GetSampleRate(); - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + overallscale *= GetSampleRate(); Float64 inputgain = GetParameter( kParam_One ); Float64 difference; Float64 nearZero; @@ -279,19 +273,11 @@ void Console5DarkCh::Console5DarkChKernel::Process( const Float32 *inSourceP, inputSample = sin(inputSample); //amplitude 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; |