aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/WinVST/AtmosphereBuss
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
committerChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
commit966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch)
treeb0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/WinVST/AtmosphereBuss
parent0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff)
downloadairwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip
Floating Point Dither For All
Diffstat (limited to 'plugins/WinVST/AtmosphereBuss')
-rwxr-xr-xplugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suobin23040 -> 23040 bytes
-rwxr-xr-xplugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp56
2 files changed, 18 insertions, 38 deletions
diff --git a/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo b/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo
index 48715fd..c97c439 100755
--- a/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo
+++ b/plugins/WinVST/AtmosphereBuss/.vs/VSTProject/v14/.suo
Binary files differ
diff --git a/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp b/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp
index 6530a7e..16d7a31 100755
--- a/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp
+++ b/plugins/WinVST/AtmosphereBuss/AtmosphereBussProc.cpp
@@ -13,7 +13,6 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
@@ -250,18 +249,14 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32
lastSampleAR = drySampleR;
//store the raw R input sample again for use next time
- //noise shaping to 32-bit floating point
- fpTemp = inputSampleL;
- fpNShapeL += (inputSampleL-fpTemp);
- inputSampleL += fpNShapeL;
- //if this confuses you look at the wordlength for fpTemp :)
- fpTemp = inputSampleR;
- fpNShapeR += (inputSampleR-fpTemp);
- inputSampleR += fpNShapeR;
- //for deeper space and warmth, we try a non-oscillating noise shaping
- //that is kind of ruthless: it will forever retain the rounding errors
- //except we'll dial it back a hair at the end of every buffer processed
- //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;
@@ -271,12 +266,6 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32
*out1++;
*out2++;
}
- fpNShapeL *= 0.999999;
- fpNShapeR *= 0.999999;
- //we will just delicately dial back the FP noise shaping, not even every sample
- //this is a good place to put subtle 'no runaway' calculations, though bear in mind
- //that it will be called more often when you use shorter sample buffers in the DAW.
- //So, very low latency operation will call these calculations more often.
}
void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
@@ -285,7 +274,6 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
- double fpTemp;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
@@ -522,18 +510,16 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V
lastSampleAR = drySampleR;
//store the raw R input sample again for use next time
- //noise shaping to 64-bit floating point
- fpTemp = inputSampleL;
- fpNShapeL += (inputSampleL-fpTemp);
- inputSampleL += fpNShapeL;
- //if this confuses you look at the wordlength for fpTemp :)
- fpTemp = inputSampleR;
- fpNShapeR += (inputSampleR-fpTemp);
- inputSampleR += fpNShapeR;
- //for deeper space and warmth, we try a non-oscillating noise shaping
- //that is kind of ruthless: it will forever retain the rounding errors
- //except we'll dial it back a hair at the end of every buffer processed
- //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;
@@ -543,10 +529,4 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V
*out1++;
*out2++;
}
- fpNShapeL *= 0.999999;
- fpNShapeR *= 0.999999;
- //we will just delicately dial back the FP noise shaping, not even every sample
- //this is a good place to put subtle 'no runaway' calculations, though bear in mind
- //that it will be called more often when you use shorter sample buffers in the DAW.
- //So, very low latency operation will call these calculations more often.
} \ No newline at end of file