From c653c8b38fdc79f61ee191052901ac2012d476b4 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 5 Jul 2020 22:01:06 -0400 Subject: DeRez Dither Updates (Beam, Dark, NJAD) --- plugins/WinVST/Dark/.vs/VSTProject/v14/.suo | Bin 22528 -> 23040 bytes plugins/WinVST/Dark/Dark.cpp | 2 +- plugins/WinVST/Dark/DarkProc.cpp | 20 +++++++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'plugins/WinVST/Dark') diff --git a/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo b/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo index 54d92ad..cc5812b 100755 Binary files a/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo and b/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo differ diff --git a/plugins/WinVST/Dark/Dark.cpp b/plugins/WinVST/Dark/Dark.cpp index bae0428..f652aa4 100755 --- a/plugins/WinVST/Dark/Dark.cpp +++ b/plugins/WinVST/Dark/Dark.cpp @@ -14,11 +14,11 @@ Dark::Dark(audioMasterCallback audioMaster) : { A = 1.0; B = 0.0; + fpd = 17; for(int count = 0; count < 99; count++) { lastSampleL[count] = 0; lastSampleR[count] = 0; } - fpd = 17; //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/Dark/DarkProc.cpp b/plugins/WinVST/Dark/DarkProc.cpp index 2aa85c4..955a53f 100755 --- a/plugins/WinVST/Dark/DarkProc.cpp +++ b/plugins/WinVST/Dark/DarkProc.cpp @@ -13,13 +13,14 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - int processing = (VstInt32)( A * 1.999 ); double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); int depth = (int)(17.0*overallscale); if (depth < 3) depth = 3; if (depth > 98) depth = 98; + + int processing = (VstInt32)( A * 1.999 ); bool highres = false; if (processing == 1) highres = true; float scaleFactor; @@ -28,6 +29,8 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram float derez = B; if (derez > 0.0) scaleFactor *= pow(1.0-derez,6); if (scaleFactor < 0.0001) scaleFactor = 0.0001; + float outScale = scaleFactor; + if (outScale < 8.0) outScale = 8.0; while (--sampleFrames >= 0) { @@ -105,8 +108,8 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram lastSampleR[0] = inputSampleR; //end right - inputSampleL /= scaleFactor; - inputSampleR /= scaleFactor; + inputSampleL /= outScale; + inputSampleR /= outScale; *out1 = inputSampleL; *out2 = inputSampleR; @@ -125,13 +128,14 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa double* out1 = outputs[0]; double* out2 = outputs[1]; - int processing = (VstInt32)( A * 1.999 ); double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); int depth = (int)(17.0*overallscale); if (depth < 3) depth = 3; if (depth > 98) depth = 98; + + int processing = (VstInt32)( A * 1.999 ); bool highres = false; if (processing == 1) highres = true; float scaleFactor; @@ -139,7 +143,9 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa else scaleFactor = 32768.0; float derez = B; if (derez > 0.0) scaleFactor *= pow(1.0-derez,6); - if (scaleFactor < 1.0) scaleFactor = 1.0; + if (scaleFactor < 0.0001) scaleFactor = 0.0001; + float outScale = scaleFactor; + if (outScale < 8.0) outScale = 8.0; while (--sampleFrames >= 0) { @@ -217,8 +223,8 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa lastSampleR[0] = inputSampleR; //end right - inputSampleL /= scaleFactor; - inputSampleR /= scaleFactor; + inputSampleL /= outScale; + inputSampleR /= outScale; *out1 = inputSampleL; *out2 = inputSampleR; -- cgit v1.2.3