diff options
Diffstat (limited to 'plugins/MacAU/IronOxide5/IronOxide5.cpp')
-rwxr-xr-x | plugins/MacAU/IronOxide5/IronOxide5.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/plugins/MacAU/IronOxide5/IronOxide5.cpp b/plugins/MacAU/IronOxide5/IronOxide5.cpp index f0c27dd..c64d19a 100755 --- a/plugins/MacAU/IronOxide5/IronOxide5.cpp +++ b/plugins/MacAU/IronOxide5/IronOxide5.cpp @@ -224,9 +224,7 @@ void IronOxide5::IronOxide5Kernel::Reset() sweep = 0.0; rateof = 0.5; nextmax = 0.5; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -288,11 +286,6 @@ void IronOxide5::IronOxide5Kernel::Process( const Float32 *inSourceP, Float64 dry = 1.0; if (invdrywet > 0.0) dry -= invdrywet; - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; - - while (nSampleFrames-- > 0) { inputSample = *sourceP; if (inputSample<1.2e-38 && -inputSample<1.2e-38) { @@ -475,7 +468,7 @@ void IronOxide5::IronOxide5Kernel::Process( const Float32 *inSourceP, inputSample += (prevInputSample*randy); prevInputSample = drySample; - flip = not flip; + flip = !flip; //begin invdrywet block with outputgain if (outputgain != 1.0) inputSample *= outputgain; @@ -484,23 +477,14 @@ void IronOxide5::IronOxide5Kernel::Process( const Float32 *inSourceP, if (fabs(drySample) > 0.0) inputSample += drySample; //end invdrywet block with outputgain - //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 = not 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; - sourceP += inNumChannels; destP += inNumChannels; } } |