aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp')
-rwxr-xr-xplugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp63
1 files changed, 18 insertions, 45 deletions
diff --git a/plugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp b/plugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp
index 9bf7244..3538710 100755
--- a/plugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp
+++ b/plugins/MacVST/Console4Channel/source/Console4ChannelProc.cpp
@@ -18,10 +18,6 @@ void Console4Channel::processReplacing(float **inputs, float **outputs, VstInt32
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- float fpTemp;
- double fpOld = 0.618033988749894848204586; //golden ratio!
- double fpNew = 1.0 - fpOld;
-
long double inputSampleL;
long double inputSampleR;
long double half;
@@ -105,25 +101,14 @@ void Console4Channel::processReplacing(float **inputs, float **outputs, VstInt32
//this is part of the Purest line: stuff that is on every track
//needs to be DAMN LOW ON MATH srsly guys
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -145,9 +130,6 @@ void Console4Channel::processDoubleReplacing(double **inputs, double **outputs,
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- double fpTemp; //this is different from singlereplacing
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -232,25 +214,16 @@ void Console4Channel::processDoubleReplacing(double **inputs, double **outputs,
//this is part of the Purest line: stuff that is on every track
//needs to be DAMN LOW ON MATH srsly guys
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 64 bit output
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
*out1 = inputSampleL;
*out2 = inputSampleR;