diff options
Diffstat (limited to 'plugins/MacAU/PDChannel/PDChannel.cpp')
-rwxr-xr-x | plugins/MacAU/PDChannel/PDChannel.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/plugins/MacAU/PDChannel/PDChannel.cpp b/plugins/MacAU/PDChannel/PDChannel.cpp index d0e684f..1571b15 100755 --- a/plugins/MacAU/PDChannel/PDChannel.cpp +++ b/plugins/MacAU/PDChannel/PDChannel.cpp @@ -170,9 +170,7 @@ void PDChannel::PDChannelKernel::Reset() settingchase = -90.0; chasespeed = 350.0; previousSample = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -189,11 +187,7 @@ void PDChannel::PDChannelKernel::Process( const Float32 *inSourceP, Float32 *destP = inDestP; long double overallscale = 1.0; overallscale /= 44100.0; - overallscale *= GetSampleRate(); - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + overallscale *= GetSampleRate(); Float64 inputgain = GetParameter( kParam_One ); Float64 intensity = GetParameter( kParam_Two ); Float64 apply; @@ -271,19 +265,11 @@ void PDChannel::PDChannelKernel::Process( const Float32 *inSourceP, previousSample = sin(drySample); //apply the sine while storing previous sample - //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; |