aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp')
-rwxr-xr-xplugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp b/plugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp
index a3a6b99..fc8ef54 100755
--- a/plugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp
+++ b/plugins/MacAU/DitherMeDiskers/DitherMeDiskers.cpp
@@ -184,6 +184,15 @@ void DitherMeDiskers::DitherMeDiskersKernel::Process( const Float32 *inSourceP
noiseShaping += outputSample;
noiseShaping -= lastSample;
+ if (outputSample > 32760.0) {
+ outputSample = 32760.0;
+ noiseShaping *= 0.5;
+ }
+ if (outputSample < -32760.0) {
+ outputSample = -32760.0;
+ noiseShaping *= 0.5;
+ }
+
*destP = outputSample / 32768.0; //scale it back down to 16 bit resolution
sourceP += inNumChannels;