aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/C5RawChannel/C5RawChannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/C5RawChannel/C5RawChannel.cpp')
-rwxr-xr-xplugins/MacAU/C5RawChannel/C5RawChannel.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/plugins/MacAU/C5RawChannel/C5RawChannel.cpp b/plugins/MacAU/C5RawChannel/C5RawChannel.cpp
index 15d4f7a..2b2eb79 100755
--- a/plugins/MacAU/C5RawChannel/C5RawChannel.cpp
+++ b/plugins/MacAU/C5RawChannel/C5RawChannel.cpp
@@ -160,9 +160,7 @@ void C5RawChannel::C5RawChannelKernel::Reset()
{
lastFXChannel = 0.0;
lastSampleChannel = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -177,9 +175,6 @@ void C5RawChannel::C5RawChannelKernel::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);
@@ -238,19 +233,11 @@ void C5RawChannel::C5RawChannelKernel::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;