aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/WinVST/Fracture/FractureProc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/WinVST/Fracture/FractureProc.cpp')
-rwxr-xr-xplugins/WinVST/Fracture/FractureProc.cpp62
1 files changed, 18 insertions, 44 deletions
diff --git a/plugins/WinVST/Fracture/FractureProc.cpp b/plugins/WinVST/Fracture/FractureProc.cpp
index 8e217d8..5c1aaa9 100755
--- a/plugins/WinVST/Fracture/FractureProc.cpp
+++ b/plugins/WinVST/Fracture/FractureProc.cpp
@@ -14,9 +14,6 @@ void Fracture::processReplacing(float **inputs, float **outputs, VstInt32 sample
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double density = A*4;
double fracture = (((B*2.999)+1)*3.14159265358979);
@@ -101,25 +98,14 @@ void Fracture::processReplacing(float **inputs, float **outputs, VstInt32 sample
inputSampleL = (drySampleL * dry)+(inputSampleL * wet);
inputSampleR = (drySampleR * dry)+(inputSampleR * wet);
- //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;
@@ -141,9 +127,6 @@ void Fracture::processDoubleReplacing(double **inputs, double **outputs, VstInt3
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;
double density = A*4;
double fracture = (((B*2.999)+1)*3.14159265358979);
@@ -228,25 +211,16 @@ void Fracture::processDoubleReplacing(double **inputs, double **outputs, VstInt3
inputSampleL = (drySampleL * dry)+(inputSampleL * wet);
inputSampleR = (drySampleR * dry)+(inputSampleR * wet);
- //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;