diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
commit | 966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch) | |
tree | b0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/WinVST/PurestDrive | |
parent | 0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff) | |
download | airwindows-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/PurestDrive')
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo | bin | 32768 -> 32768 bytes | |||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo | bin | 22528 -> 23040 bytes | |||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/PurestDrive.cpp | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/PurestDrive.h | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/PurestDriveProc.cpp | 62 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/VSTProject.sln | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/VSTProject.vcxproj | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/VSTProject.vcxproj.user | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/WinVST/PurestDrive/vstplug.def | 0 |
10 files changed, 22 insertions, 54 deletions
diff --git a/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo b/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo Binary files differindex 777b846..777b846 100644..100755 --- a/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo +++ b/plugins/WinVST/PurestDrive/.vs/Console4Channel64/v14/.suo diff --git a/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo b/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo Binary files differindex 2c7648b..b079ddd 100644..100755 --- a/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo +++ b/plugins/WinVST/PurestDrive/.vs/VSTProject/v14/.suo diff --git a/plugins/WinVST/PurestDrive/PurestDrive.cpp b/plugins/WinVST/PurestDrive/PurestDrive.cpp index e2451fe..a1d9264 100644..100755 --- a/plugins/WinVST/PurestDrive/PurestDrive.cpp +++ b/plugins/WinVST/PurestDrive/PurestDrive.cpp @@ -17,11 +17,8 @@ PurestDrive::PurestDrive(audioMasterCallback audioMaster) : previousSampleL = 0.0; previousSampleR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //this is reset: values being initialized only once. Startup values, whatever they are. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. diff --git a/plugins/WinVST/PurestDrive/PurestDrive.h b/plugins/WinVST/PurestDrive/PurestDrive.h index 1f5b349..abcd65b 100644..100755 --- a/plugins/WinVST/PurestDrive/PurestDrive.h +++ b/plugins/WinVST/PurestDrive/PurestDrive.h @@ -52,11 +52,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double previousSampleL; diff --git a/plugins/WinVST/PurestDrive/PurestDriveProc.cpp b/plugins/WinVST/PurestDrive/PurestDriveProc.cpp index e453883..f5cc804 100644..100755 --- a/plugins/WinVST/PurestDrive/PurestDriveProc.cpp +++ b/plugins/WinVST/PurestDrive/PurestDriveProc.cpp @@ -14,9 +14,6 @@ void PurestDrive::processReplacing(float **inputs, float **outputs, VstInt32 sam float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = A; double drySampleL; @@ -90,25 +87,14 @@ void PurestDrive::processReplacing(float **inputs, float **outputs, VstInt32 sam previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //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; @@ -127,9 +113,6 @@ void PurestDrive::processDoubleReplacing(double **inputs, double **outputs, VstI double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double intensity = A; double drySampleL; @@ -204,25 +187,16 @@ void PurestDrive::processDoubleReplacing(double **inputs, double **outputs, VstI previousSampleR = sin(drySampleR); //apply the sine while storing previous sample - //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; diff --git a/plugins/WinVST/PurestDrive/VSTProject.sln b/plugins/WinVST/PurestDrive/VSTProject.sln index 694b424..694b424 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.sln +++ b/plugins/WinVST/PurestDrive/VSTProject.sln diff --git a/plugins/WinVST/PurestDrive/VSTProject.vcxproj b/plugins/WinVST/PurestDrive/VSTProject.vcxproj index 15515bd..15515bd 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.vcxproj +++ b/plugins/WinVST/PurestDrive/VSTProject.vcxproj diff --git a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters index 1f8d945..1f8d945 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters +++ b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.filters diff --git a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user index 2216267..2216267 100644..100755 --- a/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user +++ b/plugins/WinVST/PurestDrive/VSTProject.vcxproj.user diff --git a/plugins/WinVST/PurestDrive/vstplug.def b/plugins/WinVST/PurestDrive/vstplug.def index 5bf499a..5bf499a 100644..100755 --- a/plugins/WinVST/PurestDrive/vstplug.def +++ b/plugins/WinVST/PurestDrive/vstplug.def |