diff options
Diffstat (limited to 'plugins/MacAU/ToTape5/ToTape5.cpp')
-rwxr-xr-x | plugins/MacAU/ToTape5/ToTape5.cpp | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/plugins/MacAU/ToTape5/ToTape5.cpp b/plugins/MacAU/ToTape5/ToTape5.cpp index abe8496..2135e1d 100755 --- a/plugins/MacAU/ToTape5/ToTape5.cpp +++ b/plugins/MacAU/ToTape5/ToTape5.cpp @@ -238,9 +238,7 @@ void ToTape5::ToTape5Kernel::Reset() sweep = 0.0; rateof = 0.5; nextmax = 0.5; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -258,7 +256,8 @@ void ToTape5::ToTape5Kernel::Process( const Float32 *inSourceP, Float64 overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - + long double fpOld = 0.618033988749894848204586; //golden ratio! + Float64 inputgain = pow(GetParameter( kParam_One )+1.0,3); Float64 outputgain = GetParameter( kParam_Five ); Float64 wet = GetParameter( kParam_Six ); @@ -295,12 +294,7 @@ void ToTape5::ToTape5Kernel::Process( const Float32 *inSourceP, SInt32 count; Float64 tempSample; Float64 drySample; - - long double inputSample; - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (nSampleFrames-- > 0) { inputSample = *sourceP; @@ -478,19 +472,11 @@ void ToTape5::ToTape5Kernel::Process( const Float32 *inSourceP, } - //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; |