YNotBandpass

This commit is contained in:
Christopher Johnson 2023-10-21 19:54:52 -04:00
parent c6a220ed39
commit 08ade46aad
34 changed files with 996 additions and 1653 deletions

View file

@ -14,7 +14,7 @@ ConsoleMCBuss::ConsoleMCBuss(audioMasterCallback audioMaster) :
{
A = 1.0;
for (int x = 0; x < gslew_total; x++) gslew[x] = 0.0;
lastSinewL = lastSinewR = 0.0;
subAL = subAR = subBL = subBR = subCL = subCR = subDL = subDR = 0.0;
gainA = gainB = 1.0;

View file

@ -52,61 +52,9 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
enum {
prevSampL1,
prevSampR1,
invSampL1,
invSampR1,
threshold1,
prevSampL2,
prevSampR2,
invSampL2,
invSampR2,
threshold2,
prevSampL3,
prevSampR3,
invSampL3,
invSampR3,
threshold3,
prevSampL4,
prevSampR4,
invSampL4,
invSampR4,
threshold4,
prevSampL5,
prevSampR5,
invSampL5,
invSampR5,
threshold5,
prevSampL6,
prevSampR6,
invSampL6,
invSampR6,
threshold6,
prevSampL7,
prevSampR7,
invSampL7,
invSampR7,
threshold7,
prevSampL8,
prevSampR8,
invSampL8,
invSampR8,
threshold8,
prevSampL9,
prevSampR9,
invSampL9,
invSampR9,
threshold9,
prevSampL10,
prevSampR10,
invSampL10,
invSampR10,
threshold10,
gslew_total
}; //fixed frequency pear filter for ultrasonics, stereo
double gslew[gslew_total]; //probably worth just using a number here
double lastSinewL;
double lastSinewR;
double subAL;
double subAR;
double subBL;

View file

@ -18,37 +18,17 @@ void ConsoleMCBuss::processReplacing(float **inputs, float **outputs, VstInt32 s
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double source = 0.814/overallscale;
gslew[threshold10] = source;
source *= 1.618033988749894848204586;
gslew[threshold9] = source;
source *= 1.618033988749894848204586;
gslew[threshold8] = source;
source *= 1.618033988749894848204586;
gslew[threshold7] = source;
source *= 1.618033988749894848204586;
gslew[threshold6] = source;
source *= 1.618033988749894848204586;
gslew[threshold5] = source;
source *= 1.618033988749894848204586;
gslew[threshold4] = source;
source *= 1.618033988749894848204586;
gslew[threshold3] = source;
source *= 1.618033988749894848204586;
gslew[threshold2] = source;
source *= 1.618033988749894848204586;
gslew[threshold1] = source;
source *= 1.618033988749894848204586;
gainA = gainB;
gainB = sqrt(A); //smoothed master fader from Z2 filters
//this will be applied three times: this is to make the various tone alterations
//hit differently at different master fader drive levels.
//in particular, backing off the master fader tightens the super lows
//but opens up the EverySlew, because more of the attentuation happens before
//but opens up the modified Sinew, because more of the attentuation happens before
//you even get to slew clipping :) and if the fader is not active, it bypasses completely.
double threshSinew = 0.5171104/overallscale;
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
@ -120,23 +100,22 @@ void ConsoleMCBuss::processReplacing(float **inputs, float **outputs, VstInt32 s
//after C7Buss but before EverySlew: allow highs to come out a bit more
//when pulling back master fader. Less drive equals more open
//begin EverySlew
for (int x = 20; x < gslew_total; x += 5) { //gslew_total is 50
if (((inputSampleL-gslew[x])-((gslew[x]-gslew[x+2])*0.618033988749894848204586)) > gslew[x+4])
inputSampleL = (gslew[x]-((gslew[x]-gslew[x+2])*0.141)) + (gslew[x+4]*(1.0-0.141));
if (-((inputSampleL-gslew[x])-((gslew[x]-gslew[x+2])*0.618033988749894848204586)) > gslew[x+4])
inputSampleL = (gslew[x]-((gslew[x]-gslew[x+2])*0.141*0.78)) - (gslew[x+4]*(1.0-(0.141*0.78)));
gslew[x+2] = gslew[x]*(1.0-0.141);
gslew[x] = inputSampleL;
if (((inputSampleR-gslew[x+1])-((gslew[x+1]-gslew[x+3])*0.618033988749894848204586)) > gslew[x+4])
inputSampleR = (gslew[x+1]-((gslew[x+1]-gslew[x+3])*0.141)) + (gslew[x+4]*(1.0-0.141));
if (-((inputSampleR-gslew[x+1])-((gslew[x+1]-gslew[x+3])*0.618033988749894848204586)) > gslew[x+4])
inputSampleR = (gslew[x+1]-((gslew[x+1]-gslew[x+3])*0.141*0.78)) - (gslew[x+4]*(1.0-(0.141*0.78)));
gslew[x+3] = gslew[x+1]*(1.0-0.141);
gslew[x+1] = inputSampleR;
}
temp = inputSampleL;
double clamp = inputSampleL - lastSinewL;
if (lastSinewL > 1.0) lastSinewL = 1.0;
if (lastSinewL < -1.0) lastSinewL = -1.0;
double sinew = threshSinew * cos(lastSinewL);
if (clamp > sinew) temp = lastSinewL + sinew;
if (-clamp > sinew) temp = lastSinewL - sinew;
inputSampleL = lastSinewL = temp;
temp = inputSampleR;
clamp = inputSampleR - lastSinewR;
if (lastSinewR > 1.0) lastSinewR = 1.0;
if (lastSinewR < -1.0) lastSinewR = -1.0;
sinew = threshSinew * cos(lastSinewR);
if (clamp > sinew) temp = lastSinewR + sinew;
if (-clamp > sinew) temp = lastSinewR - sinew;
inputSampleR = lastSinewR = temp;
if (gain < 1.0) {
inputSampleL *= gain;
@ -174,37 +153,17 @@ void ConsoleMCBuss::processDoubleReplacing(double **inputs, double **outputs, Vs
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double source = 0.814/overallscale;
gslew[threshold10] = source;
source *= 1.618033988749894848204586;
gslew[threshold9] = source;
source *= 1.618033988749894848204586;
gslew[threshold8] = source;
source *= 1.618033988749894848204586;
gslew[threshold7] = source;
source *= 1.618033988749894848204586;
gslew[threshold6] = source;
source *= 1.618033988749894848204586;
gslew[threshold5] = source;
source *= 1.618033988749894848204586;
gslew[threshold4] = source;
source *= 1.618033988749894848204586;
gslew[threshold3] = source;
source *= 1.618033988749894848204586;
gslew[threshold2] = source;
source *= 1.618033988749894848204586;
gslew[threshold1] = source;
source *= 1.618033988749894848204586;
gainA = gainB;
gainB = sqrt(A); //smoothed master fader from Z2 filters
//this will be applied three times: this is to make the various tone alterations
//hit differently at different master fader drive levels.
//in particular, backing off the master fader tightens the super lows
//but opens up the EverySlew, because more of the attentuation happens before
//but opens up the modified Sinew, because more of the attentuation happens before
//you even get to slew clipping :) and if the fader is not active, it bypasses completely.
double threshSinew = 0.5171104/overallscale;
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
@ -276,23 +235,22 @@ void ConsoleMCBuss::processDoubleReplacing(double **inputs, double **outputs, Vs
//after C7Buss but before EverySlew: allow highs to come out a bit more
//when pulling back master fader. Less drive equals more open
//begin EverySlew
for (int x = 20; x < gslew_total; x += 5) { //gslew_total is 50
if (((inputSampleL-gslew[x])-((gslew[x]-gslew[x+2])*0.618033988749894848204586)) > gslew[x+4])
inputSampleL = (gslew[x]-((gslew[x]-gslew[x+2])*0.141)) + (gslew[x+4]*(1.0-0.141));
if (-((inputSampleL-gslew[x])-((gslew[x]-gslew[x+2])*0.618033988749894848204586)) > gslew[x+4])
inputSampleL = (gslew[x]-((gslew[x]-gslew[x+2])*0.141*0.78)) - (gslew[x+4]*(1.0-(0.141*0.78)));
gslew[x+2] = gslew[x]*(1.0-0.141);
gslew[x] = inputSampleL;
if (((inputSampleR-gslew[x+1])-((gslew[x+1]-gslew[x+3])*0.618033988749894848204586)) > gslew[x+4])
inputSampleR = (gslew[x+1]-((gslew[x+1]-gslew[x+3])*0.141)) + (gslew[x+4]*(1.0-0.141));
if (-((inputSampleR-gslew[x+1])-((gslew[x+1]-gslew[x+3])*0.618033988749894848204586)) > gslew[x+4])
inputSampleR = (gslew[x+1]-((gslew[x+1]-gslew[x+3])*0.141*0.78)) - (gslew[x+4]*(1.0-(0.141*0.78)));
gslew[x+3] = gslew[x+1]*(1.0-0.141);
gslew[x+1] = inputSampleR;
}
temp = inputSampleL;
double clamp = inputSampleL - lastSinewL;
if (lastSinewL > 1.0) lastSinewL = 1.0;
if (lastSinewL < -1.0) lastSinewL = -1.0;
double sinew = threshSinew * cos(lastSinewL);
if (clamp > sinew) temp = lastSinewL + sinew;
if (-clamp > sinew) temp = lastSinewL - sinew;
inputSampleL = lastSinewL = temp;
temp = inputSampleR;
clamp = inputSampleR - lastSinewR;
if (lastSinewR > 1.0) lastSinewR = 1.0;
if (lastSinewR < -1.0) lastSinewR = -1.0;
sinew = threshSinew * cos(lastSinewR);
if (clamp > sinew) temp = lastSinewR + sinew;
if (-clamp > sinew) temp = lastSinewR - sinew;
inputSampleR = lastSinewR = temp;
if (gain < 1.0) {
inputSampleL *= gain;