diff options
Diffstat (limited to 'plugins/MacAU/DubCenter/DubCenter.cpp')
-rwxr-xr-x | plugins/MacAU/DubCenter/DubCenter.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/plugins/MacAU/DubCenter/DubCenter.cpp b/plugins/MacAU/DubCenter/DubCenter.cpp index e0bfcae..397d118 100755 --- a/plugins/MacAU/DubCenter/DubCenter.cpp +++ b/plugins/MacAU/DubCenter/DubCenter.cpp @@ -608,18 +608,14 @@ OSStatus DubCenter::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //noise shaping to 32-bit floating point - Float32 fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((Float32)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((Float32)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *outputL = inputSampleL; *outputR = inputSampleR; @@ -630,12 +626,6 @@ OSStatus DubCenter::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla outputL += 1; outputR += 1; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. return noErr; } |