aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Pop/Pop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/Pop/Pop.cpp')
-rwxr-xr-xplugins/MacAU/Pop/Pop.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/plugins/MacAU/Pop/Pop.cpp b/plugins/MacAU/Pop/Pop.cpp
index 62acd34..d1e96e1 100755
--- a/plugins/MacAU/Pop/Pop.cpp
+++ b/plugins/MacAU/Pop/Pop.cpp
@@ -341,23 +341,16 @@ void Pop::PopKernel::Process( const Float32 *inSourceP,
flip = !flip;
if (output < 1.0) inputSample *= output;
- if (wet<1.0) inputSample = (drySample*(1.0-wet))+(inputSample*wet);
+ if (wet < 1.0) inputSample = (drySample*(1.0-wet))+(inputSample*wet);
- //noise shaping to 32-bit floating point
- Float32 fpTemp = inputSample;
- fpNShape += (inputSample-fpTemp);
- inputSample += fpNShape;
- //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
+ //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;
sourceP += inNumChannels; destP += inNumChannels;
}
- fpNShape *= 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.
}