aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/LinuxVST
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2020-06-14 21:15:05 -0400
committerChris Johnson <jinx6568@sover.net>2020-06-14 21:15:05 -0400
commit6e0febe954289baac253c2b432d1dc4dec403c30 (patch)
treed8780d64a2a3f4abeeacc780014e4ac8f1d132b7 /plugins/LinuxVST
parent169631d08c44b5a46391e5ab90284ef07de46853 (diff)
downloadairwindows-lv2-port-6e0febe954289baac253c2b432d1dc4dec403c30.tar.gz
airwindows-lv2-port-6e0febe954289baac253c2b432d1dc4dec403c30.tar.bz2
airwindows-lv2-port-6e0febe954289baac253c2b432d1dc4dec403c30.zip
Dark Redux
Diffstat (limited to 'plugins/LinuxVST')
-rwxr-xr-xplugins/LinuxVST/src/Dark/Dark.cpp8
-rwxr-xr-xplugins/LinuxVST/src/Dark/Dark.h4
-rwxr-xr-xplugins/LinuxVST/src/Dark/DarkProc.cpp50
3 files changed, 33 insertions, 29 deletions
diff --git a/plugins/LinuxVST/src/Dark/Dark.cpp b/plugins/LinuxVST/src/Dark/Dark.cpp
index 0f9721c..bae0428 100755
--- a/plugins/LinuxVST/src/Dark/Dark.cpp
+++ b/plugins/LinuxVST/src/Dark/Dark.cpp
@@ -13,6 +13,7 @@ Dark::Dark(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 1.0;
+ B = 0.0;
for(int count = 0; count < 99; count++) {
lastSampleL[count] = 0;
lastSampleR[count] = 0;
@@ -50,6 +51,7 @@ VstInt32 Dark::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
+ chunkData[1] = B;
/* Note: The way this is set up, it will break if you manage to save settings on an Intel
machine and load them on a PPC Mac. However, it's fine if you stick to the machine you
started with. */
@@ -62,6 +64,7 @@ VstInt32 Dark::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
+ B = pinParameter(chunkData[1]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@@ -72,6 +75,7 @@ VstInt32 Dark::setChunk (void* data, VstInt32 byteSize, bool isPreset)
void Dark::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
+ case kParamB: B = value; break;
default: throw; // unknown parameter, shouldn't happen!
}
}
@@ -79,6 +83,7 @@ void Dark::setParameter(VstInt32 index, float value) {
float Dark::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
+ case kParamB: return B; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
@@ -86,6 +91,7 @@ float Dark::getParameter(VstInt32 index) {
void Dark::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Quant", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, "DeRez", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
@@ -97,6 +103,7 @@ void Dark::getParameterDisplay(VstInt32 index, char *text) {
case 1: vst_strncpy (text, "HD 24", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} break; //completed consoletype 'popup' parameter, exit
+ case kParamB: float2string (B, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
@@ -104,6 +111,7 @@ void Dark::getParameterDisplay(VstInt32 index, char *text) {
void Dark::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break;
+ case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}
diff --git a/plugins/LinuxVST/src/Dark/Dark.h b/plugins/LinuxVST/src/Dark/Dark.h
index a54d31b..df557e8 100755
--- a/plugins/LinuxVST/src/Dark/Dark.h
+++ b/plugins/LinuxVST/src/Dark/Dark.h
@@ -17,7 +17,8 @@
enum {
kParamA = 0,
- kNumParameters = 1
+ kParamB = 1,
+ kNumParameters = 2
}; //
const int kNumPrograms = 0;
@@ -58,6 +59,7 @@ private:
//default stuff
float A;
+ float B;
};
#endif
diff --git a/plugins/LinuxVST/src/Dark/DarkProc.cpp b/plugins/LinuxVST/src/Dark/DarkProc.cpp
index 672d8e0..2aa85c4 100755
--- a/plugins/LinuxVST/src/Dark/DarkProc.cpp
+++ b/plugins/LinuxVST/src/Dark/DarkProc.cpp
@@ -22,6 +22,12 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
if (depth > 98) depth = 98;
bool highres = false;
if (processing == 1) highres = true;
+ float scaleFactor;
+ if (highres) scaleFactor = 8388608.0;
+ else scaleFactor = 32768.0;
+ float derez = B;
+ if (derez > 0.0) scaleFactor *= pow(1.0-derez,6);
+ if (scaleFactor < 0.0001) scaleFactor = 0.0001;
while (--sampleFrames >= 0)
{
@@ -32,14 +38,10 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
- if (highres) {
- inputSampleL *= 8388608.0;
- inputSampleR *= 8388608.0;
- } else {
- inputSampleL *= 32768.0;
- inputSampleR *= 32768.0;
- }
+ inputSampleL *= scaleFactor;
+ inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither
+
//We are doing it first Left, then Right, because the loops may run faster if
//they aren't too jammed full of variables. This means re-running code.
@@ -103,13 +105,8 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
lastSampleR[0] = inputSampleR;
//end right
- if (highres) {
- inputSampleL /= 8388608.0;
- inputSampleR /= 8388608.0;
- } else {
- inputSampleL /= 32768.0;
- inputSampleR /= 32768.0;
- }
+ inputSampleL /= scaleFactor;
+ inputSampleR /= scaleFactor;
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -137,6 +134,12 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
if (depth > 98) depth = 98;
bool highres = false;
if (processing == 1) highres = true;
+ float scaleFactor;
+ if (highres) scaleFactor = 8388608.0;
+ else scaleFactor = 32768.0;
+ float derez = B;
+ if (derez > 0.0) scaleFactor *= pow(1.0-derez,6);
+ if (scaleFactor < 1.0) scaleFactor = 1.0;
while (--sampleFrames >= 0)
{
@@ -147,14 +150,10 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
- if (highres) {
- inputSampleL *= 8388608.0;
- inputSampleR *= 8388608.0;
- } else {
- inputSampleL *= 32768.0;
- inputSampleR *= 32768.0;
- }
+ inputSampleL *= scaleFactor;
+ inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither
+
//We are doing it first Left, then Right, because the loops may run faster if
//they aren't too jammed full of variables. This means re-running code.
@@ -218,13 +217,8 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
lastSampleR[0] = inputSampleR;
//end right
- if (highres) {
- inputSampleL /= 8388608.0;
- inputSampleR /= 8388608.0;
- } else {
- inputSampleL /= 32768.0;
- inputSampleR /= 32768.0;
- }
+ inputSampleL /= scaleFactor;
+ inputSampleR /= scaleFactor;
*out1 = inputSampleL;
*out2 = inputSampleR;