PurestDualPan

This commit is contained in:
Christopher Johnson 2025-12-13 17:44:06 -05:00
parent bfff4df7e6
commit c357ed8bca
286 changed files with 53993 additions and 25943 deletions

View file

@ -47,7 +47,7 @@ Tape: TapeHack, ToTape8, ToTape7, ToTape6, FromTape, Tape, IronOxideClassic2, Ir
Tone Color: BussColors4, Channel9, Apicolypse, Neverland, Elation, Calibre, Cider, Crystal, Precious, Luxor, Channel8, Channel7, Channel6, Channel5, Channel4
Utility: SoftClock2, SoftClock, DubPlate2, DubPlate, CansAW, Cans, Monitoring3, Monitoring2, Monitoring, BitShiftPan, BitShiftGain, PurestGain, PurestFade, EveryTrim, HermeTrim, SlewOnly, SubsOnly, PeaksOnly, Golem, DCVoltage, LRConvolve2, LRConvolve, EdIsDim, MidSide, uLawEncode, uLawDecode, RightoMono, LeftoMono, Balanced, Flipity, MoNoam, VoiceTrick, DeCrackle, ContentHideD
Utility: SoftClock2, SoftClock, BitShiftPan, BitShiftGain, PurestGain, PurestDualPan, PurestFade, Monitoring3, Monitoring2, Monitoring, EveryTrim, HermeTrim, DubPlate2, DubPlate, CansAW, Cans, SlewOnly, SubsOnly, PeaksOnly, Golem, DCVoltage, LRConvolve2, LRConvolve, EdIsDim, MidSide, uLawEncode, uLawDecode, RightoMono, LeftoMono, Balanced, Flipity, MoNoam, VoiceTrick, DeCrackle, ContentHideD
XYZ Filters: ZBandpass2, ZHighpass2, ZLowpass2, ZNotch2, ZRegion2, ZBandpass, ZHighpass, ZLowpass, ZNotch, ZRegion, YBandpass, YNotBandpass, YHighpass, YNotHighpass, YLowpass, YNotLowpass, YNotch, YNotNotch, XBandpass. XHighpass, XLowpass, XNotch, XRegion
@ -4374,6 +4374,14 @@ Anyway, its yours if you want it. There are many odd ways to do EQ code. This
Me, Im more interested in dark reverbs and deeper spaces and bass, so this was never my pet plugin: maybe it can be yours :)
############ PurestDualPan is an updated PurestGain but as a dual pan.
This one's by patron request: as in, one specific patron REALLY wanted a PurestDualPan, so now everybody has one :)
It is using dezippering, but instead of the much slower one from PurestGain, it's the quicker and more direct one from out of the Z filter plugins. It's using the pan law I used in Console9 and later, that uses sine functions to come up with a pan law. And it's using a quirky little audio taper in its left and right gain controls, so that 0.5 is unity gain, but full crank is actually 3.069492192001773 because it's 2 to the power of the golden ratio, same for the taper of attenuating anything. This produces a funny sort of taper that I like, and also makes it impossible to reference the actual control's number in any useful way. So, behave as if you can't see numbers, they certainly won't be what you think they are and there's no predicting what they will be in dB terms.
I have a Bit Shift one also, but it doesn't strictly count as that because it requires an add as part of the algorithm. This one counts as a PurestGain, though! If you're a PurestGain fan, this is the same only as a dual pan.
############ PurestConsoleBuss is the most free from coloration Console system.
############ PurestConsoleChannel is the most free from coloration Console system.
@ -4496,7 +4504,7 @@ Thats a surprising amount to say about a gain plugin, but thats Airwindows
############ PurestSaturation is an experiment in softclipping.
Not so long ago, I pushed and pulled the parameters of a sin() function (thing called a Taylor series expansion) to produce TapeHack, which is a softclip that uses the wrong valus for a sin() softclip, to produce another softclip that feels more retro and vintage.
Not so long ago, I pushed and pulled the parameters of a sin() function (thing called a Taylor series expansion) to produce TapeHack, which is a softclip that uses the wrong values for a sin() softclip, to produce another softclip that feels more retro and vintage.
But what if we did something weirder? Specifically, doing this requires that you divide by increasingly huge numbers. For a real sin() these are factorials (very huge indeed). For TapeHack, I doctored these until the shape of the softclip did exactly what I wanted.

View file

@ -188,6 +188,7 @@ add_airwindows_plugin(DubSub2)
add_airwindows_plugin(DustBunny)
add_airwindows_plugin(Dynamics)
add_airwindows_plugin(Dynamics2)
add_airwindows_plugin(Dynamics3)
add_airwindows_plugin(Dyno)
add_airwindows_plugin(EQ)
add_airwindows_plugin(Edge)

View file

@ -34,7 +34,7 @@ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
//SmoothEQ3
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompF[bez_cycle] = 1.0;
bezCompS[bez_cycle] = 1.0;
//Dynamics2

View file

@ -95,25 +95,16 @@ private:
//SmoothEQ3
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
//Dynamics2
//Dynamics2 custom for buss
enum {
hilp_freq, hilp_temp,

View file

@ -28,37 +28,47 @@ void ConsoleHBuss::processReplacing(float **inputs, float **outputs, VstInt32 sa
double bassGain = (LOW-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/getSampleRate());
double omega = 2.0*M_PI*(4000.0/getSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/getSampleRate());
omega = 2.0*M_PI*(200.0/getSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/getSampleRate());
omega = 2.0*M_PI*(4000.0/getSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/getSampleRate());
omega = 2.0*M_PI*(200.0/getSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
double bezCThresh = pow(1.0-THR, 6.0) * 8.0;
double bezRez = pow(1.0-THR, 12.360679774997898) / overallscale;
double sloRez = pow(1.0-THR,10.0) / overallscale;
@ -248,101 +258,79 @@ void ConsoleHBuss::processReplacing(float **inputs, float **outputs, VstInt32 sa
} else lowpass[hilp_cR1] = lowpass[hilp_cR2] = lowpass[hilp_cL1] = lowpass[hilp_cL2] = 0.0;
//another stage of Highpass/Lowpass before bringing in the parametric bands
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
}
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//Dynamics2
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * bezRez);
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_C] = bezCompF[bez_B];
bezCompF[bez_B] = bezCompF[bez_A];
bezCompF[bez_A] = bezCompF[bez_Ctrl];
bezCompF[bez_Ctrl] = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * sloRez);
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_C] = bezCompS[bez_B];
bezCompS[bez_B] = bezCompS[bez_A];
bezCompS[bez_A] = bezCompS[bez_Ctrl];
bezCompS[bez_Ctrl] = 0.0;
}
double CBF = (bezCompF[bez_C]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_B]*bezCompF[bez_cycle]);
double BAF = (bezCompF[bez_B]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_A]*bezCompF[bez_cycle]);
double CBAF = (bezCompF[bez_B]+(CBF*(1.0-bezCompF[bez_cycle]))+(BAF*bezCompF[bez_cycle]))*0.5;
double CBS = (bezCompS[bez_C]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_B]*bezCompS[bez_cycle]);
double BAS = (bezCompS[bez_B]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_A]*bezCompS[bez_cycle]);
double CBAS = (bezCompS[bez_B]+(CBS*(1.0-bezCompS[bez_cycle]))+(BAS*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBAS,CBAF); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBAS*-CBAMax)+(CBAF*CBAMax)+1.0)*0.5;
inputSampleL *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
inputSampleR *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
} else {bezCompF[bez_Ctrl] = 0.0; bezCompS[bez_Ctrl] = 0.0;}
//Dynamics2 custom version for buss
if (highpassEngage) { //distributed Highpass
highpass[hilp_temp] = (inputSampleL*highpass[hilp_e0])+highpass[hilp_eL1];
@ -405,47 +393,39 @@ void ConsoleHBuss::processReplacing(float **inputs, float **outputs, VstInt32 sa
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleL *= 0.92;
//end TapeHack section
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double sat = inputSampleL * X;
inputSampleL -= (sat*0.125); sat *= X;
inputSampleL += (sat*0.0078125); sat *= X;
inputSampleL -= (sat*0.000244140625); sat *= X;
inputSampleL += (sat*0.000003814697265625); sat *= X;
inputSampleL -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleR *= 0.92;
//end TapeHack section
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
sat = inputSampleR * X;
inputSampleR -= (sat*0.125); sat *= X;
inputSampleR += (sat*0.0078125); sat *= X;
inputSampleR -= (sat*0.000244140625); sat *= X;
inputSampleR += (sat*0.000003814697265625); sat *= X;
inputSampleR -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//we are leaving it as a clip that will go over 0dB.
//it is a softclip so it will give you a more forgiving experience,
//but you are meant to not drive the softclip for just level.
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);
@ -487,35 +467,45 @@ void ConsoleHBuss::processDoubleReplacing(double **inputs, double **outputs, Vst
double bassGain = (LOW-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/getSampleRate());
double omega = 2.0*M_PI*(4000.0/getSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/getSampleRate());
omega = 2.0*M_PI*(200.0/getSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/getSampleRate());
omega = 2.0*M_PI*(4000.0/getSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/getSampleRate());
omega = 2.0*M_PI*(200.0/getSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
double bezCThresh = pow(1.0-THR, 6.0) * 8.0;
@ -707,101 +697,79 @@ void ConsoleHBuss::processDoubleReplacing(double **inputs, double **outputs, Vst
} else lowpass[hilp_cR1] = lowpass[hilp_cR2] = lowpass[hilp_cL1] = lowpass[hilp_cL2] = 0.0;
//another stage of Highpass/Lowpass before bringing in the parametric bands
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
}
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//Dynamics2
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * bezRez);
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_C] = bezCompF[bez_B];
bezCompF[bez_B] = bezCompF[bez_A];
bezCompF[bez_A] = bezCompF[bez_Ctrl];
bezCompF[bez_Ctrl] = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * sloRez);
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_C] = bezCompS[bez_B];
bezCompS[bez_B] = bezCompS[bez_A];
bezCompS[bez_A] = bezCompS[bez_Ctrl];
bezCompS[bez_Ctrl] = 0.0;
}
double CBF = (bezCompF[bez_C]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_B]*bezCompF[bez_cycle]);
double BAF = (bezCompF[bez_B]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_A]*bezCompF[bez_cycle]);
double CBAF = (bezCompF[bez_B]+(CBF*(1.0-bezCompF[bez_cycle]))+(BAF*bezCompF[bez_cycle]))*0.5;
double CBS = (bezCompS[bez_C]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_B]*bezCompS[bez_cycle]);
double BAS = (bezCompS[bez_B]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_A]*bezCompS[bez_cycle]);
double CBAS = (bezCompS[bez_B]+(CBS*(1.0-bezCompS[bez_cycle]))+(BAS*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBAS,CBAF); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBAS*-CBAMax)+(CBAF*CBAMax)+1.0)*0.5;
inputSampleL *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
inputSampleR *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
} else {bezCompF[bez_Ctrl] = 0.0; bezCompS[bez_Ctrl] = 0.0;}
//Dynamics2 custom version for buss
if (highpassEngage) { //distributed Highpass
highpass[hilp_temp] = (inputSampleL*highpass[hilp_e0])+highpass[hilp_eL1];
@ -864,47 +832,39 @@ void ConsoleHBuss::processDoubleReplacing(double **inputs, double **outputs, Vst
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleL *= 0.92;
//end TapeHack section
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double sat = inputSampleL * X;
inputSampleL -= (sat*0.125); sat *= X;
inputSampleL += (sat*0.0078125); sat *= X;
inputSampleL -= (sat*0.000244140625); sat *= X;
inputSampleL += (sat*0.000003814697265625); sat *= X;
inputSampleL -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleR *= 0.92;
//end TapeHack section
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
sat = inputSampleR * X;
inputSampleR -= (sat*0.125); sat *= X;
inputSampleR += (sat*0.0078125); sat *= X;
inputSampleR -= (sat*0.000244140625); sat *= X;
inputSampleR += (sat*0.000003814697265625); sat *= X;
inputSampleR -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//we are leaving it as a clip that will go over 0dB.
//it is a softclip so it will give you a more forgiving experience,
//but you are meant to not drive the softclip for just level.
//begin 64 bit stereo floating point dither
//int expon; frexp((double)inputSampleL, &expon);

View file

@ -61,10 +61,10 @@ ConsoleHChannel::ConsoleHChannel(audioMasterCallback audioMaster) :
}
//HipCrush with four bands
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPositionL[count] = 0.0;

View file

@ -145,26 +145,18 @@ private:
//HipCrush with four bands
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

File diff suppressed because it is too large Load diff

View file

@ -60,10 +60,11 @@ AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
}
//HipCrush with four bands
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxFL = 0.0; bezMaxFR = 0.0;
bezCompS[bez_cycle] = 1.0; bezGateL = 2.0; bezGateR = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0;
bezMaxL = 0.0; bezMinL = 0.0; bezGateL = 2.0;
bezMaxR = 0.0; bezMinR = 0.0; bezGateR = 2.0; //Dual mono version
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPositionL[count] = 0.0;

View file

@ -146,25 +146,22 @@ private:
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_CtrlL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_CtrlR,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxFL;
double bezMaxFR;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMaxL;
double bezMinL;
double bezGateL;
double bezMaxR;
double bezMinR;
double bezGateR;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

File diff suppressed because it is too large Load diff

View file

@ -12,17 +12,17 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new C
ConsoleX2Buss::ConsoleX2Buss(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.5;
B = 0.5;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 1.0;
J = 0.5;
K = 0.5;
HIG = 0.5;
HMG = 0.5;
LMG = 0.5;
BSG = 0.5;
HIF = 0.5;
HMF = 0.5;
LMF = 0.5;
BSF = 0.5;
THR = 1.0;
PAN = 0.5;
FAD = 0.5;
for (int x = 0; x < biq_total; x++) {
highA[x] = 0.0;
@ -44,7 +44,7 @@ ConsoleX2Buss::ConsoleX2Buss(audioMasterCallback audioMaster) :
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompF[bez_cycle] = 1.0;
bezCompS[bez_cycle] = 1.0;
//Dynamics2
@ -94,17 +94,17 @@ static float pinParameter(float data)
VstInt32 ConsoleX2Buss::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
chunkData[1] = B;
chunkData[2] = C;
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
chunkData[10] = K;
chunkData[0] = HIG;
chunkData[1] = HMG;
chunkData[2] = LMG;
chunkData[3] = BSG;
chunkData[4] = HIF;
chunkData[5] = HMF;
chunkData[6] = LMF;
chunkData[7] = BSF;
chunkData[8] = THR;
chunkData[9] = PAN;
chunkData[10] = FAD;
/* 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. */
@ -116,17 +116,17 @@ VstInt32 ConsoleX2Buss::getChunk (void** data, bool isPreset)
VstInt32 ConsoleX2Buss::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
B = pinParameter(chunkData[1]);
C = pinParameter(chunkData[2]);
D = pinParameter(chunkData[3]);
E = pinParameter(chunkData[4]);
F = pinParameter(chunkData[5]);
G = pinParameter(chunkData[6]);
H = pinParameter(chunkData[7]);
I = pinParameter(chunkData[8]);
J = pinParameter(chunkData[9]);
K = pinParameter(chunkData[10]);
HIG = pinParameter(chunkData[0]);
HMG = pinParameter(chunkData[1]);
LMG = pinParameter(chunkData[2]);
BSG = pinParameter(chunkData[3]);
HIF = pinParameter(chunkData[4]);
HMF = pinParameter(chunkData[5]);
LMF = pinParameter(chunkData[6]);
BSF = pinParameter(chunkData[7]);
THR = pinParameter(chunkData[8]);
PAN = pinParameter(chunkData[9]);
FAD = pinParameter(chunkData[10]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -136,85 +136,85 @@ VstInt32 ConsoleX2Buss::setChunk (void* data, VstInt32 byteSize, bool isPreset)
void ConsoleX2Buss::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
case kParamB: B = value; break;
case kParamC: C = value; break;
case kParamD: D = value; break;
case kParamE: E = value; break;
case kParamF: F = value; break;
case kParamG: G = value; break;
case kParamH: H = value; break;
case kParamI: I = value; break;
case kParamJ: J = value; break;
case kParamK: K = value; break;
case kParamHIG: HIG = value; break;
case kParamHMG: HMG = value; break;
case kParamLMG: LMG = value; break;
case kParamBSG: BSG = value; break;
case kParamHIF: HIF = value; break;
case kParamHMF: HMF = value; break;
case kParamLMF: LMF = value; break;
case kParamBSF: BSF = value; break;
case kParamTHR: THR = value; break;
case kParamPAN: PAN = value; break;
case kParamFAD: FAD = value; break;
default: throw; // unknown parameter, shouldn't happen!
}
}
float ConsoleX2Buss::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
case kParamB: return B; break;
case kParamC: return C; break;
case kParamD: return D; break;
case kParamE: return E; break;
case kParamF: return F; break;
case kParamG: return G; break;
case kParamH: return H; break;
case kParamI: return I; break;
case kParamJ: return J; break;
case kParamK: return K; break;
case kParamHIG: return HIG; break;
case kParamHMG: return HMG; break;
case kParamLMG: return LMG; break;
case kParamBSG: return BSG; break;
case kParamHIF: return HIF; break;
case kParamHMF: return HMF; break;
case kParamLMF: return LMF; break;
case kParamBSF: return BSF; break;
case kParamTHR: return THR; break;
case kParamPAN: return PAN; break;
case kParamFAD: return FAD; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void ConsoleX2Buss::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "High", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "HMid", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "LMid", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Bass", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "HighF", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "HMidF", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "LMidF", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "BassF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "Pan", kVstMaxParamStrLen); break;
case kParamK: vst_strncpy (text, "Fader", kVstMaxParamStrLen); break;
case kParamHIG: vst_strncpy (text, "High", kVstMaxParamStrLen); break;
case kParamHMG: vst_strncpy (text, "HMid", kVstMaxParamStrLen); break;
case kParamLMG: vst_strncpy (text, "LMid", kVstMaxParamStrLen); break;
case kParamBSG: vst_strncpy (text, "Bass", kVstMaxParamStrLen); break;
case kParamHIF: vst_strncpy (text, "HighF", kVstMaxParamStrLen); break;
case kParamHMF: vst_strncpy (text, "HMidF", kVstMaxParamStrLen); break;
case kParamLMF: vst_strncpy (text, "LMidF", kVstMaxParamStrLen); break;
case kParamBSF: vst_strncpy (text, "BassF", kVstMaxParamStrLen); break;
case kParamTHR: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamPAN: vst_strncpy (text, "Pan", kVstMaxParamStrLen); break;
case kParamFAD: vst_strncpy (text, "Fader", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
void ConsoleX2Buss::getParameterDisplay(VstInt32 index, char *text) {
switch (index) {
case kParamA: float2string (A, text, kVstMaxParamStrLen); break;
case kParamB: float2string (B, text, kVstMaxParamStrLen); break;
case kParamC: float2string (C, text, kVstMaxParamStrLen); break;
case kParamD: float2string (D, text, kVstMaxParamStrLen); break;
case kParamE: float2string (E, text, kVstMaxParamStrLen); break;
case kParamF: float2string (F, text, kVstMaxParamStrLen); break;
case kParamG: float2string (G, text, kVstMaxParamStrLen); break;
case kParamH: float2string (H, text, kVstMaxParamStrLen); break;
case kParamI: float2string (I, text, kVstMaxParamStrLen); break;
case kParamJ: float2string (J, text, kVstMaxParamStrLen); break;
case kParamK: float2string (K, text, kVstMaxParamStrLen); break;
case kParamHIG: float2string (HIG, text, kVstMaxParamStrLen); break;
case kParamHMG: float2string (HMG, text, kVstMaxParamStrLen); break;
case kParamLMG: float2string (LMG, text, kVstMaxParamStrLen); break;
case kParamBSG: float2string (BSG, text, kVstMaxParamStrLen); break;
case kParamHIF: float2string (HIF, text, kVstMaxParamStrLen); break;
case kParamHMF: float2string (HMF, text, kVstMaxParamStrLen); break;
case kParamLMF: float2string (LMF, text, kVstMaxParamStrLen); break;
case kParamBSF: float2string (BSF, text, kVstMaxParamStrLen); break;
case kParamTHR: float2string (THR, text, kVstMaxParamStrLen); break;
case kParamPAN: float2string (PAN, text, kVstMaxParamStrLen); break;
case kParamFAD: float2string (FAD, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
void ConsoleX2Buss::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "eq", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "freq", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "dyn", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamK: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamHIG: vst_strncpy (text, "eq", kVstMaxParamStrLen); break;
case kParamHMG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLMG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamBSG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamHIF: vst_strncpy (text, "freq", kVstMaxParamStrLen); break;
case kParamHMF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLMF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamBSF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamTHR: vst_strncpy (text, "dyn", kVstMaxParamStrLen); break;
case kParamPAN: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamFAD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -16,17 +16,17 @@
#include <math.h>
enum {
kParamA =0,
kParamB =1,
kParamC =2,
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kParamK =10,
kParamHIG =0,
kParamHMG =1,
kParamLMG =2,
kParamBSG =3,
kParamHIF =4,
kParamHMF =5,
kParamLMF =6,
kParamBSF =7,
kParamTHR =8,
kParamPAN =9,
kParamFAD =10,
kNumParameters = 11
}; //
@ -62,17 +62,17 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
float A;
float B;
float C;
float D;
float E;
float F;
float G;
float H;
float I;
float J;
float K;
float HIG;
float HMG;
float LMG;
float BSG;
float HIF;
float HMF;
float LMF;
float BSF;
float THR;
float PAN;
float FAD;
enum {
biq_freq,
@ -108,26 +108,17 @@ private:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
//Dynamics2
//Dynamics2 custom for buss
double avg32L[33];
double avg32R[33];
double avg16L[17];

File diff suppressed because it is too large Load diff

View file

@ -12,24 +12,24 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new C
ConsoleX2Channel::ConsoleX2Channel(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.25;
B = 0.0;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 0.5;
J = 0.5;
K = 1.0;
L = 0.5;
M = 0.5;
N = 0.0;
O = 1.0;
P = 0.0;
Q = 0.5;
R = 0.5;
TRM = 0.25;
MOR = 0.0;
HIG = 0.5;
HMG = 0.5;
LMG = 0.5;
BSG = 0.5;
HIF = 0.5;
HMF = 0.5;
LMF = 0.5;
BSF = 0.5;
THR = 1.0;
ATK = 0.5;
RLS = 0.5;
GAT = 0.0;
LOP = 1.0;
HIP = 0.0;
PAN = 0.5;
FAD = 0.5;
for (int x = 0; x < biq_total; x++) {
highA[x] = 0.0;
@ -50,10 +50,10 @@ ConsoleX2Channel::ConsoleX2Channel(audioMasterCallback audioMaster) :
lowRIIR = 0.0;
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPositionL[count] = 0.0;
@ -130,24 +130,24 @@ static float pinParameter(float data)
VstInt32 ConsoleX2Channel::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
chunkData[1] = B;
chunkData[2] = C;
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
chunkData[10] = K;
chunkData[11] = L;
chunkData[12] = M;
chunkData[13] = N;
chunkData[14] = O;
chunkData[15] = P;
chunkData[16] = Q;
chunkData[17] = R;
chunkData[0] = TRM;
chunkData[1] = MOR;
chunkData[2] = HIG;
chunkData[3] = HMG;
chunkData[4] = LMG;
chunkData[5] = BSG;
chunkData[6] = HIF;
chunkData[7] = HMF;
chunkData[8] = LMF;
chunkData[9] = BSF;
chunkData[10] = THR;
chunkData[11] = ATK;
chunkData[12] = RLS;
chunkData[13] = GAT;
chunkData[14] = LOP;
chunkData[15] = HIP;
chunkData[16] = PAN;
chunkData[17] = FAD;
/* 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. */
@ -159,24 +159,24 @@ VstInt32 ConsoleX2Channel::getChunk (void** data, bool isPreset)
VstInt32 ConsoleX2Channel::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
B = pinParameter(chunkData[1]);
C = pinParameter(chunkData[2]);
D = pinParameter(chunkData[3]);
E = pinParameter(chunkData[4]);
F = pinParameter(chunkData[5]);
G = pinParameter(chunkData[6]);
H = pinParameter(chunkData[7]);
I = pinParameter(chunkData[8]);
J = pinParameter(chunkData[9]);
K = pinParameter(chunkData[10]);
L = pinParameter(chunkData[11]);
M = pinParameter(chunkData[12]);
N = pinParameter(chunkData[13]);
O = pinParameter(chunkData[14]);
P = pinParameter(chunkData[15]);
Q = pinParameter(chunkData[16]);
R = pinParameter(chunkData[17]);
TRM = pinParameter(chunkData[0]);
MOR = pinParameter(chunkData[1]);
HIG = pinParameter(chunkData[2]);
HMG = pinParameter(chunkData[3]);
LMG = pinParameter(chunkData[4]);
BSG = pinParameter(chunkData[5]);
HIF = pinParameter(chunkData[6]);
HMF = pinParameter(chunkData[7]);
LMF = pinParameter(chunkData[8]);
BSF = pinParameter(chunkData[9]);
THR = pinParameter(chunkData[10]);
ATK = pinParameter(chunkData[11]);
RLS = pinParameter(chunkData[12]);
GAT = pinParameter(chunkData[13]);
LOP = pinParameter(chunkData[14]);
HIP = pinParameter(chunkData[15]);
PAN = pinParameter(chunkData[16]);
FAD = pinParameter(chunkData[17]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -186,120 +186,120 @@ VstInt32 ConsoleX2Channel::setChunk (void* data, VstInt32 byteSize, bool isPrese
void ConsoleX2Channel::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
case kParamB: B = value; break;
case kParamC: C = value; break;
case kParamD: D = value; break;
case kParamE: E = value; break;
case kParamF: F = value; break;
case kParamG: G = value; break;
case kParamH: H = value; break;
case kParamI: I = value; break;
case kParamJ: J = value; break;
case kParamK: K = value; break;
case kParamL: L = value; break;
case kParamM: M = value; break;
case kParamN: N = value; break;
case kParamO: O = value; break;
case kParamP: P = value; break;
case kParamQ: Q = value; break;
case kParamR: R = value; break;
case kParamTRM: TRM = value; break;
case kParamMOR: MOR = value; break;
case kParamHIG: HIG = value; break;
case kParamHMG: HMG = value; break;
case kParamLMG: LMG = value; break;
case kParamBSG: BSG = value; break;
case kParamHIF: HIF = value; break;
case kParamHMF: HMF = value; break;
case kParamLMF: LMF = value; break;
case kParamBSF: BSF = value; break;
case kParamTHR: THR = value; break;
case kParamATK: ATK = value; break;
case kParamRLS: RLS = value; break;
case kParamGAT: GAT = value; break;
case kParamLOP: LOP = value; break;
case kParamHIP: HIP = value; break;
case kParamPAN: PAN = value; break;
case kParamFAD: FAD = value; break;
default: throw; // unknown parameter, shouldn't happen!
}
}
float ConsoleX2Channel::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
case kParamB: return B; break;
case kParamC: return C; break;
case kParamD: return D; break;
case kParamE: return E; break;
case kParamF: return F; break;
case kParamG: return G; break;
case kParamH: return H; break;
case kParamI: return I; break;
case kParamJ: return J; break;
case kParamK: return K; break;
case kParamL: return L; break;
case kParamM: return M; break;
case kParamN: return N; break;
case kParamO: return O; break;
case kParamP: return P; break;
case kParamQ: return Q; break;
case kParamR: return R; break;
case kParamTRM: return TRM; break;
case kParamMOR: return MOR; break;
case kParamHIG: return HIG; break;
case kParamHMG: return HMG; break;
case kParamLMG: return LMG; break;
case kParamBSG: return BSG; break;
case kParamHIF: return HIF; break;
case kParamHMF: return HMF; break;
case kParamLMF: return LMF; break;
case kParamBSF: return BSF; break;
case kParamTHR: return THR; break;
case kParamATK: return ATK; break;
case kParamRLS: return RLS; break;
case kParamGAT: return GAT; break;
case kParamLOP: return LOP; break;
case kParamHIP: return HIP; break;
case kParamPAN: return PAN; break;
case kParamFAD: return FAD; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void ConsoleX2Channel::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Trim", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "More", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "High", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "HMid", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "LMid", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "Bass", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "HighF", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "HMidF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "LMidF", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "BassF", kVstMaxParamStrLen); break;
case kParamK: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamL: vst_strncpy (text, "Attack", kVstMaxParamStrLen); break;
case kParamM: vst_strncpy (text, "Release", kVstMaxParamStrLen); break;
case kParamN: vst_strncpy (text, "Gate", kVstMaxParamStrLen); break;
case kParamO: vst_strncpy (text, "Lowpass", kVstMaxParamStrLen); break;
case kParamP: vst_strncpy (text, "Hipass", kVstMaxParamStrLen); break;
case kParamQ: vst_strncpy (text, "Pan", kVstMaxParamStrLen); break;
case kParamR: vst_strncpy (text, "Fader", kVstMaxParamStrLen); break;
case kParamTRM: vst_strncpy (text, "Trim", kVstMaxParamStrLen); break;
case kParamMOR: vst_strncpy (text, "More", kVstMaxParamStrLen); break;
case kParamHIG: vst_strncpy (text, "High", kVstMaxParamStrLen); break;
case kParamHMG: vst_strncpy (text, "HMid", kVstMaxParamStrLen); break;
case kParamLMG: vst_strncpy (text, "LMid", kVstMaxParamStrLen); break;
case kParamBSG: vst_strncpy (text, "Bass", kVstMaxParamStrLen); break;
case kParamHIF: vst_strncpy (text, "HighF", kVstMaxParamStrLen); break;
case kParamHMF: vst_strncpy (text, "HMidF", kVstMaxParamStrLen); break;
case kParamLMF: vst_strncpy (text, "LMidF", kVstMaxParamStrLen); break;
case kParamBSF: vst_strncpy (text, "BassF", kVstMaxParamStrLen); break;
case kParamTHR: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamATK: vst_strncpy (text, "Attack", kVstMaxParamStrLen); break;
case kParamRLS: vst_strncpy (text, "Release", kVstMaxParamStrLen); break;
case kParamGAT: vst_strncpy (text, "Gate", kVstMaxParamStrLen); break;
case kParamLOP: vst_strncpy (text, "Lowpass", kVstMaxParamStrLen); break;
case kParamHIP: vst_strncpy (text, "Hipass", kVstMaxParamStrLen); break;
case kParamPAN: vst_strncpy (text, "Pan", kVstMaxParamStrLen); break;
case kParamFAD: vst_strncpy (text, "Fader", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
void ConsoleX2Channel::getParameterDisplay(VstInt32 index, char *text) {
switch (index) {
case kParamA: int2string ((int)(A*4.0), text, kVstMaxParamStrLen); break;
case kParamB: float2string (B, text, kVstMaxParamStrLen); break;
case kParamC: float2string (C, text, kVstMaxParamStrLen); break;
case kParamD: float2string (D, text, kVstMaxParamStrLen); break;
case kParamE: float2string (E, text, kVstMaxParamStrLen); break;
case kParamF: float2string (F, text, kVstMaxParamStrLen); break;
case kParamG: float2string (G, text, kVstMaxParamStrLen); break;
case kParamH: float2string (H, text, kVstMaxParamStrLen); break;
case kParamI: float2string (I, text, kVstMaxParamStrLen); break;
case kParamJ: float2string (J, text, kVstMaxParamStrLen); break;
case kParamK: float2string (K, text, kVstMaxParamStrLen); break;
case kParamL: float2string (L, text, kVstMaxParamStrLen); break;
case kParamM: float2string (M, text, kVstMaxParamStrLen); break;
case kParamN: float2string (N, text, kVstMaxParamStrLen); break;
case kParamO: float2string (O, text, kVstMaxParamStrLen); break;
case kParamP: float2string (P, text, kVstMaxParamStrLen); break;
case kParamQ: float2string (Q, text, kVstMaxParamStrLen); break;
case kParamR: float2string (R, text, kVstMaxParamStrLen); break;
case kParamTRM: int2string ((int)(TRM*4.0), text, kVstMaxParamStrLen); break;
case kParamMOR: float2string (MOR, text, kVstMaxParamStrLen); break;
case kParamHIG: float2string (HIG, text, kVstMaxParamStrLen); break;
case kParamHMG: float2string (HMG, text, kVstMaxParamStrLen); break;
case kParamLMG: float2string (LMG, text, kVstMaxParamStrLen); break;
case kParamBSG: float2string (BSG, text, kVstMaxParamStrLen); break;
case kParamHIF: float2string (HIF, text, kVstMaxParamStrLen); break;
case kParamHMF: float2string (HMF, text, kVstMaxParamStrLen); break;
case kParamLMF: float2string (LMF, text, kVstMaxParamStrLen); break;
case kParamBSF: float2string (BSF, text, kVstMaxParamStrLen); break;
case kParamTHR: float2string (THR, text, kVstMaxParamStrLen); break;
case kParamATK: float2string (ATK, text, kVstMaxParamStrLen); break;
case kParamRLS: float2string (RLS, text, kVstMaxParamStrLen); break;
case kParamGAT: float2string (GAT, text, kVstMaxParamStrLen); break;
case kParamLOP: float2string (LOP, text, kVstMaxParamStrLen); break;
case kParamHIP: float2string (HIP, text, kVstMaxParamStrLen); break;
case kParamPAN: float2string (PAN, text, kVstMaxParamStrLen); break;
case kParamFAD: float2string (FAD, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
void ConsoleX2Channel::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "eq", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "freq", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamK: vst_strncpy (text, "dyn", kVstMaxParamStrLen); break;
case kParamL: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamM: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamN: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamO: vst_strncpy (text, "fltr", kVstMaxParamStrLen); break;
case kParamP: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamQ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamR: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamTRM: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamMOR: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamHIG: vst_strncpy (text, "eq", kVstMaxParamStrLen); break;
case kParamHMG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLMG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamBSG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamHIF: vst_strncpy (text, "freq", kVstMaxParamStrLen); break;
case kParamHMF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLMF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamBSF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamTHR: vst_strncpy (text, "dyn", kVstMaxParamStrLen); break;
case kParamATK: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamRLS: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamGAT: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLOP: vst_strncpy (text, "fltr", kVstMaxParamStrLen); break;
case kParamHIP: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamPAN: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamFAD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -16,24 +16,24 @@
#include <math.h>
enum {
kParamA =0,
kParamB =1,
kParamC =2,
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kParamK =10,
kParamL =11,
kParamM =12,
kParamN =13,
kParamO =14,
kParamP =15,
kParamQ =16,
kParamR =17,
kParamTRM =0,
kParamMOR =1,
kParamHIG =2,
kParamHMG =3,
kParamLMG =4,
kParamBSG =5,
kParamHIF =6,
kParamHMF =7,
kParamLMF =8,
kParamBSF =9,
kParamTHR =10,
kParamATK =11,
kParamRLS =12,
kParamGAT =13,
kParamLOP =14,
kParamHIP =15,
kParamPAN =16,
kParamFAD =17,
kNumParameters = 18
}; //
const int dscBuf = 256;
@ -70,24 +70,24 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
float A;
float B;
float C;
float D;
float E;
float F;
float G;
float H;
float I;
float J;
float K;
float L;
float M;
float N;
float O;
float P;
float Q;
float R;
float TRM;
float MOR;
float HIG;
float HMG;
float LMG;
float BSG;
float HIF;
float HMF;
float LMF;
float BSF;
float THR;
float ATK;
float RLS;
float GAT;
float LOP;
float HIP;
float PAN;
float FAD;
enum {
biq_freq,
@ -123,26 +123,18 @@ private:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

File diff suppressed because it is too large Load diff

View file

@ -12,23 +12,23 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new C
ConsoleX2Pre::ConsoleX2Pre(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.25;
B = 0.0;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 0.5;
J = 0.5;
K = 1.0;
L = 0.5;
M = 0.5;
N = 0.0;
O = 1.0;
P = 0.0;
Q = 0.5;
TRM = 0.25;
MOR = 0.0;
HIG = 0.5;
HMG = 0.5;
LMG = 0.5;
BSG = 0.5;
HIF = 0.5;
HMF = 0.5;
LMF = 0.5;
BSF = 0.5;
THR = 1.0;
ATK = 0.5;
RLS = 0.5;
GAT = 0.0;
LOP = 1.0;
HIP = 0.0;
FAD = 0.5;
for (int x = 0; x < biq_total; x++) {
highA[x] = 0.0;
@ -49,10 +49,11 @@ ConsoleX2Pre::ConsoleX2Pre(audioMasterCallback audioMaster) :
lowRIIR = 0.0;
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0;
bezMaxL = 0.0; bezMinL = 0.0; bezGateL = 2.0;
bezMaxR = 0.0; bezMinR = 0.0; bezGateR = 2.0; //Dual mono version
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPositionL[count] = 0.0;
@ -128,23 +129,23 @@ static float pinParameter(float data)
VstInt32 ConsoleX2Pre::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
chunkData[1] = B;
chunkData[2] = C;
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
chunkData[10] = K;
chunkData[11] = L;
chunkData[12] = M;
chunkData[13] = N;
chunkData[14] = O;
chunkData[15] = P;
chunkData[16] = Q;
chunkData[0] = TRM;
chunkData[1] = MOR;
chunkData[2] = HIG;
chunkData[3] = HMG;
chunkData[4] = LMG;
chunkData[5] = BSG;
chunkData[6] = HIF;
chunkData[7] = HMF;
chunkData[8] = LMF;
chunkData[9] = BSF;
chunkData[10] = THR;
chunkData[11] = ATK;
chunkData[12] = RLS;
chunkData[13] = GAT;
chunkData[14] = LOP;
chunkData[15] = HIP;
chunkData[16] = FAD;
/* 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. */
@ -156,23 +157,23 @@ VstInt32 ConsoleX2Pre::getChunk (void** data, bool isPreset)
VstInt32 ConsoleX2Pre::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
B = pinParameter(chunkData[1]);
C = pinParameter(chunkData[2]);
D = pinParameter(chunkData[3]);
E = pinParameter(chunkData[4]);
F = pinParameter(chunkData[5]);
G = pinParameter(chunkData[6]);
H = pinParameter(chunkData[7]);
I = pinParameter(chunkData[8]);
J = pinParameter(chunkData[9]);
K = pinParameter(chunkData[10]);
L = pinParameter(chunkData[11]);
M = pinParameter(chunkData[12]);
N = pinParameter(chunkData[13]);
O = pinParameter(chunkData[14]);
P = pinParameter(chunkData[15]);
Q = pinParameter(chunkData[16]);
TRM = pinParameter(chunkData[0]);
MOR = pinParameter(chunkData[1]);
HIG = pinParameter(chunkData[2]);
HMG = pinParameter(chunkData[3]);
LMG = pinParameter(chunkData[4]);
BSG = pinParameter(chunkData[5]);
HIF = pinParameter(chunkData[6]);
HMF = pinParameter(chunkData[7]);
LMF = pinParameter(chunkData[8]);
BSF = pinParameter(chunkData[9]);
THR = pinParameter(chunkData[10]);
ATK = pinParameter(chunkData[11]);
RLS = pinParameter(chunkData[12]);
GAT = pinParameter(chunkData[13]);
LOP = pinParameter(chunkData[14]);
HIP = pinParameter(chunkData[15]);
FAD = pinParameter(chunkData[16]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -182,115 +183,115 @@ VstInt32 ConsoleX2Pre::setChunk (void* data, VstInt32 byteSize, bool isPreset)
void ConsoleX2Pre::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
case kParamB: B = value; break;
case kParamC: C = value; break;
case kParamD: D = value; break;
case kParamE: E = value; break;
case kParamF: F = value; break;
case kParamG: G = value; break;
case kParamH: H = value; break;
case kParamI: I = value; break;
case kParamJ: J = value; break;
case kParamK: K = value; break;
case kParamL: L = value; break;
case kParamM: M = value; break;
case kParamN: N = value; break;
case kParamO: O = value; break;
case kParamP: P = value; break;
case kParamQ: Q = value; break;
case kParamTRM: TRM = value; break;
case kParamMOR: MOR = value; break;
case kParamHIG: HIG = value; break;
case kParamHMG: HMG = value; break;
case kParamLMG: LMG = value; break;
case kParamBSG: BSG = value; break;
case kParamHIF: HIF = value; break;
case kParamHMF: HMF = value; break;
case kParamLMF: LMF = value; break;
case kParamBSF: BSF = value; break;
case kParamTHR: THR = value; break;
case kParamATK: ATK = value; break;
case kParamRLS: RLS = value; break;
case kParamGAT: GAT = value; break;
case kParamLOP: LOP = value; break;
case kParamHIP: HIP = value; break;
case kParamFAD: FAD = value; break;
default: throw; // unknown parameter, shouldn't happen!
}
}
float ConsoleX2Pre::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
case kParamB: return B; break;
case kParamC: return C; break;
case kParamD: return D; break;
case kParamE: return E; break;
case kParamF: return F; break;
case kParamG: return G; break;
case kParamH: return H; break;
case kParamI: return I; break;
case kParamJ: return J; break;
case kParamK: return K; break;
case kParamL: return L; break;
case kParamM: return M; break;
case kParamN: return N; break;
case kParamO: return O; break;
case kParamP: return P; break;
case kParamQ: return Q; break;
case kParamTRM: return TRM; break;
case kParamMOR: return MOR; break;
case kParamHIG: return HIG; break;
case kParamHMG: return HMG; break;
case kParamLMG: return LMG; break;
case kParamBSG: return BSG; break;
case kParamHIF: return HIF; break;
case kParamHMF: return HMF; break;
case kParamLMF: return LMF; break;
case kParamBSF: return BSF; break;
case kParamTHR: return THR; break;
case kParamATK: return ATK; break;
case kParamRLS: return RLS; break;
case kParamGAT: return GAT; break;
case kParamLOP: return LOP; break;
case kParamHIP: return HIP; break;
case kParamFAD: return FAD; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void ConsoleX2Pre::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Trim", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "More", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "High", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "HMid", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "LMid", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "Bass", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "HighF", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "HMidF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "LMidF", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "BassF", kVstMaxParamStrLen); break;
case kParamK: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamL: vst_strncpy (text, "Attack", kVstMaxParamStrLen); break;
case kParamM: vst_strncpy (text, "Release", kVstMaxParamStrLen); break;
case kParamN: vst_strncpy (text, "Gate", kVstMaxParamStrLen); break;
case kParamO: vst_strncpy (text, "Lowpass", kVstMaxParamStrLen); break;
case kParamP: vst_strncpy (text, "Hipass", kVstMaxParamStrLen); break;
case kParamQ: vst_strncpy (text, "Fader", kVstMaxParamStrLen); break;
case kParamTRM: vst_strncpy (text, "Trim", kVstMaxParamStrLen); break;
case kParamMOR: vst_strncpy (text, "More", kVstMaxParamStrLen); break;
case kParamHIG: vst_strncpy (text, "High", kVstMaxParamStrLen); break;
case kParamHMG: vst_strncpy (text, "HMid", kVstMaxParamStrLen); break;
case kParamLMG: vst_strncpy (text, "LMid", kVstMaxParamStrLen); break;
case kParamBSG: vst_strncpy (text, "Bass", kVstMaxParamStrLen); break;
case kParamHIF: vst_strncpy (text, "HighF", kVstMaxParamStrLen); break;
case kParamHMF: vst_strncpy (text, "HMidF", kVstMaxParamStrLen); break;
case kParamLMF: vst_strncpy (text, "LMidF", kVstMaxParamStrLen); break;
case kParamBSF: vst_strncpy (text, "BassF", kVstMaxParamStrLen); break;
case kParamTHR: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamATK: vst_strncpy (text, "Attack", kVstMaxParamStrLen); break;
case kParamRLS: vst_strncpy (text, "Release", kVstMaxParamStrLen); break;
case kParamGAT: vst_strncpy (text, "Gate", kVstMaxParamStrLen); break;
case kParamLOP: vst_strncpy (text, "Lowpass", kVstMaxParamStrLen); break;
case kParamHIP: vst_strncpy (text, "Hipass", kVstMaxParamStrLen); break;
case kParamFAD: vst_strncpy (text, "Fader", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
void ConsoleX2Pre::getParameterDisplay(VstInt32 index, char *text) {
switch (index) {
case kParamA: int2string ((int)(A*4.0), text, kVstMaxParamStrLen); break;
case kParamB: float2string (B, text, kVstMaxParamStrLen); break;
case kParamC: float2string (C, text, kVstMaxParamStrLen); break;
case kParamD: float2string (D, text, kVstMaxParamStrLen); break;
case kParamE: float2string (E, text, kVstMaxParamStrLen); break;
case kParamF: float2string (F, text, kVstMaxParamStrLen); break;
case kParamG: float2string (G, text, kVstMaxParamStrLen); break;
case kParamH: float2string (H, text, kVstMaxParamStrLen); break;
case kParamI: float2string (I, text, kVstMaxParamStrLen); break;
case kParamJ: float2string (J, text, kVstMaxParamStrLen); break;
case kParamK: float2string (K, text, kVstMaxParamStrLen); break;
case kParamL: float2string (L, text, kVstMaxParamStrLen); break;
case kParamM: float2string (M, text, kVstMaxParamStrLen); break;
case kParamN: float2string (N, text, kVstMaxParamStrLen); break;
case kParamO: float2string (O, text, kVstMaxParamStrLen); break;
case kParamP: float2string (P, text, kVstMaxParamStrLen); break;
case kParamQ: float2string (Q, text, kVstMaxParamStrLen); break;
case kParamTRM: int2string ((int)(TRM*4.0), text, kVstMaxParamStrLen); break;
case kParamMOR: float2string (MOR, text, kVstMaxParamStrLen); break;
case kParamHIG: float2string (HIG, text, kVstMaxParamStrLen); break;
case kParamHMG: float2string (HMG, text, kVstMaxParamStrLen); break;
case kParamLMG: float2string (LMG, text, kVstMaxParamStrLen); break;
case kParamBSG: float2string (BSG, text, kVstMaxParamStrLen); break;
case kParamHIF: float2string (HIF, text, kVstMaxParamStrLen); break;
case kParamHMF: float2string (HMF, text, kVstMaxParamStrLen); break;
case kParamLMF: float2string (LMF, text, kVstMaxParamStrLen); break;
case kParamBSF: float2string (BSF, text, kVstMaxParamStrLen); break;
case kParamTHR: float2string (THR, text, kVstMaxParamStrLen); break;
case kParamATK: float2string (ATK, text, kVstMaxParamStrLen); break;
case kParamRLS: float2string (RLS, text, kVstMaxParamStrLen); break;
case kParamGAT: float2string (GAT, text, kVstMaxParamStrLen); break;
case kParamLOP: float2string (LOP, text, kVstMaxParamStrLen); break;
case kParamHIP: float2string (HIP, text, kVstMaxParamStrLen); break;
case kParamFAD: float2string (FAD, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
void ConsoleX2Pre::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "eq", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "freq", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamK: vst_strncpy (text, "dyn", kVstMaxParamStrLen); break;
case kParamL: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamM: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamN: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamO: vst_strncpy (text, "fltr", kVstMaxParamStrLen); break;
case kParamP: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamQ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamTRM: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamMOR: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamHIG: vst_strncpy (text, "eq", kVstMaxParamStrLen); break;
case kParamHMG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLMG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamBSG: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamHIF: vst_strncpy (text, "freq", kVstMaxParamStrLen); break;
case kParamHMF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLMF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamBSF: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamTHR: vst_strncpy (text, "dyn", kVstMaxParamStrLen); break;
case kParamATK: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamRLS: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamGAT: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamLOP: vst_strncpy (text, "fltr", kVstMaxParamStrLen); break;
case kParamHIP: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamFAD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -16,23 +16,23 @@
#include <math.h>
enum {
kParamA =0,
kParamB =1,
kParamC =2,
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kParamK =10,
kParamL =11,
kParamM =12,
kParamN =13,
kParamO =14,
kParamP =15,
kParamQ =16,
kParamTRM =0,
kParamMOR =1,
kParamHIG =2,
kParamHMG =3,
kParamLMG =4,
kParamBSG =5,
kParamHIF =6,
kParamHMF =7,
kParamLMF =8,
kParamBSF =9,
kParamTHR =10,
kParamATK =11,
kParamRLS =12,
kParamGAT =13,
kParamLOP =14,
kParamHIP =15,
kParamFAD =16,
kNumParameters = 17
}; //
const int dscBuf = 256;
@ -69,23 +69,23 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
float A;
float B;
float C;
float D;
float E;
float F;
float G;
float H;
float I;
float J;
float K;
float L;
float M;
float N;
float O;
float P;
float Q;
float TRM;
float MOR;
float HIG;
float HMG;
float LMG;
float BSG;
float HIF;
float HMF;
float LMF;
float BSF;
float THR;
float ATK;
float RLS;
float GAT;
float LOP;
float HIP;
float FAD;
enum {
biq_freq,
@ -124,23 +124,22 @@ private:
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_CtrlL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_CtrlR,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezGate;
//Dynamics2
double bezComp[bez_total];
double bezMaxL;
double bezMinL;
double bezGateL;
double bezMaxR;
double bezMinR;
double bezGateR;
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,148 @@
/* ========================================
* Dynamics3 - Dynamics3.h
* Copyright (c) airwindows, Airwindows uses the MIT license
* ======================================== */
#ifndef __Dynamics3_H
#include "Dynamics3.h"
#endif
AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new Dynamics3(audioMaster);}
Dynamics3::Dynamics3(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 1.0;
B = 0.5;
C = 0.5;
D = 0.0;
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
//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.
_canDo.insert("plugAsSend"); // plug-in can be used as a send effect.
_canDo.insert("x2in2out");
setNumInputs(kNumInputs);
setNumOutputs(kNumOutputs);
setUniqueID(kUniqueId);
canProcessReplacing(); // supports output replacing
canDoubleReplacing(); // supports double precision processing
programsAreChunks(true);
vst_strncpy (_programName, "Default", kVstMaxProgNameLen); // default program name
}
Dynamics3::~Dynamics3() {}
VstInt32 Dynamics3::getVendorVersion () {return 1000;}
void Dynamics3::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
void Dynamics3::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMaxProgNameLen);}
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
static float pinParameter(float data)
{
if (data < 0.0f) return 0.0f;
if (data > 1.0f) return 1.0f;
return data;
}
VstInt32 Dynamics3::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
chunkData[1] = B;
chunkData[2] = C;
chunkData[3] = D;
/* 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. */
*data = chunkData;
return kNumParameters * sizeof(float);
}
VstInt32 Dynamics3::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
B = pinParameter(chunkData[1]);
C = pinParameter(chunkData[2]);
D = pinParameter(chunkData[3]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
code from setParameter() here. */
return 0;
}
void Dynamics3::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
case kParamB: B = value; break;
case kParamC: C = value; break;
case kParamD: D = value; break;
default: throw; // unknown parameter, shouldn't happen!
}
}
float Dynamics3::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
case kParamB: return B; break;
case kParamC: return C; break;
case kParamD: return D; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Dynamics3::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Thresh", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Attack", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Release", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Gate", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
void Dynamics3::getParameterDisplay(VstInt32 index, char *text) {
switch (index) {
case kParamA: float2string (A, text, kVstMaxParamStrLen); break;
case kParamB: float2string (B, text, kVstMaxParamStrLen); break;
case kParamC: float2string (C, text, kVstMaxParamStrLen); break;
case kParamD: float2string (D, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
void Dynamics3::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}
VstInt32 Dynamics3::canDo(char *text)
{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
bool Dynamics3::getEffectName(char* name) {
vst_strncpy(name, "Dynamics3", kVstMaxProductStrLen); return true;
}
VstPlugCategory Dynamics3::getPlugCategory() {return kPlugCategEffect;}
bool Dynamics3::getProductString(char* text) {
vst_strncpy (text, "airwindows Dynamics3", kVstMaxProductStrLen); return true;
}
bool Dynamics3::getVendorString(char* text) {
vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
}

View file

@ -0,0 +1,81 @@
/* ========================================
* Dynamics3 - Dynamics3.h
* Created 8/12/11 by SPIAdmin
* Copyright (c) Airwindows, Airwindows uses the MIT license
* ======================================== */
#ifndef __Dynamics3_H
#define __Dynamics3_H
#ifndef __audioeffect__
#include "audioeffectx.h"
#endif
#include <set>
#include <string>
#include <math.h>
enum {
kParamA =0,
kParamB =1,
kParamC =2,
kParamD =3,
kNumParameters = 4
}; //
const int kNumPrograms = 0;
const int kNumInputs = 2;
const int kNumOutputs = 2;
const unsigned long kUniqueId = 'dyn3'; //Change this to what the AU identity is!
class Dynamics3 :
public AudioEffectX
{
public:
Dynamics3(audioMasterCallback audioMaster);
~Dynamics3();
virtual bool getEffectName(char* name); // The plug-in name
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual bool getVendorString(char* text); // Vendor info
virtual VstInt32 getVendorVersion(); // Version number
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 getChunk (void** data, bool isPreset);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
virtual VstInt32 canDo(char *text);
private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
float A;
float B;
float C;
float D;
enum {
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
uint32_t fpdL;
uint32_t fpdR;
//default stuff
};
#endif

View file

@ -0,0 +1,160 @@
/* ========================================
* Dynamics3 - Dynamics3.h
* Copyright (c) airwindows, Airwindows uses the MIT license
* ======================================== */
#ifndef __Dynamics3_H
#include "Dynamics3.h"
#endif
void Dynamics3::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
float* in1 = inputs[0];
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double bezThresh = pow(1.0-A, 4.0) * 8.0;
double bezRez = pow(1.0-B, 4.0) / overallscale;
double sloRez = pow(1.0-C, 4.0) / overallscale;
double gate = pow(D,4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
sloRez = fmin(fmax(sloRez,0.0001),1.0);
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
inputSampleR *= (bezThresh+1.0);
}
double ctrl = fmax(fabs(inputSampleL),fabs(inputSampleR));
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
inputSampleR *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither
*out1 = inputSampleL;
*out2 = inputSampleR;
in1++;
in2++;
out1++;
out2++;
}
}
void Dynamics3::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
{
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double bezThresh = pow(1.0-A, 4.0) * 8.0;
double bezRez = pow(1.0-B, 4.0) / overallscale;
double sloRez = pow(1.0-C, 4.0) / overallscale;
double gate = pow(D,4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
sloRez = fmin(fmax(sloRez,0.0001),1.0);
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
inputSampleR *= (bezThresh+1.0);
}
double ctrl = fmax(fabs(inputSampleL),fabs(inputSampleR));
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
inputSampleR *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//begin 64 bit stereo floating point dither
//int expon; frexp((double)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
//frexp((double)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
//end 64 bit stereo floating point dither
*out1 = inputSampleL;
*out2 = inputSampleR;
in1++;
in2++;
out1++;
out2++;
}
}

View file

@ -77,7 +77,16 @@ void PunchyDeluxe::processReplacing(float **inputs, float **outputs, VstInt32 sa
}
inputSampleL += band;
inputSampleL *= drive;
inputSampleL = sin(fmin(fmax(inputSampleL,-M_PI),M_PI));
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double temp = inputSampleL * X;
inputSampleL -= (temp*0.125); temp *= X;
inputSampleL += (temp*0.0078125); temp *= X;
inputSampleL -= (temp*0.000244140625); temp *= X;
inputSampleL += (temp*0.000003814697265625); temp *= X;
inputSampleL -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
fr = (0.92/overallscale)+(overallscale*0.01);
band = inputSampleR; inputSampleR = 0.0;
@ -90,7 +99,16 @@ void PunchyDeluxe::processReplacing(float **inputs, float **outputs, VstInt32 sa
}
inputSampleR += band;
inputSampleR *= drive;
inputSampleR = sin(fmin(fmax(inputSampleR,-M_PI),M_PI));
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
temp = inputSampleR * X;
inputSampleR -= (temp*0.125); temp *= X;
inputSampleR += (temp*0.0078125); temp *= X;
inputSampleR -= (temp*0.000244140625); temp *= X;
inputSampleR += (temp*0.000003814697265625); temp *= X;
inputSampleR -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (pad < 1.0) {
@ -190,7 +208,16 @@ void PunchyDeluxe::processDoubleReplacing(double **inputs, double **outputs, Vst
}
inputSampleL += band;
inputSampleL *= drive;
inputSampleL = sin(fmin(fmax(inputSampleL,-M_PI),M_PI));
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double temp = inputSampleL * X;
inputSampleL -= (temp*0.125); temp *= X;
inputSampleL += (temp*0.0078125); temp *= X;
inputSampleL -= (temp*0.000244140625); temp *= X;
inputSampleL += (temp*0.000003814697265625); temp *= X;
inputSampleL -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
fr = (0.92/overallscale)+(overallscale*0.01);
band = inputSampleR; inputSampleR = 0.0;
@ -203,7 +230,16 @@ void PunchyDeluxe::processDoubleReplacing(double **inputs, double **outputs, Vst
}
inputSampleR += band;
inputSampleR *= drive;
inputSampleR = sin(fmin(fmax(inputSampleR,-M_PI),M_PI));
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
temp = inputSampleR * X;
inputSampleR -= (temp*0.125); temp *= X;
inputSampleR += (temp*0.0078125); temp *= X;
inputSampleR -= (temp*0.000244140625); temp *= X;
inputSampleR += (temp*0.000003814697265625); temp *= X;
inputSampleR -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (pad < 1.0) {

View file

@ -90,7 +90,16 @@ void PunchyGuitar::processReplacing(float **inputs, float **outputs, VstInt32 sa
}
inputSampleL += (band*angG[9]);
inputSampleL *= drive;
inputSampleL = sin(fmin(fmax(inputSampleL,-M_PI),M_PI));
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double temp = inputSampleL * X;
inputSampleL -= (temp*0.125); temp *= X;
inputSampleL += (temp*0.0078125); temp *= X;
inputSampleL -= (temp*0.000244140625); temp *= X;
inputSampleL += (temp*0.000003814697265625); temp *= X;
inputSampleL -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (gaterollerL < 1.0)
@ -161,7 +170,16 @@ void PunchyGuitar::processReplacing(float **inputs, float **outputs, VstInt32 sa
}
inputSampleR += (band*angG[9]);
inputSampleR *= drive;
inputSampleR = sin(fmin(fmax(inputSampleR,-M_PI),M_PI));
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
long double X = inputSampleR * inputSampleR;
long double temp = inputSampleR * X;
inputSampleR -= (temp*0.125); temp *= X;
inputSampleR += (temp*0.0078125); temp *= X;
inputSampleR -= (temp*0.000244140625); temp *= X;
inputSampleR += (temp*0.000003814697265625); temp *= X;
inputSampleR -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (gaterollerR < 1.0)
@ -291,7 +309,16 @@ void PunchyGuitar::processDoubleReplacing(double **inputs, double **outputs, Vst
}
inputSampleL += (band*angG[9]);
inputSampleL *= drive;
inputSampleL = sin(fmin(fmax(inputSampleL,-M_PI),M_PI));
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double temp = inputSampleL * X;
inputSampleL -= (temp*0.125); temp *= X;
inputSampleL += (temp*0.0078125); temp *= X;
inputSampleL -= (temp*0.000244140625); temp *= X;
inputSampleL += (temp*0.000003814697265625); temp *= X;
inputSampleL -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (gaterollerL < 1.0)
@ -362,7 +389,16 @@ void PunchyGuitar::processDoubleReplacing(double **inputs, double **outputs, Vst
}
inputSampleR += (band*angG[9]);
inputSampleR *= drive;
inputSampleR = sin(fmin(fmax(inputSampleR,-M_PI),M_PI));
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
long double X = inputSampleR * inputSampleR;
long double temp = inputSampleR * X;
inputSampleR -= (temp*0.125); temp *= X;
inputSampleR += (temp*0.0078125); temp *= X;
inputSampleR -= (temp*0.000244140625); temp *= X;
inputSampleR += (temp*0.000003814697265625); temp *= X;
inputSampleR -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (gaterollerR < 1.0)

View file

@ -250,7 +250,7 @@ ComponentResult ConsoleHBuss::Reset(AudioUnitScope inScope, AudioUnitElement in
//SmoothEQ3
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompF[bez_cycle] = 1.0;
bezCompS[bez_cycle] = 1.0;
//Dynamics2
@ -303,35 +303,45 @@ OSStatus ConsoleHBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioAction
double bassGain = (GetParameter( kParam_LOW )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
double omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
@ -522,101 +532,79 @@ OSStatus ConsoleHBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioAction
} else lowpass[hilp_cR1] = lowpass[hilp_cR2] = lowpass[hilp_cL1] = lowpass[hilp_cL2] = 0.0;
//another stage of Highpass/Lowpass before bringing in the parametric bands
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
}
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//Dynamics2
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * bezRez);
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_C] = bezCompF[bez_B];
bezCompF[bez_B] = bezCompF[bez_A];
bezCompF[bez_A] = bezCompF[bez_Ctrl];
bezCompF[bez_Ctrl] = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * sloRez);
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_C] = bezCompS[bez_B];
bezCompS[bez_B] = bezCompS[bez_A];
bezCompS[bez_A] = bezCompS[bez_Ctrl];
bezCompS[bez_Ctrl] = 0.0;
}
double CBF = (bezCompF[bez_C]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_B]*bezCompF[bez_cycle]);
double BAF = (bezCompF[bez_B]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_A]*bezCompF[bez_cycle]);
double CBAF = (bezCompF[bez_B]+(CBF*(1.0-bezCompF[bez_cycle]))+(BAF*bezCompF[bez_cycle]))*0.5;
double CBS = (bezCompS[bez_C]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_B]*bezCompS[bez_cycle]);
double BAS = (bezCompS[bez_B]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_A]*bezCompS[bez_cycle]);
double CBAS = (bezCompS[bez_B]+(CBS*(1.0-bezCompS[bez_cycle]))+(BAS*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBAS,CBAF); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBAS*-CBAMax)+(CBAF*CBAMax)+1.0)*0.5;
inputSampleL *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
inputSampleR *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
} else {bezCompF[bez_Ctrl] = 0.0; bezCompS[bez_Ctrl] = 0.0;}
//Dynamics2 custom version for buss
if (highpassEngage) { //distributed Highpass
highpass[hilp_temp] = (inputSampleL*highpass[hilp_e0])+highpass[hilp_eL1];
@ -679,47 +667,39 @@ OSStatus ConsoleHBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioAction
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleL *= 0.92;
//end TapeHack section
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double sat = inputSampleL * X;
inputSampleL -= (sat*0.125); sat *= X;
inputSampleL += (sat*0.0078125); sat *= X;
inputSampleL -= (sat*0.000244140625); sat *= X;
inputSampleL += (sat*0.000003814697265625); sat *= X;
inputSampleL -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleR *= 0.92;
//end TapeHack section
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
sat = inputSampleR * X;
inputSampleR -= (sat*0.125); sat *= X;
inputSampleR += (sat*0.0078125); sat *= X;
inputSampleR -= (sat*0.000244140625); sat *= X;
inputSampleR += (sat*0.000003814697265625); sat *= X;
inputSampleR -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//we are leaving it as a clip that will go over 0dB.
//it is a softclip so it will give you a more forgiving experience,
//but you are meant to not drive the softclip for just level.
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);

View file

@ -161,25 +161,16 @@ public:
//SmoothEQ3
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
//Dynamics2
//Dynamics2 custom for buss
enum {
hilp_freq, hilp_temp,

View file

@ -49,55 +49,61 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 784133817;
PBXWorkspaceStateSaveDate = 784133817;
PBXPerProjectTemplateStateSaveDate = 787078932;
PBXWorkspaceStateSaveDate = 787078932;
};
perUserProjectItems = {
8B7D6D372EBCF553000B38FA /* PBXTextBookmark */ = 8B7D6D372EBCF553000B38FA /* PBXTextBookmark */;
8B7D6D382EBCF553000B38FA /* PBXBookmark */ = 8B7D6D382EBCF553000B38FA /* PBXBookmark */;
8B7D6D392EBCF553000B38FA /* PBXTextBookmark */ = 8B7D6D392EBCF553000B38FA /* PBXTextBookmark */;
8B5AB4512EE9C16E00A3F512 /* PBXTextBookmark */ = 8B5AB4512EE9C16E00A3F512 /* PBXTextBookmark */;
8B5AB4802EE9C90D00A3F512 /* PBXTextBookmark */ = 8B5AB4802EE9C90D00A3F512 /* PBXTextBookmark */;
8B5AB4FB2EE9E4A600A3F512 /* PBXTextBookmark */ = 8B5AB4FB2EE9E4A600A3F512 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B7D6D372EBCF553000B38FA /* PBXTextBookmark */ = {
8B5AB4512EE9C16E00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* ConsoleHBussVersion.h */;
name = "ConsoleHBussVersion.h: 1";
rLen = 0;
rLoc = 0;
rType = 0;
vrLen = 37;
vrLen = 258;
vrLoc = 0;
};
8B7D6D382EBCF553000B38FA /* PBXBookmark */ = {
isa = PBXBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHBuss.cpp */;
};
8B7D6D392EBCF553000B38FA /* PBXTextBookmark */ = {
8B5AB4802EE9C90D00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHBuss.cpp */;
name = "ConsoleHBuss.cpp: 523";
name = "ConsoleHBuss.cpp: 330";
rLen = 0;
rLoc = 25931;
rLoc = 14515;
rType = 0;
vrLen = 64;
vrLoc = 33450;
vrLen = 246;
vrLoc = 19603;
};
8B5AB4FB2EE9E4A600A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHBuss.cpp */;
name = "ConsoleHBuss.cpp: 330";
rLen = 0;
rLoc = 14515;
rType = 0;
vrLen = 205;
vrLoc = 19603;
};
8BA05A660720730100365D66 /* ConsoleHBuss.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {858, 13752}}";
sepNavSelRange = "{25931, 0}";
sepNavVisRange = "{33450, 64}";
sepNavWindowFrame = "{{22, 52}, {912, 826}}";
sepNavIntBoundsRect = "{{0, 0}, {777, 13086}}";
sepNavSelRange = "{14515, 0}";
sepNavVisRange = "{19603, 205}";
sepNavWindowFrame = "{{8, 43}, {912, 826}}";
};
};
8BA05A690720730100365D66 /* ConsoleHBussVersion.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 1062}}";
sepNavIntBoundsRect = "{{0, 0}, {554, 1098}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{1072, 1918}";
sepNavVisRange = "{0, 258}";
sepNavWindowFrame = "{{15, 47}, {912, 826}}";
};
};
@ -110,10 +116,10 @@
};
8BC6025B073B072D006C4272 /* ConsoleHBuss.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 4068}}";
sepNavSelRange = "{6440, 589}";
sepNavVisRange = "{5857, 1011}";
sepNavWindowFrame = "{{7, 35}, {912, 826}}";
sepNavIntBoundsRect = "{{0, 0}, {1146, 3852}}";
sepNavSelRange = "{6108, 234}";
sepNavVisRange = "{5836, 1099}";
sepNavWindowFrame = "{{7, 38}, {912, 826}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -324,7 +324,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
<string>14 348 810 487 0 0 1440 878 </string>
<string>30 321 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -352,11 +352,11 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B7D6D392EBCF553000B38FA</string>
<string>8B5AB4FB2EE9E4A600A3F512</string>
<key>history</key>
<array>
<string>8B7D6D372EBCF553000B38FA</string>
<string>8B7D6D382EBCF553000B38FA</string>
<string>8B5AB4512EE9C16E00A3F512</string>
<string>8B5AB4802EE9C90D00A3F512</string>
</array>
</dict>
<key>SplitCount</key>
@ -370,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {603, 86}}</string>
<string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
<string>14 348 810 487 0 0 1440 878 </string>
<string>30 321 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>86pt</string>
<string>117pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>355pt</string>
<string>324pt</string>
<key>Tabs</key>
<array>
<dict>
@ -395,9 +395,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 328}}</string>
<string>{{10, 27}, {603, 297}}</string>
<key>RubberWindowFrame</key>
<string>14 348 810 487 0 0 1440 878 </string>
<string>30 321 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -451,7 +451,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 297}}</string>
<string>{{10, 27}, {603, 414}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -479,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B7D6D3A2EBCF553000B38FA</string>
<string>8B5AB4C82EE9DF1B00A3F512</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B7D6D3B2EBCF553000B38FA</string>
<string>8B5AB4C92EE9DF1B00A3F512</string>
<string>8BC0F9EC2EBA6E4D0094F441</string>
<string>8B7D6D3C2EBCF553000B38FA</string>
<string>8B5AB4CA2EE9DF1B00A3F512</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -636,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>784135507.44360995</real>
<real>787080358.34075296</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -653,11 +653,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8B7D6D3D2EBCF553000B38FA</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleHBuss/ConsoleHBuss.xcodeproj</string>
<string>/Users/christopherjohnson/Desktop/ConsoleHBuss/ConsoleHBuss.xcodeproj</string>
</array>
<key>WindowString</key>
<string>14 348 810 487 0 0 1440 878 </string>
<string>30 321 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -405,10 +405,10 @@ ComponentResult ConsoleHChannel::Reset(AudioUnitScope inScope, AudioUnitElement
}
//HipCrush with four bands
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPositionL[count] = 0.0;
@ -477,6 +477,7 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double moreTapeHack = (GetParameter( kParam_MOR )*2.0)+1.0;
bool tapehackOff = (GetParameter( kParam_MOR ) == 0.0);
switch ((int)GetParameter( kParam_TRM )){
case 0: moreTapeHack *= 0.5; break;
case 1: break;
@ -494,110 +495,123 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
double bassGain = (GetParameter( kParam_LOW )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
double omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
double crossFade = GetParameter( kParam_CRS );
bool hipcrushOff = (crossFade == 0.0);
if (!hipcrushOff) {
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
}
//HipCrush with four bands
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 8.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ),12.0) / overallscale;
sloRez = fmin(fmax(sloRez-(bezRez*0.5),0.00001),1.0);
double bezThresh = pow(1.0-GetParameter( kParam_THR ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_GAT ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
double gate = pow(pow(GetParameter( kParam_GAT ),4.0),sqrt(bezCThresh+1.0));
//Dynamics2
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_LOP ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_HIP ),overallscale+2.0); //the highpass
@ -613,393 +627,359 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double darkSampleL = inputSampleL;
double darkSampleR = inputSampleR;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL; avg32R[avgPos] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x]; darkSampleR += avg32R[x];}
darkSampleL /= 32.0; darkSampleR /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL; avg16R[avgPos%16] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x]; darkSampleR += avg16R[x];}
darkSampleL /= 16.0; darkSampleR /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL; avg8R[avgPos%8] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x]; darkSampleR += avg8R[x];}
darkSampleL /= 8.0; darkSampleR /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL; avg4R[avgPos%4] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x]; darkSampleR += avg4R[x];}
darkSampleL /= 4.0; darkSampleR /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL; avg2R[avgPos%2] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x]; darkSampleR += avg2R[x];}
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//begin Discontinuity section
inputSampleR *= moreTapeHack;
inputSampleR *= moreDiscontinuity;
dBaR[dBaXR] = inputSampleR; dBaPosR *= 0.5; dBaPosR += fabs((inputSampleR*((inputSampleR*0.25)-0.5))*0.5);
dBaPosR = fmin(dBaPosR,1.0);
dBdly = floor(dBaPosR*dscBuf);
dBi = (dBaPosR*dscBuf)-dBdly;
inputSampleR = dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleR += dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*dBi;
dBaXR++; if (dBaXR < 0 || dBaXR >= dscBuf) dBaXR = 0;
inputSampleR /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
//trim control gets to work even when MORE is off
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
double smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!tapehackOff) {
double darkSampleL = inputSampleL;
double darkSampleR = inputSampleR;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL; avg32R[avgPos] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x]; darkSampleR += avg32R[x];}
darkSampleL /= 32.0; darkSampleR /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL; avg16R[avgPos%16] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x]; darkSampleR += avg16R[x];}
darkSampleL /= 16.0; darkSampleR /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL; avg8R[avgPos%8] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x]; darkSampleR += avg8R[x];}
darkSampleL /= 8.0; darkSampleR /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL; avg4R[avgPos%4] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x]; darkSampleR += avg4R[x];}
darkSampleL /= 4.0; darkSampleR /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL; avg2R[avgPos%2] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x]; darkSampleR += avg2R[x];}
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin Discontinuity section
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//begin Discontinuity section
inputSampleR *= moreDiscontinuity;
dBaR[dBaXR] = inputSampleR; dBaPosR *= 0.5; dBaPosR += fabs((inputSampleR*((inputSampleR*0.25)-0.5))*0.5);
dBaPosR = fmin(dBaPosR,1.0);
dBdly = floor(dBaPosR*dscBuf);
dBi = (dBaPosR*dscBuf)-dBdly;
inputSampleR = dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleR += dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*dBi;
dBaXR++; if (dBaXR < 0 || dBaXR >= dscBuf) dBaXR = 0;
inputSampleR /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
}
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
double smoothEQR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double smoothEQL = inputSampleL;
double smoothEQR = inputSampleR;
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
smoothEQR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
double parametricL = 0.0;
double parametricR = 0.0;
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
if (!hipcrushOff) {
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow R
high[biqs_outR] = inputSampleR * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outR] * high[biqs_a0]) + high[biqs_aR1];
high[biqs_aR1] = high[biqs_aR2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aR2] = (high[biqs_outR] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outR] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outR] *= bitFactor;
high[biqs_outR] = floor(high[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outR] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outR] * high[biqs_c0]) + high[biqs_cR1];
high[biqs_cR1] = high[biqs_cR2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cR2] = (high[biqs_outR] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outR] = high[biqs_temp];
high[biqs_outR] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
hmid[biqs_outR] = inputSampleR * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_a0]) + hmid[biqs_aR1];
hmid[biqs_aR1] = hmid[biqs_aR2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aR2] = (hmid[biqs_outR] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outR] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outR] *= bitFactor;
hmid[biqs_outR] = floor(hmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outR] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_c0]) + hmid[biqs_cR1];
hmid[biqs_cR1] = hmid[biqs_cR2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cR2] = (hmid[biqs_outR] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outR] = hmid[biqs_temp];
hmid[biqs_outR] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
lmid[biqs_outR] = inputSampleR * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_a0]) + lmid[biqs_aR1];
lmid[biqs_aR1] = lmid[biqs_aR2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aR2] = (lmid[biqs_outR] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outR] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outR] *= bitFactor;
lmid[biqs_outR] = floor(lmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outR] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_c0]) + lmid[biqs_cR1];
lmid[biqs_cR1] = lmid[biqs_cR2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cR2] = (lmid[biqs_outR] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outR] = lmid[biqs_temp];
lmid[biqs_outR] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
bass[biqs_outR] = inputSampleR * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_a0]) + bass[biqs_aR1];
bass[biqs_aR1] = bass[biqs_aR2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aR2] = (bass[biqs_outR] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outR] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outR] *= bitFactor;
bass[biqs_outR] = floor(bass[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outR] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_c0]) + bass[biqs_cR1];
bass[biqs_cR1] = bass[biqs_cR2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cR2] = (bass[biqs_outR] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outR] = bass[biqs_temp];
bass[biqs_outR] *= bass[biqs_level];
parametricR = high[biqs_outR] + hmid[biqs_outR] + lmid[biqs_outR] + bass[biqs_outR];
//end Stacked Biquad With Reversed Neutron Flow R
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
double parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow R
high[biqs_outR] = inputSampleR * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outR] * high[biqs_a0]) + high[biqs_aR1];
high[biqs_aR1] = high[biqs_aR2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aR2] = (high[biqs_outR] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outR] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outR] *= bitFactor;
high[biqs_outR] = floor(high[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outR] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outR] * high[biqs_c0]) + high[biqs_cR1];
high[biqs_cR1] = high[biqs_cR2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cR2] = (high[biqs_outR] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outR] = high[biqs_temp];
high[biqs_outR] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
hmid[biqs_outR] = inputSampleR * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_a0]) + hmid[biqs_aR1];
hmid[biqs_aR1] = hmid[biqs_aR2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aR2] = (hmid[biqs_outR] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outR] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outR] *= bitFactor;
hmid[biqs_outR] = floor(hmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outR] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_c0]) + hmid[biqs_cR1];
hmid[biqs_cR1] = hmid[biqs_cR2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cR2] = (hmid[biqs_outR] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outR] = hmid[biqs_temp];
hmid[biqs_outR] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
lmid[biqs_outR] = inputSampleR * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_a0]) + lmid[biqs_aR1];
lmid[biqs_aR1] = lmid[biqs_aR2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aR2] = (lmid[biqs_outR] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outR] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outR] *= bitFactor;
lmid[biqs_outR] = floor(lmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outR] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_c0]) + lmid[biqs_cR1];
lmid[biqs_cR1] = lmid[biqs_cR2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cR2] = (lmid[biqs_outR] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outR] = lmid[biqs_temp];
lmid[biqs_outR] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
bass[biqs_outR] = inputSampleR * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_a0]) + bass[biqs_aR1];
bass[biqs_aR1] = bass[biqs_aR2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aR2] = (bass[biqs_outR] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outR] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outR] *= bitFactor;
bass[biqs_outR] = floor(bass[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outR] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_c0]) + bass[biqs_cR1];
bass[biqs_cR1] = bass[biqs_cR2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cR2] = (bass[biqs_outR] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outR] = bass[biqs_temp];
bass[biqs_outR] *= bass[biqs_level];
double parametricR = high[biqs_outR] + hmid[biqs_outR] + lmid[biqs_outR] + bass[biqs_outR];
//end Stacked Biquad With Reversed Neutron Flow R
//end HipCrush as four band
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
smoothEQL *= ((bezCThresh*0.5)+1.0);
smoothEQR *= ((bezCThresh*0.5)+1.0);
parametricL *= ((bezCThresh*0.5)+1.0);
parametricR *= ((bezCThresh*0.5)+1.0);
} //makeup gain
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate+(sloRez*bezGate)) bezGate = ((bezGate*overallscale*3.0)+3.0)*(0.25/overallscale);
else bezGate = fmax(0.0, bezGate-(sloRez*sloRez));
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
inputSampleR *= (bezThresh+1.0);
smoothEQL *= (bezThresh+1.0);
smoothEQR *= (bezThresh+1.0);
parametricL *= (bezThresh+1.0);
parametricR *= (bezThresh+1.0);
} //makeup gain
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
if (bezMaxF < gate) bezCompF[bez_SampL] = bezMaxF/gate; //note: SampL is a control voltage,
if (bezCompF[bez_SampL]<gate) bezCompF[bez_SampL] = 0.0; //not a bipolar audio signal
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
if (bezMaxF < gate) bezCompF[bez_SampR] = bezMaxF/gate; //note: SampR is a control voltage,
if (bezCompF[bez_SampR]<gate) bezCompF[bez_SampR] = 0.0; //not a bipolar audio signal
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
double ctrl = fmax(fabs(inputSampleL),fabs(inputSampleR));
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
if (bezCompS[bez_SampL]<gate) bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
if (bezCompS[bez_SampR]<gate) bezCompS[bez_SampR] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
//switch over to the EQed or HipCrushed sound and compress
inputSampleL = (smoothEQL * (1.0-crossFade)) + (parametricL * crossFade);
//apply filtration to what was just the unfiltered sound
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
//apply compression worked out using unfiltered sound
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
//switch over to the EQed or HipCrushed sound and compress
inputSampleR = (smoothEQR * (1.0-crossFade)) + (parametricR * crossFade);
//apply filtration to what was just the unfiltered sound
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//apply compression worked out using unfiltered sound
if (bezGate < 1.0 && gate > 0.0) {inputSampleL *= bezGate; inputSampleR *= bezGate;}
//and gate the lot, if necessary
//Dynamics2
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
inputSampleR *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//Dynamics3, but with crossfade over EQ or HipCrush
const double temp = (double)nSampleFrames/inFramesToProcess;
const double hFreq = (hFreqA*temp)+(hFreqB*(1.0-temp));
@ -1026,7 +1006,7 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
iirHPositionR[count] = 0.0;
iirHAngleR[count] = 0.0;
}
} //blank out highpass if jut switched off
} //blank out highpass if just switched off
}
const double lFreq = (lFreqA*temp)+(lFreqB*(1.0-temp));
if (lFreq < 1.0) {

View file

@ -236,26 +236,18 @@ public:
//HipCrush with four bands
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

View file

@ -3,6 +3,8 @@
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
activeTarget = 8D01CCC60486CAD60068D4B7 /* ConsoleHChannel */;
breakpoints = (
);
codeSenseManager = 8BD3CCB9148830B20062E48C /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
@ -49,19 +51,54 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 784126220;
PBXWorkspaceStateSaveDate = 784126220;
PBXPerProjectTemplateStateSaveDate = 787147691;
PBXWorkspaceStateSaveDate = 787147691;
};
perUserProjectItems = {
8B5AB22C2EE76C7800A3F512 /* PBXTextBookmark */ = 8B5AB22C2EE76C7800A3F512 /* PBXTextBookmark */;
8B5AB5822EE9FF0600A3F512 /* PBXTextBookmark */ = 8B5AB5822EE9FF0600A3F512 /* PBXTextBookmark */;
8B60124E2EEAEBDF003E53A7 /* PBXTextBookmark */ = 8B60124E2EEAEBDF003E53A7 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B5AB22C2EE76C7800A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHChannel.cpp */;
name = "ConsoleHChannel.cpp: 653";
rLen = 0;
rLoc = 31796;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8B5AB5822EE9FF0600A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* ConsoleHChannel.h */;
name = "ConsoleHChannel.h: 153";
rLen = 25;
rLoc = 6299;
rType = 0;
vrLen = 25;
vrLoc = 48;
};
8B60124E2EEAEBDF003E53A7 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* ConsoleHChannel.h */;
name = "ConsoleHChannel.h: 153";
rLen = 25;
rLoc = 6299;
rType = 0;
vrLen = 25;
vrLoc = 48;
};
8BA05A660720730100365D66 /* ConsoleHChannel.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1308, 19872}}";
sepNavSelRange = "{29117, 23722}";
sepNavVisRange = "{52032, 1445}";
sepNavWindowFrame = "{{5, 52}, {912, 826}}";
sepNavIntBoundsRect = "{{0, 0}, {957, 19062}}";
sepNavSelRange = "{24289, 0}";
sepNavVisRange = "{28191, 1735}";
sepNavWindowFrame = "{{10, 38}, {926, 840}}";
};
};
8BA05A690720730100365D66 /* ConsoleHChannelVersion.h */ = {
@ -81,10 +118,10 @@
};
8BC6025B073B072D006C4272 /* ConsoleHChannel.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 4878}}";
sepNavIntBoundsRect = "{{0, 0}, {696, 5652}}";
sepNavSelRange = "{6299, 25}";
sepNavVisRange = "{5969, 1043}";
sepNavWindowFrame = "{{7, 52}, {912, 826}}";
sepNavVisRange = "{48, 25}";
sepNavWindowFrame = "{{7, 43}, {912, 826}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -300,7 +300,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>3</integer>
<integer>4</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
@ -324,7 +324,7 @@
<real>246</real>
</array>
<key>RubberWindowFrame</key>
<string>11 327 810 487 0 0 1440 878 </string>
<string>10 391 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -340,7 +340,7 @@
<key>PBXProjectModuleGUID</key>
<string>8BC0F9BC2EBA650A0094F441</string>
<key>PBXProjectModuleLabel</key>
<string></string>
<string>ConsoleHChannel.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -348,7 +348,16 @@
<key>PBXProjectModuleGUID</key>
<string>8BC0F9BD2EBA650A0094F441</string>
<key>PBXProjectModuleLabel</key>
<string></string>
<string>ConsoleHChannel.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B60124E2EEAEBDF003E53A7</string>
<key>history</key>
<array>
<string>8B5AB22C2EE76C7800A3F512</string>
<string>8B5AB5822EE9FF0600A3F512</string>
</array>
</dict>
<key>SplitCount</key>
<string>1</string>
@ -361,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {542, 0}}</string>
<string>{{0, 0}, {542, 69}}</string>
<key>RubberWindowFrame</key>
<string>11 327 810 487 0 0 1440 878 </string>
<string>10 391 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>0pt</string>
<string>69pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>441pt</string>
<string>372pt</string>
<key>Tabs</key>
<array>
<dict>
@ -386,9 +395,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {542, 414}}</string>
<string>{{10, 27}, {542, 345}}</string>
<key>RubberWindowFrame</key>
<string>11 327 810 487 0 0 1440 878 </string>
<string>10 391 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -442,7 +451,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {542, 414}}</string>
<string>{{10, 27}, {542, 401}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -470,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B7D6C432EBCD116000B38FA</string>
<string>8B60124F2EEAEBDF003E53A7</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B7D6C442EBCD116000B38FA</string>
<string>8B6012502EEAEBDF003E53A7</string>
<string>8BC0F9BC2EBA650A0094F441</string>
<string>8B7D6C452EBCD116000B38FA</string>
<string>8B6012512EEAEBDF003E53A7</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -511,7 +520,7 @@
<key>Identifier</key>
<string>perspective.debug</string>
<key>IsVertical</key>
<integer>1</integer>
<true/>
<key>Layout</key>
<array>
<dict>
@ -525,12 +534,12 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {810, 0}}</string>
<string>{{0, 0}, {424, 270}}</string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
<key>Proportion</key>
<string>0%</string>
<string>270pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
@ -579,8 +588,6 @@
</dict>
<key>GeometryConfiguration</key>
<dict>
<key>DebugConsoleDrawerSize</key>
<string>{100, 120}</string>
<key>DebugConsoleVisible</key>
<string>None</string>
<key>DebugConsoleWindowFrame</key>
@ -589,31 +596,53 @@
<string>{{200, 200}, {500, 300}}</string>
<key>Frame</key>
<string>{{0, 7}, {810, 438}}</string>
<key>PBXDebugSessionStackFrameViewKey</key>
<dict>
<key>DebugVariablesTableConfiguration</key>
<array>
<string>Name</string>
<real>120</real>
<string>Value</string>
<real>85</real>
<string>Summary</string>
<real>185</real>
</array>
<key>Frame</key>
<string>{{395, 0}, {415, 213}}</string>
</dict>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
<key>Proportion</key>
<string>443pt</string>
<string>438pt</string>
</dict>
</array>
<key>Name</key>
<string>Debug</string>
<key>ServiceClasses</key>
<array>
<string>XCModuleDock</string>
<string>XCModuleDock</string>
<string>PBXDebugCLIModule</string>
<string>PBXDebugSessionModule</string>
<string>XCConsole</string>
<string>PBXDebugProcessAndThreadModule</string>
<string>PBXDebugProcessViewModule</string>
<string>PBXDebugThreadViewModule</string>
<string>PBXDebugStackFrameViewModule</string>
<string>PBXNavigatorGroup</string>
</array>
<key>TableOfContents</key>
<array>
<string>1CC8E6A5069209BD00BB180A</string>
<string>1CC8E6A6069209BD00BB180A</string>
<string>8B5AB4AC2EE9CAE100A3F512</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
<string>1CC8E6A7069209BD00BB180A</string>
<string>8B5AB4AD2EE9CAE100A3F512</string>
<string>8B5AB4AE2EE9CAE100A3F512</string>
<string>8B5AB4AF2EE9CAE100A3F512</string>
<string>8B5AB4B02EE9CAE100A3F512</string>
<string>8B5AB4B12EE9CAE100A3F512</string>
</array>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>
</dict>
@ -627,7 +656,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>784128789.89908004</real>
<real>787147743.49609303</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -644,11 +673,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8B7D6C792EBCDB15000B38FA</string>
<string>8B6012522EEAEBDF003E53A7</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleHChannel/ConsoleHChannel.xcodeproj</string>
</array>
<key>WindowString</key>
<string>11 327 810 487 0 0 1440 878 </string>
<string>10 391 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -379,10 +379,10 @@ void ConsoleHPre::ConsoleHPreKernel::Reset()
}
//HipCrush with four bands
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPosition[count] = 0.0;
@ -440,6 +440,7 @@ void ConsoleHPre::ConsoleHPreKernel::Process( const Float32 *inSourceP,
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double moreTapeHack = (GetParameter( kParam_MOR )*2.0)+1.0;
bool tapehackOff = (GetParameter( kParam_MOR ) == 0.0);
switch ((int)GetParameter( kParam_TRM )){
case 0: moreTapeHack *= 0.5; break;
case 1: break;
@ -457,109 +458,123 @@ void ConsoleHPre::ConsoleHPreKernel::Process( const Float32 *inSourceP,
double bassGain = (GetParameter( kParam_LOW )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
double omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
double crossFade = GetParameter( kParam_CRS );
bool hipcrushOff = (crossFade == 0.0);
if (!hipcrushOff) {
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
}
//HipCrush with four bands
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 8.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ),12.0) / overallscale;
sloRez = fmin(fmax(sloRez-(bezRez*0.5),0.00001),1.0);
double bezThresh = pow(1.0-GetParameter( kParam_THR ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_GAT ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
double gate = pow(pow(GetParameter( kParam_GAT ),4.0),sqrt(bezCThresh+1.0));
//Dynamics2
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_LOP ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_HIP ),overallscale+2.0); //the highpass
@ -572,220 +587,219 @@ void ConsoleHPre::ConsoleHPreKernel::Process( const Float32 *inSourceP,
double inputSampleL = *sourceP;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpd * 1.18e-17;
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
//trim control gets to work even when MORE is off
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
double smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!tapehackOff) {
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
}
double smoothEQL = inputSampleL;
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
double parametricL = 0.0;
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
if (!hipcrushOff) {
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
double parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
//end HipCrush as four band
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
smoothEQL *= ((bezCThresh*0.5)+1.0);
parametricL *= ((bezCThresh*0.5)+1.0);
} //makeup gain
if (fabs(inputSampleL) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (fabs(inputSampleL) > gate+(sloRez*bezGate)) bezGate = ((bezGate*overallscale*3.0)+3.0)*(0.25/overallscale);
else bezGate = fmax(0.0, bezGate-(sloRez*sloRez));
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezMaxF = fmax(bezMaxF,fabs(inputSampleL));
if (bezCompF[bez_cycle] > 1.0) {
if (bezMaxF < gate) bezCompF[bez_SampL] = bezMaxF/gate; //note: SampL is a control voltage,
if (bezCompF[bez_SampL]<gate) bezCompF[bez_SampL] = 0.0; //not a bipolar audio signal
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezMaxF = 0.0;
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
smoothEQL *= (bezThresh+1.0);
parametricL *= (bezThresh+1.0);
} //makeup gain
double ctrl = fabs(inputSampleL);
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage.
if (bezCompS[bez_cycle] > 1.0) {
if (bezCompS[bez_SampL]<gate) bezCompS[bez_SampL] = 0.0;
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
//switch over to the EQed or HipCrushed sound and compress
inputSampleL = (smoothEQL * (1.0-crossFade)) + (parametricL * crossFade);
//apply filtration to what was just the unfiltered sound
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
//apply compression worked out using unfiltered sound
if (bezGate < 1.0 && gate > 0.0) inputSampleL *= bezGate;
//Dynamics2
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//Dynamics3, but with crossfade over EQ or HipCrush
const double temp = (double)nSampleFrames/inFramesToProcess;
const double hFreq = (hFreqA*temp)+(hFreqB*(1.0-temp));

View file

@ -245,20 +245,18 @@ public:
//HipCrush with four bands
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPosition[23];
double iirHAngle[23];

View file

@ -10,7 +10,7 @@
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
292,
258,
20,
48,
43,
@ -49,18 +49,49 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 784132118;
PBXWorkspaceStateSaveDate = 784132118;
PBXPerProjectTemplateStateSaveDate = 787147774;
PBXWorkspaceStateSaveDate = 787147774;
};
perUserProjectItems = {
8B5AB3F02EE9AD0700A3F512 /* PBXTextBookmark */ = 8B5AB3F02EE9AD0700A3F512 /* PBXTextBookmark */;
8B5AB64E2EEA336F00A3F512 /* PBXTextBookmark */ = 8B5AB64E2EEA336F00A3F512 /* PBXTextBookmark */;
8B60125F2EEAEC1F003E53A7 /* PBXTextBookmark */ = 8B60125F2EEAEC1F003E53A7 /* PBXTextBookmark */;
8B7D6CFB2EBCEAA2000B38FA /* PlistBookmark */ = 8B7D6CFB2EBCEAA2000B38FA /* PlistBookmark */;
8B7D6CFC2EBCEAA2000B38FA /* PBXBookmark */ = 8B7D6CFC2EBCEAA2000B38FA /* PBXBookmark */;
8B7D6CFD2EBCEAA2000B38FA /* PBXTextBookmark */ = 8B7D6CFD2EBCEAA2000B38FA /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B5AB3F02EE9AD0700A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHPre.cpp */;
name = "ConsoleHPre.cpp: 776";
rLen = 0;
rLoc = 37785;
rType = 0;
vrLen = 50;
vrLoc = 38606;
};
8B5AB64E2EEA336F00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* ConsoleHPre.h */;
name = "ConsoleHPre.h: 260";
rLen = 0;
rLoc = 9114;
rType = 0;
vrLen = 66;
vrLoc = 3;
};
8B60125F2EEAEC1F003E53A7 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* ConsoleHPre.h */;
name = "ConsoleHPre.h: 260";
rLen = 0;
rLoc = 9114;
rType = 0;
vrLen = 66;
vrLoc = 3;
};
8B7D6CFB2EBCEAA2000B38FA /* PlistBookmark */ = {
isa = PlistBookmark;
fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */;
@ -71,28 +102,14 @@
);
name = /Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleHPre/Info.plist;
rLen = 0;
rLoc = 9223372036854775807;
};
8B7D6CFC2EBCEAA2000B38FA /* PBXBookmark */ = {
isa = PBXBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHPre.cpp */;
};
8B7D6CFD2EBCEAA2000B38FA /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleHPre.cpp */;
name = "ConsoleHPre.cpp: 779";
rLen = 0;
rLoc = 37534;
rType = 0;
vrLen = 502;
vrLoc = 38930;
rLoc = 9223372036854775808;
};
8BA05A660720730100365D66 /* ConsoleHPre.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1092, 15588}}";
sepNavSelRange = "{37534, 0}";
sepNavVisRange = "{38930, 502}";
sepNavWindowFrame = "{{15, 47}, {912, 826}}";
sepNavIntBoundsRect = "{{0, 0}, {957, 15498}}";
sepNavSelRange = "{22818, 0}";
sepNavVisRange = "{21953, 2061}";
sepNavWindowFrame = "{{528, 50}, {912, 826}}";
};
};
8BA05A690720730100365D66 /* ConsoleHPreVersion.h */ = {
@ -105,10 +122,10 @@
};
8BC6025B073B072D006C4272 /* ConsoleHPre.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 6300}}";
sepNavSelRange = "{8314, 0}";
sepNavVisRange = "{9159, 663}";
sepNavWindowFrame = "{{7, 42}, {912, 826}}";
sepNavIntBoundsRect = "{{0, 0}, {741, 5598}}";
sepNavSelRange = "{9114, 0}";
sepNavVisRange = "{3, 66}";
sepNavWindowFrame = "{{9, 52}, {912, 826}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -309,7 +309,7 @@
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 0}, {288, 595}}</string>
<string>{{0, 0}, {288, 453}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@ -319,14 +319,14 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {305, 613}}</string>
<string>{{0, 0}, {305, 471}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
<real>288</real>
</array>
<key>RubberWindowFrame</key>
<string>7 195 841 654 0 0 1440 878 </string>
<string>539 212 807 512 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -342,7 +342,7 @@
<key>PBXProjectModuleGUID</key>
<string>8BD7274A1D46E5A5000176F0</string>
<key>PBXProjectModuleLabel</key>
<string>ConsoleHPre.cpp</string>
<string>ConsoleHPre.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -350,15 +350,16 @@
<key>PBXProjectModuleGUID</key>
<string>8BD7274B1D46E5A5000176F0</string>
<key>PBXProjectModuleLabel</key>
<string>ConsoleHPre.cpp</string>
<string>ConsoleHPre.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B7D6CFD2EBCEAA2000B38FA</string>
<string>8B60125F2EEAEC1F003E53A7</string>
<key>history</key>
<array>
<string>8B7D6CFB2EBCEAA2000B38FA</string>
<string>8B7D6CFC2EBCEAA2000B38FA</string>
<string>8B5AB3F02EE9AD0700A3F512</string>
<string>8B5AB64E2EEA336F00A3F512</string>
</array>
</dict>
<key>SplitCount</key>
@ -372,18 +373,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {531, 202}}</string>
<string>{{0, 0}, {497, 125}}</string>
<key>RubberWindowFrame</key>
<string>7 195 841 654 0 0 1440 878 </string>
<string>539 212 807 512 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>202pt</string>
<string>125pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>406pt</string>
<string>341pt</string>
<key>Tabs</key>
<array>
<dict>
@ -397,9 +398,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {531, 379}}</string>
<string>{{10, 27}, {497, 314}}</string>
<key>RubberWindowFrame</key>
<string>7 195 841 654 0 0 1440 878 </string>
<string>539 212 807 512 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -453,7 +454,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {531, 339}}</string>
<string>{{10, 27}, {531, 507}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -462,7 +463,7 @@
</dict>
</array>
<key>Proportion</key>
<string>531pt</string>
<string>497pt</string>
</dict>
</array>
<key>Name</key>
@ -481,11 +482,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B7D6CFE2EBCEAA2000B38FA</string>
<string>8B6012602EEAEC1F003E53A7</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B7D6CFF2EBCEAA2000B38FA</string>
<string>8B6012612EEAEC1F003E53A7</string>
<string>8BD7274A1D46E5A5000176F0</string>
<string>8B7D6D002EBCEAA2000B38FA</string>
<string>8B6012622EEAEC1F003E53A7</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -658,7 +659,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>784132770.80356503</real>
<real>787147807.16772997</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -675,10 +676,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8B6012632EEAEC1F003E53A7</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleHPre/ConsoleHPre.xcodeproj</string>
</array>
<key>WindowString</key>
<string>7 195 841 654 0 0 1440 878 </string>
<string>539 212 807 512 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -59,17 +59,17 @@ ConsoleX2Buss::ConsoleX2Buss(AudioUnit component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
SetParameter(kParam_E, kDefaultValue_ParamE );
SetParameter(kParam_F, kDefaultValue_ParamF );
SetParameter(kParam_G, kDefaultValue_ParamG );
SetParameter(kParam_H, kDefaultValue_ParamH );
SetParameter(kParam_I, kDefaultValue_ParamI );
SetParameter(kParam_J, kDefaultValue_ParamJ );
SetParameter(kParam_K, kDefaultValue_ParamK );
SetParameter(kParam_HIG, kDefaultValue_ParamHIG );
SetParameter(kParam_HMG, kDefaultValue_ParamHMG );
SetParameter(kParam_LMG, kDefaultValue_ParamLMG );
SetParameter(kParam_BSG, kDefaultValue_ParamBSG );
SetParameter(kParam_HIF, kDefaultValue_ParamHIF );
SetParameter(kParam_HMF, kDefaultValue_ParamHMF );
SetParameter(kParam_LMF, kDefaultValue_ParamLMF );
SetParameter(kParam_BSF, kDefaultValue_ParamBSF );
SetParameter(kParam_THR, kDefaultValue_ParamTHR );
SetParameter(kParam_PAN, kDefaultValue_ParamPAN );
SetParameter(kParam_FAD, kDefaultValue_ParamFAD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
@ -106,85 +106,85 @@ ComponentResult ConsoleX2Buss::GetParameterInfo(AudioUnitScope inScope,
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
case kParam_HIG:
AUBase::FillInParameterName (outParameterInfo, kParameterHIGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterAUnit;
outParameterInfo.unitName = kParameterHIGUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
outParameterInfo.defaultValue = kDefaultValue_ParamHIG;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
case kParam_HMG:
AUBase::FillInParameterName (outParameterInfo, kParameterHMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
outParameterInfo.defaultValue = kDefaultValue_ParamHMG;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
case kParam_LMG:
AUBase::FillInParameterName (outParameterInfo, kParameterLMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
outParameterInfo.defaultValue = kDefaultValue_ParamLMG;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
case kParam_BSG:
AUBase::FillInParameterName (outParameterInfo, kParameterBSGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
outParameterInfo.defaultValue = kDefaultValue_ParamBSG;
break;
case kParam_E:
AUBase::FillInParameterName (outParameterInfo, kParameterEName, false);
case kParam_HIF:
AUBase::FillInParameterName (outParameterInfo, kParameterHIFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterEUnit;
outParameterInfo.unitName = kParameterHIFUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamE;
outParameterInfo.defaultValue = kDefaultValue_ParamHIF;
break;
case kParam_F:
AUBase::FillInParameterName (outParameterInfo, kParameterFName, false);
case kParam_HMF:
AUBase::FillInParameterName (outParameterInfo, kParameterHMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
outParameterInfo.defaultValue = kDefaultValue_ParamHMF;
break;
case kParam_G:
AUBase::FillInParameterName (outParameterInfo, kParameterGName, false);
case kParam_LMF:
AUBase::FillInParameterName (outParameterInfo, kParameterLMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamG;
outParameterInfo.defaultValue = kDefaultValue_ParamLMF;
break;
case kParam_H:
AUBase::FillInParameterName (outParameterInfo, kParameterHName, false);
case kParam_BSF:
AUBase::FillInParameterName (outParameterInfo, kParameterBSFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamH;
outParameterInfo.defaultValue = kDefaultValue_ParamBSF;
break;
case kParam_I:
AUBase::FillInParameterName (outParameterInfo, kParameterIName, false);
case kParam_THR:
AUBase::FillInParameterName (outParameterInfo, kParameterTHRName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterIUnit;
outParameterInfo.unitName = kParameterTHRUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamI;
outParameterInfo.defaultValue = kDefaultValue_ParamTHR;
break;
case kParam_J:
AUBase::FillInParameterName (outParameterInfo, kParameterJName, false);
case kParam_PAN:
AUBase::FillInParameterName (outParameterInfo, kParameterPANName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamJ;
outParameterInfo.defaultValue = kDefaultValue_ParamPAN;
break;
case kParam_K:
AUBase::FillInParameterName (outParameterInfo, kParameterKName, false);
case kParam_FAD:
AUBase::FillInParameterName (outParameterInfo, kParameterFADName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamK;
outParameterInfo.defaultValue = kDefaultValue_ParamFAD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
@ -276,7 +276,7 @@ ComponentResult ConsoleX2Buss::Reset(AudioUnitScope inScope, AudioUnitElement i
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompF[bez_cycle] = 1.0;
bezCompS[bez_cycle] = 1.0;
//Dynamics2
@ -317,133 +317,141 @@ OSStatus ConsoleX2Buss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
int spacing = floor(overallscale*2.0);
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double trebleGain = (GetParameter( kParam_A )-0.5)*2.0;
double trebleGain = (GetParameter( kParam_HIG )-0.5)*2.0;
trebleGain = 1.0+(trebleGain*fabs(trebleGain)*fabs(trebleGain));
double highmidGain = (GetParameter( kParam_B )-0.5)*2.0;
double highmidGain = (GetParameter( kParam_HMG )-0.5)*2.0;
highmidGain = 1.0+(highmidGain*fabs(highmidGain)*fabs(highmidGain));
double lowmidGain = (GetParameter( kParam_C )-0.5)*2.0;
double lowmidGain = (GetParameter( kParam_LMG )-0.5)*2.0;
lowmidGain = 1.0+(lowmidGain*fabs(lowmidGain)*fabs(lowmidGain));
double bassGain = (GetParameter( kParam_D )-0.5)*2.0;
double bassGain = (GetParameter( kParam_BSG )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
double highCoef = 0.0;
double midCoef = 0.0;
double lowCoef = 0.0;
double trebleRef = GetParameter( kParam_E )-0.5;
double highmidRef = GetParameter( kParam_F )-0.5;
double lowmidRef = GetParameter( kParam_G )-0.5;
double bassRef = GetParameter( kParam_H )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
double highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
bool eqOff = (trebleGain == 1.0 && highmidGain == 1.0 && lowmidGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
double trebleRef = GetParameter( kParam_HIF )-0.5;
double highmidRef = GetParameter( kParam_HMF )-0.5;
double lowmidRef = GetParameter( kParam_LMF )-0.5;
double bassRef = GetParameter( kParam_BSF )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
}
//SmoothEQ2
double bezCThresh = pow(1.0-GetParameter( kParam_I ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_I ), 12.360679774997898) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_I ),10.0) / overallscale;
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_THR ), 12.360679774997898) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_THR ),10.0) / overallscale;
sloRez = fmin(fmax(sloRez,0.00001),1.0);
bezRez = fmin(fmax(bezRez,0.00001),1.0);
//Dynamics2
panA = panB; panB = GetParameter( kParam_J )*1.57079633;
inTrimA = inTrimB; inTrimB = GetParameter( kParam_K )*2.0;
panA = panB; panB = GetParameter( kParam_PAN )*1.57079633;
inTrimA = inTrimB; inTrimB = GetParameter( kParam_FAD )*2.0;
//Console
while (nSampleFrames-- > 0) {
@ -462,198 +470,176 @@ OSStatus ConsoleX2Buss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
if (inputSampleR < -1.0) inputSampleR = -1.0;
else if (inputSampleR < 0.0) inputSampleR = expm1((log1p(inputSampleR) * 0.6180339887498949));
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highLIIR = (highLIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highLIIR; trebleL -= highmidL;
midLIIR = (midLIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midLIIR; highmidL -= lowmidL;
lowLIIR = (lowLIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowLIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
double trebleR = inputSampleR;
outSample = (trebleR * highA[biq_a0]) + highA[biq_sR1];
highA[biq_sR1] = (trebleR * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sR2];
highA[biq_sR2] = (trebleR * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midA[biq_a0]) + midA[biq_sR1];
midA[biq_sR1] = (highmidR * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sR2];
midA[biq_sR2] = (highmidR * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowA[biq_a0]) + lowA[biq_sR1];
lowA[biq_sR1] = (lowmidR * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sR2];
lowA[biq_sR2] = (lowmidR * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//first stage of three crossovers
outSample = (trebleR * highB[biq_a0]) + highB[biq_sR1];
highB[biq_sR1] = (trebleR * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sR2];
highB[biq_sR2] = (trebleR * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midB[biq_a0]) + midB[biq_sR1];
midB[biq_sR1] = (highmidR * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sR2];
midB[biq_sR2] = (highmidR * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowB[biq_a0]) + lowB[biq_sR1];
lowB[biq_sR1] = (lowmidR * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sR2];
lowB[biq_sR2] = (lowmidR * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//second stage of three crossovers
outSample = (trebleR * highC[biq_a0]) + highC[biq_sR1];
highC[biq_sR1] = (trebleR * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sR2];
highC[biq_sR2] = (trebleR * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midC[biq_a0]) + midC[biq_sR1];
midC[biq_sR1] = (highmidR * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sR2];
midC[biq_sR2] = (highmidR * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowC[biq_a0]) + lowC[biq_sR1];
lowC[biq_sR1] = (lowmidR * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sR2];
lowC[biq_sR2] = (lowmidR * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//third stage of three crossovers
highRIIR = (highRIIR*highCoef) + (trebleR*(1.0-highCoef));
highmidR = highRIIR; trebleR -= highmidR;
midRIIR = (midRIIR*midCoef) + (highmidR*(1.0-midCoef));
lowmidR = midRIIR; highmidR -= lowmidR;
lowRIIR = (lowRIIR*lowCoef) + (lowmidR*(1.0-lowCoef));
bassR = lowRIIR; lowmidR -= bassR;
inputSampleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//fourth stage of three crossovers is the exponential filters
if (!eqOff) {
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highLIIR = (highLIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highLIIR; trebleL -= highmidL;
midLIIR = (midLIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midLIIR; highmidL -= lowmidL;
lowLIIR = (lowLIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowLIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
double trebleR = inputSampleR;
outSample = (trebleR * highA[biq_a0]) + highA[biq_sR1];
highA[biq_sR1] = (trebleR * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sR2];
highA[biq_sR2] = (trebleR * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midA[biq_a0]) + midA[biq_sR1];
midA[biq_sR1] = (highmidR * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sR2];
midA[biq_sR2] = (highmidR * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowA[biq_a0]) + lowA[biq_sR1];
lowA[biq_sR1] = (lowmidR * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sR2];
lowA[biq_sR2] = (lowmidR * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//first stage of three crossovers
outSample = (trebleR * highB[biq_a0]) + highB[biq_sR1];
highB[biq_sR1] = (trebleR * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sR2];
highB[biq_sR2] = (trebleR * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midB[biq_a0]) + midB[biq_sR1];
midB[biq_sR1] = (highmidR * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sR2];
midB[biq_sR2] = (highmidR * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowB[biq_a0]) + lowB[biq_sR1];
lowB[biq_sR1] = (lowmidR * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sR2];
lowB[biq_sR2] = (lowmidR * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//second stage of three crossovers
outSample = (trebleR * highC[biq_a0]) + highC[biq_sR1];
highC[biq_sR1] = (trebleR * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sR2];
highC[biq_sR2] = (trebleR * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midC[biq_a0]) + midC[biq_sR1];
midC[biq_sR1] = (highmidR * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sR2];
midC[biq_sR2] = (highmidR * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowC[biq_a0]) + lowC[biq_sR1];
lowC[biq_sR1] = (lowmidR * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sR2];
lowC[biq_sR2] = (lowmidR * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//third stage of three crossovers
highRIIR = (highRIIR*highCoef) + (trebleR*(1.0-highCoef));
highmidR = highRIIR; trebleR -= highmidR;
midRIIR = (midRIIR*midCoef) + (highmidR*(1.0-midCoef));
lowmidR = midRIIR; highmidR -= lowmidR;
lowRIIR = (lowRIIR*lowCoef) + (lowmidR*(1.0-lowCoef));
bassR = lowRIIR; lowmidR -= bassR;
inputSampleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//fourth stage of three crossovers is the exponential filters
}
//SmoothEQ2
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
}
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//Dynamics2
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * bezRez);
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_C] = bezCompF[bez_B];
bezCompF[bez_B] = bezCompF[bez_A];
bezCompF[bez_A] = bezCompF[bez_Ctrl];
bezCompF[bez_Ctrl] = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * sloRez);
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_C] = bezCompS[bez_B];
bezCompS[bez_B] = bezCompS[bez_A];
bezCompS[bez_A] = bezCompS[bez_Ctrl];
bezCompS[bez_Ctrl] = 0.0;
}
double CBF = (bezCompF[bez_C]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_B]*bezCompF[bez_cycle]);
double BAF = (bezCompF[bez_B]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_A]*bezCompF[bez_cycle]);
double CBAF = (bezCompF[bez_B]+(CBF*(1.0-bezCompF[bez_cycle]))+(BAF*bezCompF[bez_cycle]))*0.5;
double CBS = (bezCompS[bez_C]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_B]*bezCompS[bez_cycle]);
double BAS = (bezCompS[bez_B]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_A]*bezCompS[bez_cycle]);
double CBAS = (bezCompS[bez_B]+(CBS*(1.0-bezCompS[bez_cycle]))+(BAS*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBAS,CBAF); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBAS*-CBAMax)+(CBAF*CBAMax)+1.0)*0.5;
inputSampleL *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
inputSampleR *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
} else {bezCompF[bez_Ctrl] = 0.0; bezCompS[bez_Ctrl] = 0.0;}
//Dynamics2 custom version for buss
const double temp = (double)nSampleFrames/inFramesToProcess;
double gainR = (panA*temp)+(panB*(1.0-temp));
@ -698,48 +684,39 @@ OSStatus ConsoleX2Buss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleL *= 0.92;
//end TapeHack section
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double sat = inputSampleL * X;
inputSampleL -= (sat*0.125); sat *= X;
inputSampleL += (sat*0.0078125); sat *= X;
inputSampleL -= (sat*0.000244140625); sat *= X;
inputSampleL += (sat*0.000003814697265625); sat *= X;
inputSampleL -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleR *= 0.92;
//end TapeHack section
//Discontapeity
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
sat = inputSampleR * X;
inputSampleR -= (sat*0.125); sat *= X;
inputSampleR += (sat*0.0078125); sat *= X;
inputSampleR -= (sat*0.000244140625); sat *= X;
inputSampleR += (sat*0.000003814697265625); sat *= X;
inputSampleR -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//we are leaving it as a clip that will go over 0dB.
//it is a softclip so it will give you a more forgiving experience,
//but you are meant to not drive the softclip for just level.
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);

View file

@ -54,45 +54,49 @@
#pragma mark ____ConsoleX2Buss Parameters
// parameters
static const float kDefaultValue_ParamA = 0.5;
static const float kDefaultValue_ParamB = 0.5;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.5;
static const float kDefaultValue_ParamE = 0.5;
static const float kDefaultValue_ParamF = 0.5;
static const float kDefaultValue_ParamG = 0.5;
static const float kDefaultValue_ParamH = 0.5;
static const float kDefaultValue_ParamI = 1.0;
static const float kDefaultValue_ParamJ = 0.5;
static const float kDefaultValue_ParamK = 0.5;
static const float kDefaultValue_ParamHIG = 0.5;
static const float kDefaultValue_ParamHMG = 0.5;
static const float kDefaultValue_ParamLMG = 0.5;
static const float kDefaultValue_ParamBSG = 0.5;
static CFStringRef kParameterAUnit = CFSTR("eq");
static CFStringRef kParameterAName = CFSTR("High");
static CFStringRef kParameterBName = CFSTR("HMid");
static CFStringRef kParameterCName = CFSTR("LMid");
static CFStringRef kParameterDName = CFSTR("Bass");
static CFStringRef kParameterEUnit = CFSTR("freq");
static CFStringRef kParameterEName = CFSTR("HighF");
static CFStringRef kParameterFName = CFSTR("HMidF");
static CFStringRef kParameterGName = CFSTR("LMidF");
static CFStringRef kParameterHName = CFSTR("BassF");
static CFStringRef kParameterIUnit = CFSTR("dyn");
static CFStringRef kParameterIName = CFSTR("Thresh");
static CFStringRef kParameterJName = CFSTR("Pan");
static CFStringRef kParameterKName = CFSTR("Fader");
static const float kDefaultValue_ParamHIF = 0.5;
static const float kDefaultValue_ParamHMF = 0.5;
static const float kDefaultValue_ParamLMF = 0.5;
static const float kDefaultValue_ParamBSF = 0.5;
static const float kDefaultValue_ParamTHR = 1.0;
static const float kDefaultValue_ParamPAN = 0.5;
static const float kDefaultValue_ParamFAD = 0.5;
static CFStringRef kParameterHIGUnit = CFSTR("eq");
static CFStringRef kParameterHIGName = CFSTR("High");
static CFStringRef kParameterHMGName = CFSTR("HMid");
static CFStringRef kParameterLMGName = CFSTR("LMid");
static CFStringRef kParameterBSGName = CFSTR("Bass");
static CFStringRef kParameterHIFUnit = CFSTR("freq");
static CFStringRef kParameterHIFName = CFSTR("HighF");
static CFStringRef kParameterHMFName = CFSTR("HMidF");
static CFStringRef kParameterLMFName = CFSTR("LMidF");
static CFStringRef kParameterBSFName = CFSTR("BassF");
static CFStringRef kParameterTHRUnit = CFSTR("dyn");
static CFStringRef kParameterTHRName = CFSTR("Thresh");
static CFStringRef kParameterPANName = CFSTR("Pan");
static CFStringRef kParameterFADName = CFSTR("Fader");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
kParam_K =10,
kParam_HIG =0,
kParam_HMG =1,
kParam_LMG =2,
kParam_BSG =3,
kParam_HIF =4,
kParam_HMF =5,
kParam_LMF =6,
kParam_BSF =7,
kParam_THR =8,
kParam_PAN =9,
kParam_FAD =10,
//Add your parameters here...
kNumberOfParameters=11
};
@ -155,7 +159,7 @@ public:
biq_sR1,
biq_sR2,
biq_total
}; //coefficient interpolating bessel filter, stereo
}; //coefficient interpolating filter, stereo
double highA[biq_total];
double highB[biq_total];
double highC[biq_total];
@ -176,25 +180,16 @@ public:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
//Dynamics2
//Dynamics2 custom for buss
double avg32L[33];
double avg32R[33];
@ -217,6 +212,7 @@ public:
double panB;
double inTrimA;
double inTrimB;
uint32_t fpdL;
uint32_t fpdR;
};

View file

@ -51,19 +51,19 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 783619597;
PBXWorkspaceStateSaveDate = 783619597;
PBXPerProjectTemplateStateSaveDate = 787087708;
PBXWorkspaceStateSaveDate = 787087708;
};
perUserProjectItems = {
8B5C9E332EB51644008B9860 /* PBXTextBookmark */ = 8B5C9E332EB51644008B9860 /* PBXTextBookmark */;
8B5C9E342EB51644008B9860 /* PBXTextBookmark */ = 8B5C9E342EB51644008B9860 /* PBXTextBookmark */;
8B5C9E352EB51644008B9860 /* PBXTextBookmark */ = 8B5C9E352EB51644008B9860 /* PBXTextBookmark */;
8B5AB4362EE9BF2400A3F512 /* PBXTextBookmark */ = 8B5AB4362EE9BF2400A3F512 /* PBXTextBookmark */;
8B5AB4382EE9BF2400A3F512 /* PBXTextBookmark */ = 8B5AB4382EE9BF2400A3F512 /* PBXTextBookmark */;
8B5AB5B52EEA141600A3F512 /* PBXTextBookmark */ = 8B5AB5B52EEA141600A3F512 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B5C9E332EB51644008B9860 /* PBXTextBookmark */ = {
8B5AB4362EE9BF2400A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* ConsoleX2BussVersion.h */;
name = "ConsoleX2BussVersion.h: 1";
@ -73,32 +73,32 @@
vrLen = 258;
vrLoc = 0;
};
8B5C9E342EB51644008B9860 /* PBXTextBookmark */ = {
8B5AB4382EE9BF2400A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Buss.cpp */;
name = "ConsoleX2Buss.cpp: 317";
rLen = 20897;
rLoc = 14098;
name = "ConsoleX2Buss.cpp: 373";
rLen = 0;
rLoc = 16939;
rType = 0;
vrLen = 285;
vrLoc = 14098;
vrLen = 267;
vrLoc = 16825;
};
8B5C9E352EB51644008B9860 /* PBXTextBookmark */ = {
8B5AB5B52EEA141600A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Buss.cpp */;
name = "ConsoleX2Buss.cpp: 317";
rLen = 20897;
rLoc = 14098;
name = "ConsoleX2Buss.cpp: 373";
rLen = 0;
rLoc = 16939;
rType = 0;
vrLen = 285;
vrLoc = 14098;
vrLen = 188;
vrLoc = 16866;
};
8BA05A660720730100365D66 /* ConsoleX2Buss.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 13716}}";
sepNavSelRange = "{14098, 20897}";
sepNavVisRange = "{14098, 285}";
sepNavWindowFrame = "{{5, 38}, {912, 826}}";
sepNavIntBoundsRect = "{{0, 0}, {921, 13572}}";
sepNavSelRange = "{16939, 0}";
sepNavVisRange = "{16866, 188}";
sepNavWindowFrame = "{{14, 51}, {1146, 827}}";
};
};
8BA05A690720730100365D66 /* ConsoleX2BussVersion.h */ = {
@ -106,7 +106,7 @@
sepNavIntBoundsRect = "{{0, 0}, {554, 1098}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{0, 258}";
sepNavWindowFrame = "{{38, 66}, {1066, 786}}";
sepNavWindowFrame = "{{431, 92}, {1066, 786}}";
};
};
8BA05A7F072073D200365D66 /* AUBase.cpp */ = {
@ -118,10 +118,10 @@
};
8BC6025B073B072D006C4272 /* ConsoleX2Buss.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 4086}}";
sepNavSelRange = "{6056, 1375}";
sepNavVisRange = "{4948, 1224}";
sepNavWindowFrame = "{{10, 38}, {838, 820}}";
sepNavIntBoundsRect = "{{0, 0}, {1146, 4014}}";
sepNavSelRange = "{7268, 0}";
sepNavVisRange = "{3342, 1138}";
sepNavWindowFrame = "{{5, 58}, {838, 820}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -324,7 +324,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
<string>5 284 810 487 0 0 1440 878 </string>
<string>7 327 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -352,11 +352,11 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B5C9E352EB51644008B9860</string>
<string>8B5AB5B52EEA141600A3F512</string>
<key>history</key>
<array>
<string>8B5C9E332EB51644008B9860</string>
<string>8B5C9E342EB51644008B9860</string>
<string>8B5AB4362EE9BF2400A3F512</string>
<string>8B5AB4382EE9BF2400A3F512</string>
</array>
</dict>
<key>SplitCount</key>
@ -370,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {603, 132}}</string>
<string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
<string>5 284 810 487 0 0 1440 878 </string>
<string>7 327 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>132pt</string>
<string>117pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>309pt</string>
<string>324pt</string>
<key>Tabs</key>
<array>
<dict>
@ -395,9 +395,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 282}}</string>
<string>{{10, 27}, {603, 297}}</string>
<key>RubberWindowFrame</key>
<string>5 284 810 487 0 0 1440 878 </string>
<string>7 327 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -451,7 +451,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 401}}</string>
<string>{{10, 27}, {603, 414}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -479,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B5C9E362EB51644008B9860</string>
<string>8B5AB58F2EEA016D00A3F512</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B5C9E372EB51644008B9860</string>
<string>8B5AB5902EEA016D00A3F512</string>
<string>8BD95EC52E957B6B00D77499</string>
<string>8B5C9E382EB51644008B9860</string>
<string>8B5AB5912EEA016D00A3F512</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -656,7 +656,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>783619652.93727398</real>
<real>787092502.83642006</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -673,11 +673,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8B5C9E392EB51644008B9860</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleX2Buss/ConsoleX2Buss.xcodeproj</string>
<string>8B5AB5B62EEA141600A3F512</string>
<string>/Users/christopherjohnson/Desktop/ConsoleX2Buss/ConsoleX2Buss.xcodeproj</string>
</array>
<key>WindowString</key>
<string>5 284 810 487 0 0 1440 878 </string>
<string>7 327 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

File diff suppressed because it is too large Load diff

View file

@ -54,67 +54,75 @@
#pragma mark ____ConsoleX2Channel Parameters
// parameters
static const int kDefaultValue_ParamA = 1;
static const float kDefaultValue_ParamB = 0.0;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.5;
static const float kDefaultValue_ParamE = 0.5;
static const float kDefaultValue_ParamF = 0.5;
static const float kDefaultValue_ParamG = 0.5;
static const float kDefaultValue_ParamH = 0.5;
static const float kDefaultValue_ParamI = 0.5;
static const float kDefaultValue_ParamJ = 0.5;
static const float kDefaultValue_ParamK = 1.0;
static const float kDefaultValue_ParamL = 0.5;
static const float kDefaultValue_ParamM = 0.5;
static const float kDefaultValue_ParamN = 0.0;
static const float kDefaultValue_ParamO = 1.0;
static const float kDefaultValue_ParamP = 0.0;
static const float kDefaultValue_ParamQ = 0.5;
static const float kDefaultValue_ParamR = 0.5;
static const int kDefaultValue_ParamTRM = 1;
static const float kDefaultValue_ParamMOR = 0.0;
static CFStringRef kParameterAName = CFSTR("Trim");
static CFStringRef kParameterBName = CFSTR("More");
static CFStringRef kParameterCUnit = CFSTR("eq");
static CFStringRef kParameterCName = CFSTR("High");
static CFStringRef kParameterDName = CFSTR("HMid");
static CFStringRef kParameterEName = CFSTR("LMid");
static CFStringRef kParameterFName = CFSTR("Bass");
static CFStringRef kParameterGUnit = CFSTR("freq");
static CFStringRef kParameterGName = CFSTR("HighF");
static CFStringRef kParameterHName = CFSTR("HMidF");
static CFStringRef kParameterIName = CFSTR("LMidF");
static CFStringRef kParameterJName = CFSTR("BassF");
static CFStringRef kParameterKUnit = CFSTR("dyn");
static CFStringRef kParameterKName = CFSTR("Thresh");
static CFStringRef kParameterLName = CFSTR("Attack");
static CFStringRef kParameterMName = CFSTR("Release");
static CFStringRef kParameterNName = CFSTR("Gate");
static CFStringRef kParameterOUnit = CFSTR("fltr");
static CFStringRef kParameterOName = CFSTR("Lowpass");
static CFStringRef kParameterPName = CFSTR("Hipass");
static CFStringRef kParameterQName = CFSTR("Pan");
static CFStringRef kParameterRName = CFSTR("Fader");
static const float kDefaultValue_ParamHIG = 0.5;
static const float kDefaultValue_ParamHMG = 0.5;
static const float kDefaultValue_ParamLMG = 0.5;
static const float kDefaultValue_ParamBSG = 0.5;
static const float kDefaultValue_ParamHIF = 0.5;
static const float kDefaultValue_ParamHMF = 0.5;
static const float kDefaultValue_ParamLMF = 0.5;
static const float kDefaultValue_ParamBSF = 0.5;
static const float kDefaultValue_ParamTHR = 1.0;
static const float kDefaultValue_ParamATK = 0.5;
static const float kDefaultValue_ParamRLS = 0.5;
static const float kDefaultValue_ParamGAT = 0.0;
static const float kDefaultValue_ParamLOP = 1.0;
static const float kDefaultValue_ParamHIP = 0.0;
static const float kDefaultValue_ParamPAN = 0.5;
static const float kDefaultValue_ParamFAD = 0.5;
static CFStringRef kParameterTRMName = CFSTR("Trim");
static CFStringRef kParameterMORName = CFSTR("More");
static CFStringRef kParameterHIGUnit = CFSTR("eq");
static CFStringRef kParameterHIGName = CFSTR("High");
static CFStringRef kParameterHMGName = CFSTR("HMid");
static CFStringRef kParameterLMGName = CFSTR("LMid");
static CFStringRef kParameterBSGName = CFSTR("Bass");
static CFStringRef kParameterHIFUnit = CFSTR("freq");
static CFStringRef kParameterHIFName = CFSTR("HighF");
static CFStringRef kParameterHMFName = CFSTR("HMidF");
static CFStringRef kParameterLMFName = CFSTR("LMidF");
static CFStringRef kParameterBSFName = CFSTR("BassF");
static CFStringRef kParameterTHRUnit = CFSTR("dyn");
static CFStringRef kParameterTHRName = CFSTR("Thresh");
static CFStringRef kParameterATKName = CFSTR("Attack");
static CFStringRef kParameterRLSName = CFSTR("Release");
static CFStringRef kParameterGATName = CFSTR("Gate");
static CFStringRef kParameterLOPUnit = CFSTR("fltr");
static CFStringRef kParameterLOPName = CFSTR("Lowpass");
static CFStringRef kParameterHIPName = CFSTR("Hipass");
static CFStringRef kParameterPANName = CFSTR("Pan");
static CFStringRef kParameterFADName = CFSTR("Fader");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
kParam_K =10,
kParam_L =11,
kParam_M =12,
kParam_N =13,
kParam_O =14,
kParam_P =15,
kParam_Q =16,
kParam_R =17,
kParam_TRM =0,
kParam_MOR =1,
kParam_HIG =2,
kParam_HMG =3,
kParam_LMG =4,
kParam_BSG =5,
kParam_HIF =6,
kParam_HMF =7,
kParam_LMF =8,
kParam_BSF =9,
kParam_THR =10,
kParam_ATK =11,
kParam_RLS =12,
kParam_GAT =13,
kParam_LOP =14,
kParam_HIP =15,
kParam_PAN =16,
kParam_FAD =17,
//Add your parameters here...
kNumberOfParameters=18
};
@ -200,26 +208,18 @@ public:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

View file

@ -12,7 +12,7 @@
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
364,
300,
20,
48,
43,
@ -51,38 +51,48 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 783603960;
PBXWorkspaceStateSaveDate = 783603960;
PBXPerProjectTemplateStateSaveDate = 787092677;
PBXWorkspaceStateSaveDate = 787092677;
};
perUserProjectItems = {
8B692BE12EB4E21700F51381 /* PBXTextBookmark */ = 8B692BE12EB4E21700F51381 /* PBXTextBookmark */;
8B692BE22EB4E21700F51381 /* PBXTextBookmark */ = 8B692BE22EB4E21700F51381 /* PBXTextBookmark */;
8B5AB49F2EE9CADD00A3F512 /* PBXTextBookmark */ = 8B5AB49F2EE9CADD00A3F512 /* PBXTextBookmark */;
8B5AB4A02EE9CADD00A3F512 /* PBXTextBookmark */ = 8B5AB4A02EE9CADD00A3F512 /* PBXTextBookmark */;
8B5AB5F62EEA1E3300A3F512 /* PBXTextBookmark */ = 8B5AB5F62EEA1E3300A3F512 /* PBXTextBookmark */;
8B9629D92E9AC7DA000EAC04 /* PBXTextBookmark */ = 8B9629D92E9AC7DA000EAC04 /* PBXTextBookmark */;
8BAA80A32EA691D900A83054 /* PBXTextBookmark */ = 8BAA80A32EA691D900A83054 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B692BE12EB4E21700F51381 /* PBXTextBookmark */ = {
8B5AB49F2EE9CADD00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Channel.cpp */;
name = "ConsoleX2Channel.cpp: 377";
fRef = 8BC6025B073B072D006C4272 /* ConsoleX2Channel.h */;
name = "ConsoleX2Channel.h: 237";
rLen = 0;
rLoc = 16627;
rLoc = 8174;
rType = 0;
vrLen = 22;
vrLoc = 54;
vrLen = 181;
vrLoc = 74;
};
8B692BE22EB4E21700F51381 /* PBXTextBookmark */ = {
8B5AB4A02EE9CADD00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Channel.cpp */;
name = "ConsoleX2Channel.cpp: 377";
name = "ConsoleX2Channel.cpp: 600";
rLen = 0;
rLoc = 16627;
rLoc = 26751;
rType = 0;
vrLen = 22;
vrLoc = 54;
vrLen = 134;
vrLoc = 26171;
};
8B5AB5F62EEA1E3300A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Channel.cpp */;
name = "ConsoleX2Channel.cpp: 600";
rLen = 0;
rLoc = 26751;
rType = 0;
vrLen = 90;
vrLoc = 26215;
};
8B9629D92E9AC7DA000EAC04 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
@ -96,10 +106,10 @@
};
8BA05A660720730100365D66 /* ConsoleX2Channel.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {696, 17226}}";
sepNavSelRange = "{16627, 0}";
sepNavVisRange = "{54, 22}";
sepNavWindowFrame = "{{6, 88}, {931, 746}}";
sepNavIntBoundsRect = "{{0, 0}, {867, 16470}}";
sepNavSelRange = "{26751, 0}";
sepNavVisRange = "{26215, 90}";
sepNavWindowFrame = "{{11, 97}, {931, 746}}";
};
};
8BA05A670720730100365D66 /* ConsoleX2Channel.exp */ = {
@ -114,8 +124,8 @@
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 1062}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{1277, 1741}";
sepNavWindowFrame = "{{777, 92}, {1066, 786}}";
sepNavVisRange = "{1179, 1839}";
sepNavWindowFrame = "{{374, 92}, {1066, 786}}";
};
};
8BA05A7F072073D200365D66 /* AUBase.cpp */ = {
@ -125,22 +135,12 @@
sepNavVisRange = "{0, 1336}";
};
};
8BAA80A32EA691D900A83054 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* ConsoleX2Channel.h */;
name = "ConsoleX2Channel.h: 235";
rLen = 0;
rLoc = 8160;
rType = 0;
vrLen = 76;
vrLoc = 7715;
};
8BC6025B073B072D006C4272 /* ConsoleX2Channel.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 5058}}";
sepNavSelRange = "{8317, 299}";
sepNavVisRange = "{3331, 1640}";
sepNavWindowFrame = "{{2, 39}, {656, 839}}";
sepNavIntBoundsRect = "{{0, 0}, {1146, 5688}}";
sepNavSelRange = "{7629, 237}";
sepNavVisRange = "{6149, 1155}";
sepNavWindowFrame = "{{16, 53}, {802, 825}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -282,7 +282,7 @@
<dict>
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
<real>185</real>
<real>249</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
@ -307,7 +307,7 @@
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 0}, {185, 428}}</string>
<string>{{0, 0}, {249, 428}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@ -317,19 +317,19 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {202, 446}}</string>
<string>{{0, 0}, {266, 446}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
<real>185</real>
<real>249</real>
</array>
<key>RubberWindowFrame</key>
<string>9 258 810 487 0 0 1440 878 </string>
<string>1 358 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
<string>202pt</string>
<string>266pt</string>
</dict>
<dict>
<key>Dock</key>
@ -352,12 +352,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B692BE22EB4E21700F51381</string>
<string>8B5AB5F62EEA1E3300A3F512</string>
<key>history</key>
<array>
<string>8B9629D92E9AC7DA000EAC04</string>
<string>8BAA80A32EA691D900A83054</string>
<string>8B692BE12EB4E21700F51381</string>
<string>8B5AB49F2EE9CADD00A3F512</string>
<string>8B5AB4A02EE9CADD00A3F512</string>
</array>
</dict>
<key>SplitCount</key>
@ -371,9 +371,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {603, 51}}</string>
<string>{{0, 0}, {539, 51}}</string>
<key>RubberWindowFrame</key>
<string>9 258 810 487 0 0 1440 878 </string>
<string>1 358 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
@ -396,9 +396,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 363}}</string>
<string>{{10, 27}, {539, 363}}</string>
<key>RubberWindowFrame</key>
<string>9 258 810 487 0 0 1440 878 </string>
<string>1 358 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -452,7 +452,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 345}}</string>
<string>{{10, 27}, {539, 328}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -461,7 +461,7 @@
</dict>
</array>
<key>Proportion</key>
<string>603pt</string>
<string>539pt</string>
</dict>
</array>
<key>Name</key>
@ -480,11 +480,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B692BE32EB4E21700F51381</string>
<string>8B5AB5C72EEA14CA00A3F512</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B692BE42EB4E21700F51381</string>
<string>8B5AB5C82EEA14CA00A3F512</string>
<string>8BD95EA72E957B1200D77499</string>
<string>8B692BE52EB4E21700F51381</string>
<string>8B5AB5C92EEA14CA00A3F512</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -633,14 +633,14 @@
</array>
<key>TableOfContents</key>
<array>
<string>8BD964DD2E95AA8E00D77499</string>
<string>8B5AB4132EE9B1F300A3F512</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
<string>8BD964DE2E95AA8E00D77499</string>
<string>8BD964DF2E95AA8E00D77499</string>
<string>8BD964E02E95AA8E00D77499</string>
<string>8BD964E12E95AA8E00D77499</string>
<string>8BD964E22E95AA8E00D77499</string>
<string>8B5AB4142EE9B1F300A3F512</string>
<string>8B5AB4152EE9B1F300A3F512</string>
<string>8B5AB4162EE9B1F300A3F512</string>
<string>8B5AB4172EE9B1F300A3F512</string>
<string>8B5AB4182EE9B1F300A3F512</string>
</array>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
@ -657,7 +657,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>783606295.64856899</real>
<real>787095091.46855199</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -674,10 +674,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleX2Channel/ConsoleX2Channel.xcodeproj</string>
<string>/Users/christopherjohnson/Desktop/ConsoleX2Channel/ConsoleX2Channel.xcodeproj</string>
</array>
<key>WindowString</key>
<string>9 258 810 487 0 0 1440 878 </string>
<string>1 358 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -59,23 +59,23 @@ ConsoleX2Pre::ConsoleX2Pre(AudioUnit component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
SetParameter(kParam_E, kDefaultValue_ParamE );
SetParameter(kParam_F, kDefaultValue_ParamF );
SetParameter(kParam_G, kDefaultValue_ParamG );
SetParameter(kParam_H, kDefaultValue_ParamH );
SetParameter(kParam_I, kDefaultValue_ParamI );
SetParameter(kParam_J, kDefaultValue_ParamJ );
SetParameter(kParam_K, kDefaultValue_ParamK );
SetParameter(kParam_L, kDefaultValue_ParamL );
SetParameter(kParam_M, kDefaultValue_ParamM );
SetParameter(kParam_N, kDefaultValue_ParamN );
SetParameter(kParam_O, kDefaultValue_ParamO );
SetParameter(kParam_P, kDefaultValue_ParamP );
SetParameter(kParam_Q, kDefaultValue_ParamQ );
SetParameter(kParam_TRM, kDefaultValue_ParamTRM );
SetParameter(kParam_MOR, kDefaultValue_ParamMOR );
SetParameter(kParam_HIG, kDefaultValue_ParamHIG );
SetParameter(kParam_HMG, kDefaultValue_ParamHMG );
SetParameter(kParam_LMG, kDefaultValue_ParamLMG );
SetParameter(kParam_BSG, kDefaultValue_ParamBSG );
SetParameter(kParam_HIF, kDefaultValue_ParamHIF );
SetParameter(kParam_HMF, kDefaultValue_ParamHMF );
SetParameter(kParam_LMF, kDefaultValue_ParamLMF );
SetParameter(kParam_BSF, kDefaultValue_ParamBSF );
SetParameter(kParam_THR, kDefaultValue_ParamTHR );
SetParameter(kParam_ATK, kDefaultValue_ParamATK );
SetParameter(kParam_RLS, kDefaultValue_ParamRLS );
SetParameter(kParam_GAT, kDefaultValue_ParamGAT );
SetParameter(kParam_LOP, kDefaultValue_ParamLOP );
SetParameter(kParam_HIP, kDefaultValue_ParamHIP );
SetParameter(kParam_FAD, kDefaultValue_ParamFAD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
@ -112,128 +112,128 @@ ComponentResult ConsoleX2Pre::GetParameterInfo(AudioUnitScope inScope,
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
case kParam_TRM:
AUBase::FillInParameterName (outParameterInfo, kParameterTRMName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Indexed;
outParameterInfo.minValue = 0;
outParameterInfo.maxValue = 4;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
outParameterInfo.defaultValue = kDefaultValue_ParamTRM;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
case kParam_MOR:
AUBase::FillInParameterName (outParameterInfo, kParameterMORName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
outParameterInfo.defaultValue = kDefaultValue_ParamMOR;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
case kParam_HIG:
AUBase::FillInParameterName (outParameterInfo, kParameterHIGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterCUnit;
outParameterInfo.unitName = kParameterHIGUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
outParameterInfo.defaultValue = kDefaultValue_ParamHIG;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
case kParam_HMG:
AUBase::FillInParameterName (outParameterInfo, kParameterHMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
outParameterInfo.defaultValue = kDefaultValue_ParamHMG;
break;
case kParam_E:
AUBase::FillInParameterName (outParameterInfo, kParameterEName, false);
case kParam_LMG:
AUBase::FillInParameterName (outParameterInfo, kParameterLMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamE;
outParameterInfo.defaultValue = kDefaultValue_ParamLMG;
break;
case kParam_F:
AUBase::FillInParameterName (outParameterInfo, kParameterFName, false);
case kParam_BSG:
AUBase::FillInParameterName (outParameterInfo, kParameterBSGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
outParameterInfo.defaultValue = kDefaultValue_ParamBSG;
break;
case kParam_G:
AUBase::FillInParameterName (outParameterInfo, kParameterGName, false);
case kParam_HIF:
AUBase::FillInParameterName (outParameterInfo, kParameterHIFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterGUnit;
outParameterInfo.unitName = kParameterHIFUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamG;
outParameterInfo.defaultValue = kDefaultValue_ParamHIF;
break;
case kParam_H:
AUBase::FillInParameterName (outParameterInfo, kParameterHName, false);
case kParam_HMF:
AUBase::FillInParameterName (outParameterInfo, kParameterHMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamH;
outParameterInfo.defaultValue = kDefaultValue_ParamHMF;
break;
case kParam_I:
AUBase::FillInParameterName (outParameterInfo, kParameterIName, false);
case kParam_LMF:
AUBase::FillInParameterName (outParameterInfo, kParameterLMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamI;
outParameterInfo.defaultValue = kDefaultValue_ParamLMF;
break;
case kParam_J:
AUBase::FillInParameterName (outParameterInfo, kParameterJName, false);
case kParam_BSF:
AUBase::FillInParameterName (outParameterInfo, kParameterBSFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamJ;
outParameterInfo.defaultValue = kDefaultValue_ParamBSF;
break;
case kParam_K:
AUBase::FillInParameterName (outParameterInfo, kParameterKName, false);
case kParam_THR:
AUBase::FillInParameterName (outParameterInfo, kParameterTHRName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterKUnit;
outParameterInfo.unitName = kParameterTHRUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamK;
outParameterInfo.defaultValue = kDefaultValue_ParamTHR;
break;
case kParam_L:
AUBase::FillInParameterName (outParameterInfo, kParameterLName, false);
case kParam_ATK:
AUBase::FillInParameterName (outParameterInfo, kParameterATKName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamL;
outParameterInfo.defaultValue = kDefaultValue_ParamATK;
break;
case kParam_M:
AUBase::FillInParameterName (outParameterInfo, kParameterMName, false);
case kParam_RLS:
AUBase::FillInParameterName (outParameterInfo, kParameterRLSName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamM;
outParameterInfo.defaultValue = kDefaultValue_ParamRLS;
break;
case kParam_N:
AUBase::FillInParameterName (outParameterInfo, kParameterNName, false);
case kParam_GAT:
AUBase::FillInParameterName (outParameterInfo, kParameterGATName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamN;
outParameterInfo.defaultValue = kDefaultValue_ParamGAT;
break;
case kParam_O:
AUBase::FillInParameterName (outParameterInfo, kParameterOName, false);
case kParam_LOP:
AUBase::FillInParameterName (outParameterInfo, kParameterLOPName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterOUnit;
outParameterInfo.unitName = kParameterLOPUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamO;
outParameterInfo.defaultValue = kDefaultValue_ParamLOP;
break;
case kParam_P:
AUBase::FillInParameterName (outParameterInfo, kParameterPName, false);
case kParam_HIP:
AUBase::FillInParameterName (outParameterInfo, kParameterHIPName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamP;
outParameterInfo.defaultValue = kDefaultValue_ParamHIP;
break;
case kParam_Q:
AUBase::FillInParameterName (outParameterInfo, kParameterQName, false);
case kParam_FAD:
AUBase::FillInParameterName (outParameterInfo, kParameterFADName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamQ;
outParameterInfo.defaultValue = kDefaultValue_ParamFAD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
@ -306,10 +306,10 @@ void ConsoleX2Pre::ConsoleX2PreKernel::Reset()
lowIIR = 0.0;
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPosition[count] = 0.0;
@ -366,323 +366,321 @@ void ConsoleX2Pre::ConsoleX2PreKernel::Process( const Float32 *inSourceP,
int spacing = floor(overallscale*2.0);
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double moreTapeHack = (GetParameter( kParam_B )*2.0)+1.0;
switch ((int)GetParameter( kParam_A )){
double moreTapeHack = (GetParameter( kParam_MOR )*2.0)+1.0;
bool tapehackOff = (GetParameter( kParam_MOR ) == 0.0);
switch ((int)GetParameter( kParam_TRM )){
case 0: moreTapeHack *= 0.5; break;
case 1: break;
case 2: moreTapeHack *= 2.0; break;
case 3: moreTapeHack *= 4.0; break;
case 4: moreTapeHack *= 8.0; break;
}
double moreDiscontinuity = fmax(pow(GetParameter( kParam_B )*0.42,3.0)*overallscale,0.00001);
double moreDiscontinuity = fmax(pow(GetParameter( kParam_MOR )*0.42,3.0)*overallscale,0.00001);
//Discontapeity
double trebleGain = (GetParameter( kParam_C )-0.5)*2.0;
double trebleGain = (GetParameter( kParam_HIG )-0.5)*2.0;
trebleGain = 1.0+(trebleGain*fabs(trebleGain)*fabs(trebleGain));
double highmidGain = (GetParameter( kParam_D )-0.5)*2.0;
double highmidGain = (GetParameter( kParam_HMG )-0.5)*2.0;
highmidGain = 1.0+(highmidGain*fabs(highmidGain)*fabs(highmidGain));
double lowmidGain = (GetParameter( kParam_E )-0.5)*2.0;
double lowmidGain = (GetParameter( kParam_LMG )-0.5)*2.0;
lowmidGain = 1.0+(lowmidGain*fabs(lowmidGain)*fabs(lowmidGain));
double bassGain = (GetParameter( kParam_F )-0.5)*2.0;
double bassGain = (GetParameter( kParam_BSG )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
double highCoef = 0.0;
double midCoef = 0.0;
double lowCoef = 0.0;
double trebleRef = GetParameter( kParam_G )-0.5;
double highmidRef = GetParameter( kParam_H )-0.5;
double lowmidRef = GetParameter( kParam_I )-0.5;
double bassRef = GetParameter( kParam_J )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
double highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
bool eqOff = (trebleGain == 1.0 && highmidGain == 1.0 && lowmidGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
double trebleRef = GetParameter( kParam_HIF )-0.5;
double highmidRef = GetParameter( kParam_HMF )-0.5;
double lowmidRef = GetParameter( kParam_LMF )-0.5;
double bassRef = GetParameter( kParam_BSF )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
}
//SmoothEQ2
double bezCThresh = pow(1.0-GetParameter( kParam_K ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_L ), 8.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_M ),12.0) / overallscale;
sloRez = fmin(fmax(sloRez-(bezRez*0.5),0.00001),1.0);
double bezThresh = pow(1.0-GetParameter( kParam_THR ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_GAT ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
double gate = pow(pow(GetParameter( kParam_N ),4.0),sqrt(bezCThresh+1.0));
//Dynamics2
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_O ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_P ),overallscale+2.0); //the highpass
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_LOP ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_HIP ),overallscale+2.0); //the highpass
//Cabs2
inTrimA = inTrimB; inTrimB = GetParameter( kParam_Q )*2.0;
inTrimA = inTrimB; inTrimB = GetParameter( kParam_FAD )*2.0;
//Console
while (nSampleFrames-- > 0) {
double inputSampleL = *sourceP;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpd * 1.18e-17;
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//trim control gets to work even when MORE is off
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
if (!tapehackOff) {
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
}
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highIIR = (highIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highIIR; trebleL -= highmidL;
midIIR = (midIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midIIR; highmidL -= lowmidL;
lowIIR = (lowIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
if (!eqOff) {
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highIIR = (highIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highIIR; trebleL -= highmidL;
midIIR = (midIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midIIR; highmidL -= lowmidL;
lowIIR = (lowIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
}
//SmoothEQ2
if (fabs(inputSampleL) > gate+(sloRez*bezGate)) bezGate = ((bezGate*overallscale*3.0)+3.0)*(0.25/overallscale);
else bezGate = fmax(0.0, bezGate-(sloRez*sloRez));
if (bezCThresh > 0.0) inputSampleL *= ((bezCThresh*0.5)+1.0);
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezMaxF = fmax(bezMaxF,fabs(inputSampleL));
if (bezCompF[bez_cycle] > 1.0) {
if (bezMaxF < gate) bezCompF[bez_SampL] = bezMaxF/gate; //note: SampL is a control voltage,
if (bezCompF[bez_SampL]<gate) bezCompF[bez_SampL] = 0.0; //not a bipolar audio signal
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage.
if (bezCompS[bez_cycle] > 1.0) {
if (bezCompS[bez_SampL]<gate) bezCompS[bez_SampL] = 0.0;
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
if (bezGate < 1.0 && gate > 0.0) inputSampleL *= bezGate;
//Dynamics2
if (bezThresh > 0.0) {
if (fabs(inputSampleL) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
inputSampleL *= (bezThresh+1.0);
double ctrl = fabs(inputSampleL);
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
} else bezComp[bez_Ctrl] = 0.0;
//Dynamics3
const double temp = (double)nSampleFrames/inFramesToProcess;
const double hFreq = (hFreqA*temp)+(hFreqB*(1.0-temp));

View file

@ -54,64 +54,72 @@
#pragma mark ____ConsoleX2Pre Parameters
// parameters
static const int kDefaultValue_ParamA = 1;
static const float kDefaultValue_ParamB = 0.0;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.5;
static const float kDefaultValue_ParamE = 0.5;
static const float kDefaultValue_ParamF = 0.5;
static const float kDefaultValue_ParamG = 0.5;
static const float kDefaultValue_ParamH = 0.5;
static const float kDefaultValue_ParamI = 0.5;
static const float kDefaultValue_ParamJ = 0.5;
static const float kDefaultValue_ParamK = 1.0;
static const float kDefaultValue_ParamL = 0.5;
static const float kDefaultValue_ParamM = 0.5;
static const float kDefaultValue_ParamN = 0.0;
static const float kDefaultValue_ParamO = 1.0;
static const float kDefaultValue_ParamP = 0.0;
static const float kDefaultValue_ParamQ = 0.5;
static const int kDefaultValue_ParamTRM = 1;
static const float kDefaultValue_ParamMOR = 0.0;
static CFStringRef kParameterAName = CFSTR("Trim");
static CFStringRef kParameterBName = CFSTR("More");
static CFStringRef kParameterCUnit = CFSTR("eq");
static CFStringRef kParameterCName = CFSTR("High");
static CFStringRef kParameterDName = CFSTR("HMid");
static CFStringRef kParameterEName = CFSTR("LMid");
static CFStringRef kParameterFName = CFSTR("Bass");
static CFStringRef kParameterGUnit = CFSTR("freq");
static CFStringRef kParameterGName = CFSTR("HighF");
static CFStringRef kParameterHName = CFSTR("HMidF");
static CFStringRef kParameterIName = CFSTR("LMidF");
static CFStringRef kParameterJName = CFSTR("BassF");
static CFStringRef kParameterKUnit = CFSTR("dyn");
static CFStringRef kParameterKName = CFSTR("Thresh");
static CFStringRef kParameterLName = CFSTR("Attack");
static CFStringRef kParameterMName = CFSTR("Release");
static CFStringRef kParameterNName = CFSTR("Gate");
static CFStringRef kParameterOUnit = CFSTR("fltr");
static CFStringRef kParameterOName = CFSTR("Lowpass");
static CFStringRef kParameterPName = CFSTR("Hipass");
static CFStringRef kParameterQName = CFSTR("Fader");
static const float kDefaultValue_ParamHIG = 0.5;
static const float kDefaultValue_ParamHMG = 0.5;
static const float kDefaultValue_ParamLMG = 0.5;
static const float kDefaultValue_ParamBSG = 0.5;
static const float kDefaultValue_ParamHIF = 0.5;
static const float kDefaultValue_ParamHMF = 0.5;
static const float kDefaultValue_ParamLMF = 0.5;
static const float kDefaultValue_ParamBSF = 0.5;
static const float kDefaultValue_ParamTHR = 1.0;
static const float kDefaultValue_ParamATK = 0.5;
static const float kDefaultValue_ParamRLS = 0.5;
static const float kDefaultValue_ParamGAT = 0.0;
static const float kDefaultValue_ParamLOP = 1.0;
static const float kDefaultValue_ParamHIP = 0.0;
static const float kDefaultValue_ParamFAD = 0.5;
static CFStringRef kParameterTRMName = CFSTR("Trim");
static CFStringRef kParameterMORName = CFSTR("More");
static CFStringRef kParameterHIGUnit = CFSTR("eq");
static CFStringRef kParameterHIGName = CFSTR("High");
static CFStringRef kParameterHMGName = CFSTR("HMid");
static CFStringRef kParameterLMGName = CFSTR("LMid");
static CFStringRef kParameterBSGName = CFSTR("Bass");
static CFStringRef kParameterHIFUnit = CFSTR("freq");
static CFStringRef kParameterHIFName = CFSTR("HighF");
static CFStringRef kParameterHMFName = CFSTR("HMidF");
static CFStringRef kParameterLMFName = CFSTR("LMidF");
static CFStringRef kParameterBSFName = CFSTR("BassF");
static CFStringRef kParameterTHRUnit = CFSTR("dyn");
static CFStringRef kParameterTHRName = CFSTR("Thresh");
static CFStringRef kParameterATKName = CFSTR("Attack");
static CFStringRef kParameterRLSName = CFSTR("Release");
static CFStringRef kParameterGATName = CFSTR("Gate");
static CFStringRef kParameterLOPUnit = CFSTR("fltr");
static CFStringRef kParameterLOPName = CFSTR("Lowpass");
static CFStringRef kParameterHIPName = CFSTR("Hipass");
static CFStringRef kParameterFADName = CFSTR("Fader");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
kParam_K =10,
kParam_L =11,
kParam_M =12,
kParam_N =13,
kParam_O =14,
kParam_P =15,
kParam_Q =16,
kParam_TRM =0,
kParam_MOR =1,
kParam_HIG =2,
kParam_HMG =3,
kParam_LMG =4,
kParam_BSG =5,
kParam_HIF =6,
kParam_HMF =7,
kParam_LMF =8,
kParam_BSF =9,
kParam_THR =10,
kParam_ATK =11,
kParam_RLS =12,
kParam_GAT =13,
kParam_LOP =14,
kParam_HIP =15,
kParam_FAD =16,
//Add your parameters here...
kNumberOfParameters=17
};
@ -208,20 +216,18 @@ public:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPosition[23];
double iirHAngle[23];

View file

@ -51,12 +51,13 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 783603927;
PBXWorkspaceStateSaveDate = 783603927;
PBXPerProjectTemplateStateSaveDate = 787095378;
PBXWorkspaceStateSaveDate = 787095378;
};
perUserProjectItems = {
8B692B762EB4D66E00F51381 /* PBXTextBookmark */ = 8B692B762EB4D66E00F51381 /* PBXTextBookmark */;
8B692BBF2EB4DCD400F51381 /* PBXTextBookmark */ = 8B692BBF2EB4DCD400F51381 /* PBXTextBookmark */;
8B5AB41A2EE9B1F500A3F512 /* PBXTextBookmark */ = 8B5AB41A2EE9B1F500A3F512 /* PBXTextBookmark */;
8B5AB41C2EE9B1F500A3F512 /* PBXTextBookmark */ = 8B5AB41C2EE9B1F500A3F512 /* PBXTextBookmark */;
8B5AB63E2EEA333200A3F512 /* PBXTextBookmark */ = 8B5AB63E2EEA333200A3F512 /* PBXTextBookmark */;
8BC5BE482EB1697700031C01 /* PBXTextBookmark */ = 8BC5BE482EB1697700031C01 /* PBXTextBookmark */;
8BD964C72E95AA0700D77499 /* PlistBookmark */ = 8BD964C72E95AA0700D77499 /* PlistBookmark */;
};
@ -64,32 +65,42 @@
userBuildSettings = {
};
};
8B692B762EB4D66E00F51381 /* PBXTextBookmark */ = {
8B5AB41A2EE9B1F500A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Pre.cpp */;
name = "ConsoleX2Pre.cpp: 698";
fRef = 8BC6025B073B072D006C4272 /* ConsoleX2Pre.h */;
name = "ConsoleX2Pre.h: 122";
rLen = 0;
rLoc = 31458;
rLoc = 5117;
rType = 0;
vrLen = 66;
vrLoc = 3;
vrLen = 114;
vrLoc = 7293;
};
8B692BBF2EB4DCD400F51381 /* PBXTextBookmark */ = {
8B5AB41C2EE9B1F500A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Pre.cpp */;
name = "ConsoleX2Pre.cpp: 698";
name = "ConsoleX2Pre.cpp: 696";
rLen = 0;
rLoc = 31458;
rLoc = 31255;
rType = 0;
vrLen = 40;
vrLoc = 29;
vrLen = 206;
vrLoc = 47;
};
8B5AB63E2EEA333200A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleX2Pre.cpp */;
name = "ConsoleX2Pre.cpp: 696";
rLen = 0;
rLoc = 31255;
rType = 0;
vrLen = 206;
vrLoc = 47;
};
8BA05A660720730100365D66 /* ConsoleX2Pre.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1065, 13572}}";
sepNavSelRange = "{31458, 0}";
sepNavVisRange = "{29, 40}";
sepNavWindowFrame = "{{19, 92}, {1066, 786}}";
sepNavIntBoundsRect = "{{0, 0}, {1065, 13464}}";
sepNavSelRange = "{31255, 0}";
sepNavVisRange = "{47, 206}";
sepNavWindowFrame = "{{13, 92}, {1066, 786}}";
};
};
8BA05A690720730100365D66 /* ConsoleX2PreVersion.h */ = {
@ -112,10 +123,10 @@
};
8BC6025B073B072D006C4272 /* ConsoleX2Pre.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 4734}}";
sepNavSelRange = "{8318, 0}";
sepNavVisRange = "{3264, 1603}";
sepNavWindowFrame = "{{7, 38}, {657, 832}}";
sepNavIntBoundsRect = "{{0, 0}, {1146, 4842}}";
sepNavSelRange = "{7719, 250}";
sepNavVisRange = "{4221, 1052}";
sepNavWindowFrame = "{{19, 46}, {657, 832}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -302,7 +302,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>3</integer>
<integer>4</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
@ -326,7 +326,7 @@
<real>288</real>
</array>
<key>RubberWindowFrame</key>
<string>25 209 716 511 0 0 1440 878 </string>
<string>10 90 716 511 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -354,12 +354,13 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B692BBF2EB4DCD400F51381</string>
<string>8B5AB63E2EEA333200A3F512</string>
<key>history</key>
<array>
<string>8BD964C72E95AA0700D77499</string>
<string>8BC5BE482EB1697700031C01</string>
<string>8B692B762EB4D66E00F51381</string>
<string>8B5AB41A2EE9B1F500A3F512</string>
<string>8B5AB41C2EE9B1F500A3F512</string>
</array>
</dict>
<key>SplitCount</key>
@ -373,18 +374,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {406, 94}}</string>
<string>{{0, 0}, {406, 125}}</string>
<key>RubberWindowFrame</key>
<string>25 209 716 511 0 0 1440 878 </string>
<string>10 90 716 511 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>94pt</string>
<string>125pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>371pt</string>
<string>340pt</string>
<key>Tabs</key>
<array>
<dict>
@ -398,9 +399,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {406, 344}}</string>
<string>{{10, 27}, {406, 313}}</string>
<key>RubberWindowFrame</key>
<string>25 209 716 511 0 0 1440 878 </string>
<string>10 90 716 511 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -482,11 +483,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B692B8A2EB4D8DA00F51381</string>
<string>8B5AB63F2EEA333200A3F512</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B692B8B2EB4D8DA00F51381</string>
<string>8B5AB6402EEA333200A3F512</string>
<string>8BD7274A1D46E5A5000176F0</string>
<string>8B692B8C2EB4D8DA00F51381</string>
<string>8B5AB6412EEA333200A3F512</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -659,7 +660,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>783604948.76098895</real>
<real>787100466.62823403</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -676,10 +677,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleX2Pre/ConsoleX2Pre.xcodeproj</string>
<string>/Users/christopherjohnson/Desktop/ConsoleX2Pre/ConsoleX2Pre.xcodeproj</string>
</array>
<key>WindowString</key>
<string>25 209 716 511 0 0 1440 878 </string>
<string>10 90 716 511 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -0,0 +1,293 @@
/*
* File: Dynamics3.cpp
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*=============================================================================
Dynamics3.cpp
=============================================================================*/
#include "Dynamics3.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMPONENT_ENTRY(Dynamics3)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::Dynamics3
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dynamics3::Dynamics3(AudioUnit component)
: AUEffectBase(component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetParameterValueStrings
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings)
{
return kAudioUnitErr_InvalidProperty;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetParameterInfo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetParameterInfo(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
AudioUnitParameterInfo &outParameterInfo )
{
ComponentResult result = noErr;
outParameterInfo.flags = kAudioUnitParameterFlag_IsWritable
| kAudioUnitParameterFlag_IsReadable;
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
break;
}
} else {
result = kAudioUnitErr_InvalidParameter;
}
return result;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetPropertyInfo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetPropertyInfo (AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
UInt32 & outDataSize,
Boolean & outWritable)
{
return AUEffectBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// state that plugin supports only stereo-in/stereo-out processing
UInt32 Dynamics3::SupportedNumChannels(const AUChannelInfo ** outInfo)
{
if (outInfo != NULL)
{
static AUChannelInfo info;
info.inChannels = 2;
info.outChannels = 2;
*outInfo = &info;
}
return 1;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetProperty
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData )
{
return AUEffectBase::GetProperty (inID, inScope, inElement, outData);
}
// Dynamics3::Initialize
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::Initialize()
{
ComponentResult result = AUEffectBase::Initialize();
if (result == noErr)
Reset(kAudioUnitScope_Global, 0);
return result;
}
#pragma mark ____Dynamics3EffectKernel
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::Dynamics3Kernel::Reset()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::Reset(AudioUnitScope inScope, AudioUnitElement inElement)
{
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
return noErr;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::ProcessBufferLists
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus Dynamics3::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags,
const AudioBufferList & inBuffer,
AudioBufferList & outBuffer,
UInt32 inFramesToProcess)
{
Float32 * inputL = (Float32*)(inBuffer.mBuffers[0].mData);
Float32 * inputR = (Float32*)(inBuffer.mBuffers[1].mData);
Float32 * outputL = (Float32*)(outBuffer.mBuffers[0].mData);
Float32 * outputR = (Float32*)(outBuffer.mBuffers[1].mData);
UInt32 nSampleFrames = inFramesToProcess;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= GetSampleRate();
double bezThresh = pow(1.0-GetParameter( kParam_A ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_B ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_C ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_D ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
while (nSampleFrames-- > 0) {
double inputSampleL = *inputL;
double inputSampleR = *inputR;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
inputSampleR *= (bezThresh+1.0);
}
double ctrl = fmax(fabs(inputSampleL),fabs(inputSampleR));
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
inputSampleR *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither
*outputL = inputSampleL;
*outputR = inputSampleR;
//direct stereo out
inputL += 1;
inputR += 1;
outputL += 1;
outputR += 1;
}
return noErr;
}

View file

@ -0,0 +1 @@
_Dynamics3Entry

View file

@ -0,0 +1,142 @@
/*
* File: Dynamics3.h
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "AUEffectBase.h"
#include "Dynamics3Version.h"
#if AU_DEBUG_DISPATCHER
#include "AUDebugDispatcher.h"
#endif
#ifndef __Dynamics3_h__
#define __Dynamics3_h__
#pragma mark ____Dynamics3 Parameters
// parameters
static const float kDefaultValue_ParamA = 1.0;
static const float kDefaultValue_ParamB = 0.5;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.0;
static CFStringRef kParameterAName = CFSTR("Thresh");
static CFStringRef kParameterBName = CFSTR("Attack");
static CFStringRef kParameterCName = CFSTR("Release");
static CFStringRef kParameterDName = CFSTR("Gate");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
//Add your parameters here...
kNumberOfParameters=4
};
#pragma mark ____Dynamics3
class Dynamics3 : public AUEffectBase
{
public:
Dynamics3(AudioUnit component);
#if AU_DEBUG_DISPATCHER
virtual ~Dynamics3 () { delete mDebugDispatcher; }
#endif
virtual ComponentResult Reset(AudioUnitScope inScope, AudioUnitElement inElement);
virtual OSStatus ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags,
const AudioBufferList & inBuffer, AudioBufferList & outBuffer,
UInt32 inFramesToProcess);
virtual UInt32 SupportedNumChannels(const AUChannelInfo ** outInfo);
virtual ComponentResult GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings);
virtual ComponentResult GetParameterInfo(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
AudioUnitParameterInfo &outParameterInfo);
virtual ComponentResult GetPropertyInfo(AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
UInt32 & outDataSize,
Boolean & outWritable );
virtual ComponentResult GetProperty(AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData);
virtual ComponentResult Initialize();
virtual bool SupportsTail () { return true; }
virtual Float64 GetTailTime() {return (1.0/GetSampleRate())*0.0;} //in SECONDS! gsr * a number = in samples
virtual Float64 GetLatency() {return (1.0/GetSampleRate())*0.0;} // in SECONDS! gsr * a number = in samples
/*! @method Version */
virtual ComponentResult Version() { return kDynamics3Version; }
private:
enum {
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics3
uint32_t fpdL;
uint32_t fpdR;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#endif

View file

@ -0,0 +1,61 @@
/*
* File: Dynamics3.r
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <AudioUnit/AudioUnit.r>
#include "Dynamics3Version.h"
// Note that resource IDs must be spaced 2 apart for the 'STR ' name and description
#define kAudioUnitResID_Dynamics3 1000
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dynamics3~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define RES_ID kAudioUnitResID_Dynamics3
#define COMP_TYPE kAudioUnitType_Effect
#define COMP_SUBTYPE Dynamics3_COMP_SUBTYPE
#define COMP_MANUF Dynamics3_COMP_MANF
#define VERSION kDynamics3Version
#define NAME "Airwindows: Dynamics3"
#define DESCRIPTION "Dynamics3 AU"
#define ENTRY_POINT "Dynamics3Entry"
#include "AUResources.r"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,131 @@
// !$*UTF8*$!
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
activeTarget = 8D01CCC60486CAD60068D4B7 /* Dynamics3 */;
codeSenseManager = 8BD3CCB9148830B20062E48C /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
127,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
188,
60,
20,
48,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 786918597;
PBXWorkspaceStateSaveDate = 786918597;
};
perUserProjectItems = {
8B5AB2B22EE779AB00A3F512 /* PBXTextBookmark */ = 8B5AB2B22EE779AB00A3F512 /* PBXTextBookmark */;
8B5AB2B32EE779AB00A3F512 /* PBXTextBookmark */ = 8B5AB2B32EE779AB00A3F512 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B5AB2B22EE779AB00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Dynamics3.cpp */;
name = "Dynamics3.cpp: 240";
rLen = 1179;
rLoc = 10661;
rType = 0;
vrLen = 241;
vrLoc = 10661;
};
8B5AB2B32EE779AB00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Dynamics3.cpp */;
name = "Dynamics3.cpp: 240";
rLen = 1179;
rLoc = 10661;
rType = 0;
vrLen = 241;
vrLoc = 10661;
};
8BA05A660720730100365D66 /* Dynamics3.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {975, 5508}}";
sepNavSelRange = "{10661, 1179}";
sepNavVisRange = "{10661, 241}";
sepNavWindowFrame = "{{-4, 38}, {742, 840}}";
};
};
8BA05A690720730100365D66 /* Dynamics3Version.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 1062}}";
sepNavSelRange = "{2907, 0}";
sepNavVisRange = "{1699, 1271}";
sepNavWindowFrame = "{{15, 192}, {826, 681}}";
};
};
8BA05A7F072073D200365D66 /* AUBase.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {516, 23430}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{0, 1336}";
};
};
8BC6025B073B072D006C4272 /* Dynamics3.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 2826}}";
sepNavSelRange = "{5073, 237}";
sepNavVisRange = "{4431, 1012}";
sepNavWindowFrame = "{{-5, 58}, {565, 799}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
repositoryNamesForRoots = {
"" = "";
};
};
};
8BD3CCB9148830B20062E48C /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8D01CCC60486CAD60068D4B7 /* Dynamics3 */ = {
activeExec = 0;
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,490 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
3EEA126E089847F5002C6BFC /* CAVectorUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EEA126B089847F5002C6BFC /* CAVectorUnit.cpp */; };
3EEA126F089847F5002C6BFC /* CAVectorUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EEA126C089847F5002C6BFC /* CAVectorUnit.h */; };
3EEA1270089847F5002C6BFC /* CAVectorUnitTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EEA126D089847F5002C6BFC /* CAVectorUnitTypes.h */; };
8B4119B70749654200361ABE /* Dynamics3.r in Rez */ = {isa = PBXBuildFile; fileRef = 8BA05A680720730100365D66 /* Dynamics3.r */; };
8BA05A6B0720730100365D66 /* Dynamics3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A660720730100365D66 /* Dynamics3.cpp */; };
8BA05A6E0720730100365D66 /* Dynamics3Version.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A690720730100365D66 /* Dynamics3Version.h */; };
8BA05AAE072073D300365D66 /* AUBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A7F072073D200365D66 /* AUBase.cpp */; };
8BA05AAF072073D300365D66 /* AUBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A80072073D200365D66 /* AUBase.h */; };
8BA05AB0072073D300365D66 /* AUDispatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A81072073D200365D66 /* AUDispatch.cpp */; };
8BA05AB1072073D300365D66 /* AUDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A82072073D200365D66 /* AUDispatch.h */; };
8BA05AB2072073D300365D66 /* AUInputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A83072073D200365D66 /* AUInputElement.cpp */; };
8BA05AB3072073D300365D66 /* AUInputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A84072073D200365D66 /* AUInputElement.h */; };
8BA05AB4072073D300365D66 /* AUOutputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A85072073D200365D66 /* AUOutputElement.cpp */; };
8BA05AB5072073D300365D66 /* AUOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A86072073D200365D66 /* AUOutputElement.h */; };
8BA05AB7072073D300365D66 /* AUScopeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A88072073D200365D66 /* AUScopeElement.cpp */; };
8BA05AB8072073D300365D66 /* AUScopeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A89072073D200365D66 /* AUScopeElement.h */; };
8BA05AB9072073D300365D66 /* ComponentBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A8A072073D200365D66 /* ComponentBase.cpp */; };
8BA05ABA072073D300365D66 /* ComponentBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A8B072073D200365D66 /* ComponentBase.h */; };
8BA05AC6072073D300365D66 /* AUEffectBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A9A072073D200365D66 /* AUEffectBase.cpp */; };
8BA05AC7072073D300365D66 /* AUEffectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A9B072073D200365D66 /* AUEffectBase.h */; };
8BA05AD2072073D300365D66 /* AUBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AA7072073D200365D66 /* AUBuffer.cpp */; };
8BA05AD3072073D300365D66 /* AUBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AA8072073D200365D66 /* AUBuffer.h */; };
8BA05AD4072073D300365D66 /* AUDebugDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AA9072073D200365D66 /* AUDebugDispatcher.cpp */; };
8BA05AD5072073D300365D66 /* AUDebugDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAA072073D200365D66 /* AUDebugDispatcher.h */; };
8BA05AD6072073D300365D66 /* AUInputFormatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAB072073D200365D66 /* AUInputFormatConverter.h */; };
8BA05AD7072073D300365D66 /* AUSilentTimeout.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAC072073D200365D66 /* AUSilentTimeout.h */; };
8BA05AD8072073D300365D66 /* AUTimestampGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAD072073D200365D66 /* AUTimestampGenerator.h */; };
8BA05AE50720742100365D66 /* CAAudioChannelLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05ADF0720742100365D66 /* CAAudioChannelLayout.cpp */; };
8BA05AE60720742100365D66 /* CAAudioChannelLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AE00720742100365D66 /* CAAudioChannelLayout.h */; };
8BA05AE70720742100365D66 /* CAMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AE10720742100365D66 /* CAMutex.cpp */; };
8BA05AE80720742100365D66 /* CAMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AE20720742100365D66 /* CAMutex.h */; };
8BA05AE90720742100365D66 /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AE30720742100365D66 /* CAStreamBasicDescription.cpp */; };
8BA05AEA0720742100365D66 /* CAStreamBasicDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AE40720742100365D66 /* CAStreamBasicDescription.h */; };
8BA05AFC072074E100365D66 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BA05AF9072074E100365D66 /* AudioToolbox.framework */; };
8BA05AFD072074E100365D66 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BA05AFA072074E100365D66 /* AudioUnit.framework */; };
8BA05B02072074F900365D66 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BA05B01072074F900365D66 /* CoreServices.framework */; };
8BA05B070720754400365D66 /* CAAUParameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05B050720754400365D66 /* CAAUParameter.cpp */; };
8BA05B080720754400365D66 /* CAAUParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05B060720754400365D66 /* CAAUParameter.h */; };
8BC6025C073B072D006C4272 /* Dynamics3.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BC6025B073B072D006C4272 /* Dynamics3.h */; };
8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
F7C347F00ECE5AF8008ADFB6 /* AUBaseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7C347EE0ECE5AF8008ADFB6 /* AUBaseHelper.cpp */; };
F7C347F10ECE5AF8008ADFB6 /* AUBaseHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F7C347EF0ECE5AF8008ADFB6 /* AUBaseHelper.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3EEA126B089847F5002C6BFC /* CAVectorUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAVectorUnit.cpp; sourceTree = "<group>"; };
3EEA126C089847F5002C6BFC /* CAVectorUnit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAVectorUnit.h; sourceTree = "<group>"; };
3EEA126D089847F5002C6BFC /* CAVectorUnitTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAVectorUnitTypes.h; sourceTree = "<group>"; };
8B5C7FBF076FB2C200A15F61 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
8BA05A660720730100365D66 /* Dynamics3.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Dynamics3.cpp; sourceTree = "<group>"; };
8BA05A670720730100365D66 /* Dynamics3.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = Dynamics3.exp; sourceTree = "<group>"; };
8BA05A680720730100365D66 /* Dynamics3.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = Dynamics3.r; sourceTree = "<group>"; };
8BA05A690720730100365D66 /* Dynamics3Version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Dynamics3Version.h; sourceTree = "<group>"; };
8BA05A7F072073D200365D66 /* AUBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUBase.cpp; sourceTree = "<group>"; };
8BA05A80072073D200365D66 /* AUBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUBase.h; sourceTree = "<group>"; };
8BA05A81072073D200365D66 /* AUDispatch.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUDispatch.cpp; sourceTree = "<group>"; };
8BA05A82072073D200365D66 /* AUDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUDispatch.h; sourceTree = "<group>"; };
8BA05A83072073D200365D66 /* AUInputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUInputElement.cpp; sourceTree = "<group>"; };
8BA05A84072073D200365D66 /* AUInputElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUInputElement.h; sourceTree = "<group>"; };
8BA05A85072073D200365D66 /* AUOutputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUOutputElement.cpp; sourceTree = "<group>"; };
8BA05A86072073D200365D66 /* AUOutputElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUOutputElement.h; sourceTree = "<group>"; };
8BA05A87072073D200365D66 /* AUResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = AUResources.r; sourceTree = "<group>"; };
8BA05A88072073D200365D66 /* AUScopeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUScopeElement.cpp; sourceTree = "<group>"; };
8BA05A89072073D200365D66 /* AUScopeElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUScopeElement.h; sourceTree = "<group>"; };
8BA05A8A072073D200365D66 /* ComponentBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ComponentBase.cpp; sourceTree = "<group>"; };
8BA05A8B072073D200365D66 /* ComponentBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ComponentBase.h; sourceTree = "<group>"; };
8BA05A9A072073D200365D66 /* AUEffectBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUEffectBase.cpp; sourceTree = "<group>"; };
8BA05A9B072073D200365D66 /* AUEffectBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUEffectBase.h; sourceTree = "<group>"; };
8BA05AA7072073D200365D66 /* AUBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUBuffer.cpp; sourceTree = "<group>"; };
8BA05AA8072073D200365D66 /* AUBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUBuffer.h; sourceTree = "<group>"; };
8BA05AA9072073D200365D66 /* AUDebugDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUDebugDispatcher.cpp; sourceTree = "<group>"; };
8BA05AAA072073D200365D66 /* AUDebugDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUDebugDispatcher.h; sourceTree = "<group>"; };
8BA05AAB072073D200365D66 /* AUInputFormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUInputFormatConverter.h; sourceTree = "<group>"; };
8BA05AAC072073D200365D66 /* AUSilentTimeout.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUSilentTimeout.h; sourceTree = "<group>"; };
8BA05AAD072073D200365D66 /* AUTimestampGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUTimestampGenerator.h; sourceTree = "<group>"; };
8BA05ADF0720742100365D66 /* CAAudioChannelLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAAudioChannelLayout.cpp; sourceTree = "<group>"; };
8BA05AE00720742100365D66 /* CAAudioChannelLayout.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAAudioChannelLayout.h; sourceTree = "<group>"; };
8BA05AE10720742100365D66 /* CAMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAMutex.cpp; sourceTree = "<group>"; };
8BA05AE20720742100365D66 /* CAMutex.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAMutex.h; sourceTree = "<group>"; };
8BA05AE30720742100365D66 /* CAStreamBasicDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAStreamBasicDescription.cpp; sourceTree = "<group>"; };
8BA05AE40720742100365D66 /* CAStreamBasicDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAStreamBasicDescription.h; sourceTree = "<group>"; };
8BA05AF9072074E100365D66 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
8BA05AFA072074E100365D66 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
8BA05B01072074F900365D66 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
8BA05B050720754400365D66 /* CAAUParameter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAAUParameter.cpp; sourceTree = "<group>"; };
8BA05B060720754400365D66 /* CAAUParameter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAAUParameter.h; sourceTree = "<group>"; };
8BC6025B073B072D006C4272 /* Dynamics3.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Dynamics3.h; sourceTree = "<group>"; };
8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D01CCD20486CAD60068D4B7 /* Dynamics3.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dynamics3.component; sourceTree = BUILT_PRODUCTS_DIR; };
F7C347EE0ECE5AF8008ADFB6 /* AUBaseHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AUBaseHelper.cpp; path = Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
F7C347EF0ECE5AF8008ADFB6 /* AUBaseHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AUBaseHelper.h; path = Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h; sourceTree = SYSTEM_DEVELOPER_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D01CCCD0486CAD60068D4B7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8BA05AFC072074E100365D66 /* AudioToolbox.framework in Frameworks */,
8BA05AFD072074E100365D66 /* AudioUnit.framework in Frameworks */,
8BA05B02072074F900365D66 /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
089C166AFE841209C02AAC07 /* Dynamics3 */ = {
isa = PBXGroup;
children = (
08FB77ADFE841716C02AAC07 /* Source */,
089C167CFE841241C02AAC07 /* Resources */,
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
19C28FB4FE9D528D11CA2CBB /* Products */,
);
name = Dynamics3;
sourceTree = "<group>";
};
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
8B5C7FBF076FB2C200A15F61 /* CoreAudio.framework */,
8BA05B01072074F900365D66 /* CoreServices.framework */,
8BA05AF9072074E100365D66 /* AudioToolbox.framework */,
8BA05AFA072074E100365D66 /* AudioUnit.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8D01CCD10486CAD60068D4B7 /* Info.plist */,
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
08FB77ADFE841716C02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
8BA05A56072072A900365D66 /* AU Source */,
8BA05AEB0720742700365D66 /* PublicUtility */,
8BA05A7D072073D200365D66 /* AUPublic */,
);
name = Source;
sourceTree = "<group>";
};
19C28FB4FE9D528D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D01CCD20486CAD60068D4B7 /* Dynamics3.component */,
);
name = Products;
sourceTree = "<group>";
};
8BA05A56072072A900365D66 /* AU Source */ = {
isa = PBXGroup;
children = (
8BC6025B073B072D006C4272 /* Dynamics3.h */,
8BA05A660720730100365D66 /* Dynamics3.cpp */,
8BA05A670720730100365D66 /* Dynamics3.exp */,
8BA05A680720730100365D66 /* Dynamics3.r */,
8BA05A690720730100365D66 /* Dynamics3Version.h */,
);
name = "AU Source";
sourceTree = "<group>";
};
8BA05A7D072073D200365D66 /* AUPublic */ = {
isa = PBXGroup;
children = (
8BA05A7E072073D200365D66 /* AUBase */,
8BA05A99072073D200365D66 /* OtherBases */,
8BA05AA6072073D200365D66 /* Utility */,
);
name = AUPublic;
path = Extras/CoreAudio/AudioUnits/AUPublic;
sourceTree = SYSTEM_DEVELOPER_DIR;
};
8BA05A7E072073D200365D66 /* AUBase */ = {
isa = PBXGroup;
children = (
8BA05A7F072073D200365D66 /* AUBase.cpp */,
8BA05A80072073D200365D66 /* AUBase.h */,
8BA05A81072073D200365D66 /* AUDispatch.cpp */,
8BA05A82072073D200365D66 /* AUDispatch.h */,
8BA05A83072073D200365D66 /* AUInputElement.cpp */,
8BA05A84072073D200365D66 /* AUInputElement.h */,
8BA05A85072073D200365D66 /* AUOutputElement.cpp */,
8BA05A86072073D200365D66 /* AUOutputElement.h */,
8BA05A87072073D200365D66 /* AUResources.r */,
8BA05A88072073D200365D66 /* AUScopeElement.cpp */,
8BA05A89072073D200365D66 /* AUScopeElement.h */,
8BA05A8A072073D200365D66 /* ComponentBase.cpp */,
8BA05A8B072073D200365D66 /* ComponentBase.h */,
);
path = AUBase;
sourceTree = "<group>";
};
8BA05A99072073D200365D66 /* OtherBases */ = {
isa = PBXGroup;
children = (
8BA05A9A072073D200365D66 /* AUEffectBase.cpp */,
8BA05A9B072073D200365D66 /* AUEffectBase.h */,
);
path = OtherBases;
sourceTree = "<group>";
};
8BA05AA6072073D200365D66 /* Utility */ = {
isa = PBXGroup;
children = (
F7C347EE0ECE5AF8008ADFB6 /* AUBaseHelper.cpp */,
F7C347EF0ECE5AF8008ADFB6 /* AUBaseHelper.h */,
8BA05AA7072073D200365D66 /* AUBuffer.cpp */,
8BA05AA8072073D200365D66 /* AUBuffer.h */,
8BA05AA9072073D200365D66 /* AUDebugDispatcher.cpp */,
8BA05AAA072073D200365D66 /* AUDebugDispatcher.h */,
8BA05AAB072073D200365D66 /* AUInputFormatConverter.h */,
8BA05AAC072073D200365D66 /* AUSilentTimeout.h */,
8BA05AAD072073D200365D66 /* AUTimestampGenerator.h */,
);
path = Utility;
sourceTree = "<group>";
};
8BA05AEB0720742700365D66 /* PublicUtility */ = {
isa = PBXGroup;
children = (
8BA05B050720754400365D66 /* CAAUParameter.cpp */,
8BA05B060720754400365D66 /* CAAUParameter.h */,
8BA05ADF0720742100365D66 /* CAAudioChannelLayout.cpp */,
8BA05AE00720742100365D66 /* CAAudioChannelLayout.h */,
8BA05AE10720742100365D66 /* CAMutex.cpp */,
8BA05AE20720742100365D66 /* CAMutex.h */,
8BA05AE30720742100365D66 /* CAStreamBasicDescription.cpp */,
8BA05AE40720742100365D66 /* CAStreamBasicDescription.h */,
3EEA126D089847F5002C6BFC /* CAVectorUnitTypes.h */,
3EEA126B089847F5002C6BFC /* CAVectorUnit.cpp */,
3EEA126C089847F5002C6BFC /* CAVectorUnit.h */,
);
name = PublicUtility;
path = Extras/CoreAudio/PublicUtility;
sourceTree = SYSTEM_DEVELOPER_DIR;
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8D01CCC70486CAD60068D4B7 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8BA05A6E0720730100365D66 /* Dynamics3Version.h in Headers */,
8BA05AAF072073D300365D66 /* AUBase.h in Headers */,
8BA05AB1072073D300365D66 /* AUDispatch.h in Headers */,
8BA05AB3072073D300365D66 /* AUInputElement.h in Headers */,
8BA05AB5072073D300365D66 /* AUOutputElement.h in Headers */,
8BA05AB8072073D300365D66 /* AUScopeElement.h in Headers */,
8BA05ABA072073D300365D66 /* ComponentBase.h in Headers */,
8BA05AC7072073D300365D66 /* AUEffectBase.h in Headers */,
8BA05AD3072073D300365D66 /* AUBuffer.h in Headers */,
8BA05AD5072073D300365D66 /* AUDebugDispatcher.h in Headers */,
8BA05AD6072073D300365D66 /* AUInputFormatConverter.h in Headers */,
8BA05AD7072073D300365D66 /* AUSilentTimeout.h in Headers */,
8BA05AD8072073D300365D66 /* AUTimestampGenerator.h in Headers */,
8BA05AE60720742100365D66 /* CAAudioChannelLayout.h in Headers */,
8BA05AE80720742100365D66 /* CAMutex.h in Headers */,
8BA05AEA0720742100365D66 /* CAStreamBasicDescription.h in Headers */,
8BA05B080720754400365D66 /* CAAUParameter.h in Headers */,
8BC6025C073B072D006C4272 /* Dynamics3.h in Headers */,
3EEA126F089847F5002C6BFC /* CAVectorUnit.h in Headers */,
3EEA1270089847F5002C6BFC /* CAVectorUnitTypes.h in Headers */,
F7C347F10ECE5AF8008ADFB6 /* AUBaseHelper.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8D01CCC60486CAD60068D4B7 /* Dynamics3 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3E4BA243089833B7007656EC /* Build configuration list for PBXNativeTarget "Dynamics3" */;
buildPhases = (
8D01CCC70486CAD60068D4B7 /* Headers */,
8D01CCC90486CAD60068D4B7 /* Resources */,
8D01CCCB0486CAD60068D4B7 /* Sources */,
8D01CCCD0486CAD60068D4B7 /* Frameworks */,
8D01CCCF0486CAD60068D4B7 /* Rez */,
);
buildRules = (
);
dependencies = (
);
name = Dynamics3;
productInstallPath = "$(HOME)/Library/Bundles";
productName = Dynamics3;
productReference = 8D01CCD20486CAD60068D4B7 /* Dynamics3.component */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 3E4BA247089833B7007656EC /* Build configuration list for PBXProject "Dynamics3" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 089C166AFE841209C02AAC07 /* Dynamics3 */;
projectDirPath = "";
projectRoot = "";
targets = (
8D01CCC60486CAD60068D4B7 /* Dynamics3 */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D01CCC90486CAD60068D4B7 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXRezBuildPhase section */
8D01CCCF0486CAD60068D4B7 /* Rez */ = {
isa = PBXRezBuildPhase;
buildActionMask = 2147483647;
files = (
8B4119B70749654200361ABE /* Dynamics3.r in Rez */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXRezBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D01CCCB0486CAD60068D4B7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8BA05A6B0720730100365D66 /* Dynamics3.cpp in Sources */,
8BA05AAE072073D300365D66 /* AUBase.cpp in Sources */,
8BA05AB0072073D300365D66 /* AUDispatch.cpp in Sources */,
8BA05AB2072073D300365D66 /* AUInputElement.cpp in Sources */,
8BA05AB4072073D300365D66 /* AUOutputElement.cpp in Sources */,
8BA05AB7072073D300365D66 /* AUScopeElement.cpp in Sources */,
8BA05AB9072073D300365D66 /* ComponentBase.cpp in Sources */,
8BA05AC6072073D300365D66 /* AUEffectBase.cpp in Sources */,
8BA05AD2072073D300365D66 /* AUBuffer.cpp in Sources */,
8BA05AD4072073D300365D66 /* AUDebugDispatcher.cpp in Sources */,
8BA05AE50720742100365D66 /* CAAudioChannelLayout.cpp in Sources */,
8BA05AE70720742100365D66 /* CAMutex.cpp in Sources */,
8BA05AE90720742100365D66 /* CAStreamBasicDescription.cpp in Sources */,
8BA05B070720754400365D66 /* CAAUParameter.cpp in Sources */,
3EEA126E089847F5002C6BFC /* CAVectorUnit.cpp in Sources */,
F7C347F00ECE5AF8008ADFB6 /* AUBaseHelper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C167EFE841241C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
3E4BA244089833B7007656EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
EXPORTED_SYMBOLS_FILE = Dynamics3.exp;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GENERATE_PKGINFO_FILE = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Audio/Plug-Ins/Components/";
LIBRARY_STYLE = Bundle;
OTHER_LDFLAGS = "-bundle";
OTHER_REZFLAGS = "-d ppc_$ppc -d i386_$i386 -d ppc64_$ppc64 -d x86_64_$x86_64 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I \"$(DEVELOPER_DIR)/Examples/CoreAudio/AudioUnits/AUPublic/AUBase\"";
PRODUCT_NAME = Dynamics3;
WRAPPER_EXTENSION = component;
};
name = Debug;
};
3E4BA245089833B7007656EC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
x86_64,
);
EXPORTED_SYMBOLS_FILE = Dynamics3.exp;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GENERATE_PKGINFO_FILE = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Audio/Plug-Ins/Components/";
LIBRARY_STYLE = Bundle;
MACOSX_DEPLOYMENT_TARGET = 10.4;
OTHER_LDFLAGS = "-bundle";
OTHER_REZFLAGS = "-d ppc_$ppc -d i386_$i386 -d x86_64_$x86_64 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I \"$(DEVELOPER_DIR)/Examples/CoreAudio/AudioUnits/AUPublic/AUBase\"";
PRODUCT_NAME = Dynamics3;
SDKROOT = macosx10.5;
STRIP_INSTALLED_PRODUCT = YES;
STRIP_STYLE = all;
WRAPPER_EXTENSION = component;
};
name = Release;
};
3E4BA248089833B7007656EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = c99;
SDKROOT = macosx10.6;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
};
name = Debug;
};
3E4BA249089833B7007656EC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = c99;
SDKROOT = macosx10.6;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
3E4BA243089833B7007656EC /* Build configuration list for PBXNativeTarget "Dynamics3" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E4BA244089833B7007656EC /* Debug */,
3E4BA245089833B7007656EC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
3E4BA247089833B7007656EC /* Build configuration list for PBXProject "Dynamics3" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E4BA248089833B7007656EC /* Debug */,
3E4BA249089833B7007656EC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
}

View file

@ -0,0 +1,58 @@
/*
* File: Dynamics3Version.h
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __Dynamics3Version_h__
#define __Dynamics3Version_h__
#ifdef DEBUG
#define kDynamics3Version 0xFFFFFFFF
#else
#define kDynamics3Version 0x00010000
#endif
//~~~~~~~~~~~~~~ Change!!! ~~~~~~~~~~~~~~~~~~~~~//
#define Dynamics3_COMP_MANF 'Dthr'
#define Dynamics3_COMP_SUBTYPE 'dyn3'
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
#endif

Binary file not shown.

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.airwindows.audiounit.${PRODUCT_NAME:identifier}</string>
<key>CFBundleName</key>
<string>${PROJECTNAMEASIDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>Dthr</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,5 @@
//
// Prefix header for all source files of the '«PROJECTNAMEASIDENTIFIER»' target in the '«PROJECTNAMEASIDENTIFIER»' project.
//
#include <CoreServices/CoreServices.h>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildVersion</key>
<string>3</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>ProjectName</key>
<string>${EXECUTABLE_NAME}</string>
<key>SourceVersion</key>
<string>590000</string>
</dict>
</plist>

View file

@ -0,0 +1,258 @@
/*
* File: Dynamics3Mono.cpp
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*=============================================================================
Dynamics3Mono.cpp
=============================================================================*/
#include "Dynamics3Mono.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
COMPONENT_ENTRY(Dynamics3Mono)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::Dynamics3Mono
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dynamics3Mono::Dynamics3Mono(AudioUnit component)
: AUEffectBase(component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::GetParameterValueStrings
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3Mono::GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings)
{
return kAudioUnitErr_InvalidProperty;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::GetParameterInfo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3Mono::GetParameterInfo(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
AudioUnitParameterInfo &outParameterInfo )
{
ComponentResult result = noErr;
outParameterInfo.flags = kAudioUnitParameterFlag_IsWritable
| kAudioUnitParameterFlag_IsReadable;
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
break;
}
} else {
result = kAudioUnitErr_InvalidParameter;
}
return result;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::GetPropertyInfo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3Mono::GetPropertyInfo (AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
UInt32 & outDataSize,
Boolean & outWritable)
{
return AUEffectBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::GetProperty
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3Mono::GetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData )
{
return AUEffectBase::GetProperty (inID, inScope, inElement, outData);
}
// Dynamics3Mono::Initialize
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3Mono::Initialize()
{
ComponentResult result = AUEffectBase::Initialize();
if (result == noErr)
Reset(kAudioUnitScope_Global, 0);
return result;
}
#pragma mark ____Dynamics3MonoEffectKernel
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::Dynamics3MonoKernel::Reset()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void Dynamics3Mono::Dynamics3MonoKernel::Reset()
{
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
fpd = 1.0; while (fpd < 16386) fpd = rand()*UINT32_MAX;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3Mono::Dynamics3MonoKernel::Process
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void Dynamics3Mono::Dynamics3MonoKernel::Process( const Float32 *inSourceP,
Float32 *inDestP,
UInt32 inFramesToProcess,
UInt32 inNumChannels,
bool &ioSilence )
{
UInt32 nSampleFrames = inFramesToProcess;
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= GetSampleRate();
double bezThresh = pow(1.0-GetParameter( kParam_A ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_B ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_C ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_D ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
sloRez = fmin(fmax(sloRez,0.0001),1.0);
while (nSampleFrames-- > 0) {
double inputSample = *sourceP;
if (fabs(inputSample)<1.18e-23) inputSample = fpd * 1.18e-17;
if (fabs(inputSample) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (bezThresh > 0.0) {
inputSample *= (bezThresh+1.0);
}
double ctrl = fabs(inputSample);
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
if (bezThresh > 0.0) inputSample *= 1.0-(fmin(CBA*bezThresh,1.0));
//begin 32 bit floating point dither
int expon; frexpf((float)inputSample, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSample += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit floating point dither
*destP = inputSample;
sourceP += inNumChannels; destP += inNumChannels;
}
}

View file

@ -0,0 +1 @@
_Dynamics3MonoEntry

View file

@ -0,0 +1,156 @@
/*
* File: Dynamics3Mono.h
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "AUEffectBase.h"
#include "Dynamics3MonoVersion.h"
#if AU_DEBUG_DISPATCHER
#include "AUDebugDispatcher.h"
#endif
#ifndef __Dynamics3Mono_h__
#define __Dynamics3Mono_h__
#pragma mark ____Dynamics3Mono Parameters
// parameters
static const float kDefaultValue_ParamA = 1.0;
static const float kDefaultValue_ParamB = 0.5;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.0;
static CFStringRef kParameterAName = CFSTR("Thresh");
static CFStringRef kParameterBName = CFSTR("Attack");
static CFStringRef kParameterCName = CFSTR("Release");
static CFStringRef kParameterDName = CFSTR("Gate");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
//Add your parameters here...
kNumberOfParameters=4
};
#pragma mark ____Dynamics3Mono
class Dynamics3Mono : public AUEffectBase
{
public:
Dynamics3Mono(AudioUnit component);
#if AU_DEBUG_DISPATCHER
virtual ~Dynamics3Mono () { delete mDebugDispatcher; }
#endif
virtual AUKernelBase * NewKernel() { return new Dynamics3MonoKernel(this); }
virtual ComponentResult GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings);
virtual ComponentResult GetParameterInfo(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
AudioUnitParameterInfo &outParameterInfo);
virtual ComponentResult GetPropertyInfo(AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
UInt32 & outDataSize,
Boolean & outWritable );
virtual ComponentResult GetProperty(AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData);
virtual ComponentResult Initialize();
virtual bool SupportsTail () { return true; }
virtual Float64 GetTailTime() {return (1.0/GetSampleRate())*0.0;} //in SECONDS! gsr * a number = in samples
virtual Float64 GetLatency() {return (1.0/GetSampleRate())*0.0;} // in SECONDS! gsr * a number = in samples
/*! @method Version */
virtual ComponentResult Version() { return kDynamics3MonoVersion; }
protected:
class Dynamics3MonoKernel : public AUKernelBase // most of the real work happens here
{
public:
Dynamics3MonoKernel(AUEffectBase *inAudioUnit )
: AUKernelBase(inAudioUnit)
{
}
// *Required* overides for the process method for this effect
// processes one channel of interleaved samples
virtual void Process( const Float32 *inSourceP,
Float32 *inDestP,
UInt32 inFramesToProcess,
UInt32 inNumChannels,
bool &ioSilence);
virtual void Reset();
private:
enum {
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
uint32_t fpd;
};
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#endif

View file

@ -0,0 +1,61 @@
/*
* File: Dynamics3Mono.r
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <AudioUnit/AudioUnit.r>
#include "Dynamics3MonoVersion.h"
// Note that resource IDs must be spaced 2 apart for the 'STR ' name and description
#define kAudioUnitResID_Dynamics3Mono 1000
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dynamics3Mono~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define RES_ID kAudioUnitResID_Dynamics3Mono
#define COMP_TYPE kAudioUnitType_Effect
#define COMP_SUBTYPE Dynamics3Mono_COMP_SUBTYPE
#define COMP_MANUF Dynamics3Mono_COMP_MANF
#define VERSION kDynamics3MonoVersion
#define NAME "Airwindows: Dynamics3Mono"
#define DESCRIPTION "Dynamics3Mono AU"
#define ENTRY_POINT "Dynamics3MonoEntry"
#include "AUResources.r"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,137 @@
// !$*UTF8*$!
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
activeTarget = 8D01CCC60486CAD60068D4B7 /* Dynamics3Mono */;
codeSenseManager = 8BD3CCB9148830B20062E48C /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
128,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
252,
60,
20,
48,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 786890841;
PBXWorkspaceStateSaveDate = 786890841;
};
perUserProjectItems = {
8B5AAF022EE6F6D100A3F512 /* PlistBookmark */ = 8B5AAF022EE6F6D100A3F512 /* PlistBookmark */;
8B5AAF2B2EE6FA8800A3F512 /* PBXTextBookmark */ = 8B5AAF2B2EE6FA8800A3F512 /* PBXTextBookmark */;
8B5AAF4A2EE700FF00A3F512 /* PBXTextBookmark */ = 8B5AAF4A2EE700FF00A3F512 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B5AAF022EE6F6D100A3F512 /* PlistBookmark */ = {
isa = PlistBookmark;
fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */;
fallbackIsa = PBXBookmark;
isK = 0;
kPath = (
CFBundleName,
);
name = /Users/christopherjohnson/Desktop/Dynamics3Mono/Info.plist;
rLen = 0;
rLoc = 9223372036854775808;
};
8B5AAF2B2EE6FA8800A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* Dynamics3Mono.h */;
name = "Dynamics3Mono.h: 146";
rLen = 0;
rLoc = 5621;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8B5AAF4A2EE700FF00A3F512 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* Dynamics3Mono.h */;
name = "Dynamics3Mono.h: 146";
rLen = 0;
rLoc = 5621;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8BA05A660720730100365D66 /* Dynamics3Mono.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {894, 4824}}";
sepNavSelRange = "{10055, 138}";
sepNavVisRange = "{9517, 1479}";
sepNavWindowFrame = "{{550, 45}, {890, 833}}";
};
};
8BA05A690720730100365D66 /* Dynamics3MonoVersion.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 1062}}";
sepNavSelRange = "{2935, 0}";
sepNavVisRange = "{1372, 1626}";
sepNavWindowFrame = "{{84, 39}, {828, 771}}";
};
};
8BC6025B073B072D006C4272 /* Dynamics3Mono.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {318, 2844}}";
sepNavSelRange = "{5621, 0}";
sepNavVisRange = "{0, 0}";
sepNavWindowFrame = "{{612, 86}, {828, 771}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
repositoryNamesForRoots = {
"" = "";
};
};
};
8BD3CCB9148830B20062E48C /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8D01CCC60486CAD60068D4B7 /* Dynamics3Mono */ = {
activeExec = 0;
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,490 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
3EEA126E089847F5002C6BFC /* CAVectorUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EEA126B089847F5002C6BFC /* CAVectorUnit.cpp */; };
3EEA126F089847F5002C6BFC /* CAVectorUnit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EEA126C089847F5002C6BFC /* CAVectorUnit.h */; };
3EEA1270089847F5002C6BFC /* CAVectorUnitTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3EEA126D089847F5002C6BFC /* CAVectorUnitTypes.h */; };
8B4119B70749654200361ABE /* Dynamics3Mono.r in Rez */ = {isa = PBXBuildFile; fileRef = 8BA05A680720730100365D66 /* Dynamics3Mono.r */; };
8BA05A6B0720730100365D66 /* Dynamics3Mono.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A660720730100365D66 /* Dynamics3Mono.cpp */; };
8BA05A6E0720730100365D66 /* Dynamics3MonoVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A690720730100365D66 /* Dynamics3MonoVersion.h */; };
8BA05AAE072073D300365D66 /* AUBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A7F072073D200365D66 /* AUBase.cpp */; };
8BA05AAF072073D300365D66 /* AUBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A80072073D200365D66 /* AUBase.h */; };
8BA05AB0072073D300365D66 /* AUDispatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A81072073D200365D66 /* AUDispatch.cpp */; };
8BA05AB1072073D300365D66 /* AUDispatch.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A82072073D200365D66 /* AUDispatch.h */; };
8BA05AB2072073D300365D66 /* AUInputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A83072073D200365D66 /* AUInputElement.cpp */; };
8BA05AB3072073D300365D66 /* AUInputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A84072073D200365D66 /* AUInputElement.h */; };
8BA05AB4072073D300365D66 /* AUOutputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A85072073D200365D66 /* AUOutputElement.cpp */; };
8BA05AB5072073D300365D66 /* AUOutputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A86072073D200365D66 /* AUOutputElement.h */; };
8BA05AB7072073D300365D66 /* AUScopeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A88072073D200365D66 /* AUScopeElement.cpp */; };
8BA05AB8072073D300365D66 /* AUScopeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A89072073D200365D66 /* AUScopeElement.h */; };
8BA05AB9072073D300365D66 /* ComponentBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A8A072073D200365D66 /* ComponentBase.cpp */; };
8BA05ABA072073D300365D66 /* ComponentBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A8B072073D200365D66 /* ComponentBase.h */; };
8BA05AC6072073D300365D66 /* AUEffectBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05A9A072073D200365D66 /* AUEffectBase.cpp */; };
8BA05AC7072073D300365D66 /* AUEffectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05A9B072073D200365D66 /* AUEffectBase.h */; };
8BA05AD2072073D300365D66 /* AUBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AA7072073D200365D66 /* AUBuffer.cpp */; };
8BA05AD3072073D300365D66 /* AUBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AA8072073D200365D66 /* AUBuffer.h */; };
8BA05AD4072073D300365D66 /* AUDebugDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AA9072073D200365D66 /* AUDebugDispatcher.cpp */; };
8BA05AD5072073D300365D66 /* AUDebugDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAA072073D200365D66 /* AUDebugDispatcher.h */; };
8BA05AD6072073D300365D66 /* AUInputFormatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAB072073D200365D66 /* AUInputFormatConverter.h */; };
8BA05AD7072073D300365D66 /* AUSilentTimeout.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAC072073D200365D66 /* AUSilentTimeout.h */; };
8BA05AD8072073D300365D66 /* AUTimestampGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AAD072073D200365D66 /* AUTimestampGenerator.h */; };
8BA05AE50720742100365D66 /* CAAudioChannelLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05ADF0720742100365D66 /* CAAudioChannelLayout.cpp */; };
8BA05AE60720742100365D66 /* CAAudioChannelLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AE00720742100365D66 /* CAAudioChannelLayout.h */; };
8BA05AE70720742100365D66 /* CAMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AE10720742100365D66 /* CAMutex.cpp */; };
8BA05AE80720742100365D66 /* CAMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AE20720742100365D66 /* CAMutex.h */; };
8BA05AE90720742100365D66 /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05AE30720742100365D66 /* CAStreamBasicDescription.cpp */; };
8BA05AEA0720742100365D66 /* CAStreamBasicDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05AE40720742100365D66 /* CAStreamBasicDescription.h */; };
8BA05AFC072074E100365D66 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BA05AF9072074E100365D66 /* AudioToolbox.framework */; };
8BA05AFD072074E100365D66 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BA05AFA072074E100365D66 /* AudioUnit.framework */; };
8BA05B02072074F900365D66 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BA05B01072074F900365D66 /* CoreServices.framework */; };
8BA05B070720754400365D66 /* CAAUParameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8BA05B050720754400365D66 /* CAAUParameter.cpp */; };
8BA05B080720754400365D66 /* CAAUParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BA05B060720754400365D66 /* CAAUParameter.h */; };
8BC6025C073B072D006C4272 /* Dynamics3Mono.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BC6025B073B072D006C4272 /* Dynamics3Mono.h */; };
8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
F7C347F00ECE5AF8008ADFB6 /* AUBaseHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7C347EE0ECE5AF8008ADFB6 /* AUBaseHelper.cpp */; };
F7C347F10ECE5AF8008ADFB6 /* AUBaseHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F7C347EF0ECE5AF8008ADFB6 /* AUBaseHelper.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
3EEA126B089847F5002C6BFC /* CAVectorUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAVectorUnit.cpp; sourceTree = "<group>"; };
3EEA126C089847F5002C6BFC /* CAVectorUnit.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAVectorUnit.h; sourceTree = "<group>"; };
3EEA126D089847F5002C6BFC /* CAVectorUnitTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAVectorUnitTypes.h; sourceTree = "<group>"; };
8B5C7FBF076FB2C200A15F61 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
8BA05A660720730100365D66 /* Dynamics3Mono.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Dynamics3Mono.cpp; sourceTree = "<group>"; };
8BA05A670720730100365D66 /* Dynamics3Mono.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = Dynamics3Mono.exp; sourceTree = "<group>"; };
8BA05A680720730100365D66 /* Dynamics3Mono.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = Dynamics3Mono.r; sourceTree = "<group>"; };
8BA05A690720730100365D66 /* Dynamics3MonoVersion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Dynamics3MonoVersion.h; sourceTree = "<group>"; };
8BA05A7F072073D200365D66 /* AUBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUBase.cpp; sourceTree = "<group>"; };
8BA05A80072073D200365D66 /* AUBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUBase.h; sourceTree = "<group>"; };
8BA05A81072073D200365D66 /* AUDispatch.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUDispatch.cpp; sourceTree = "<group>"; };
8BA05A82072073D200365D66 /* AUDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUDispatch.h; sourceTree = "<group>"; };
8BA05A83072073D200365D66 /* AUInputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUInputElement.cpp; sourceTree = "<group>"; };
8BA05A84072073D200365D66 /* AUInputElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUInputElement.h; sourceTree = "<group>"; };
8BA05A85072073D200365D66 /* AUOutputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUOutputElement.cpp; sourceTree = "<group>"; };
8BA05A86072073D200365D66 /* AUOutputElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUOutputElement.h; sourceTree = "<group>"; };
8BA05A87072073D200365D66 /* AUResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = AUResources.r; sourceTree = "<group>"; };
8BA05A88072073D200365D66 /* AUScopeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUScopeElement.cpp; sourceTree = "<group>"; };
8BA05A89072073D200365D66 /* AUScopeElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUScopeElement.h; sourceTree = "<group>"; };
8BA05A8A072073D200365D66 /* ComponentBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ComponentBase.cpp; sourceTree = "<group>"; };
8BA05A8B072073D200365D66 /* ComponentBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ComponentBase.h; sourceTree = "<group>"; };
8BA05A9A072073D200365D66 /* AUEffectBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUEffectBase.cpp; sourceTree = "<group>"; };
8BA05A9B072073D200365D66 /* AUEffectBase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUEffectBase.h; sourceTree = "<group>"; };
8BA05AA7072073D200365D66 /* AUBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUBuffer.cpp; sourceTree = "<group>"; };
8BA05AA8072073D200365D66 /* AUBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUBuffer.h; sourceTree = "<group>"; };
8BA05AA9072073D200365D66 /* AUDebugDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AUDebugDispatcher.cpp; sourceTree = "<group>"; };
8BA05AAA072073D200365D66 /* AUDebugDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUDebugDispatcher.h; sourceTree = "<group>"; };
8BA05AAB072073D200365D66 /* AUInputFormatConverter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUInputFormatConverter.h; sourceTree = "<group>"; };
8BA05AAC072073D200365D66 /* AUSilentTimeout.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUSilentTimeout.h; sourceTree = "<group>"; };
8BA05AAD072073D200365D66 /* AUTimestampGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AUTimestampGenerator.h; sourceTree = "<group>"; };
8BA05ADF0720742100365D66 /* CAAudioChannelLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAAudioChannelLayout.cpp; sourceTree = "<group>"; };
8BA05AE00720742100365D66 /* CAAudioChannelLayout.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAAudioChannelLayout.h; sourceTree = "<group>"; };
8BA05AE10720742100365D66 /* CAMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAMutex.cpp; sourceTree = "<group>"; };
8BA05AE20720742100365D66 /* CAMutex.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAMutex.h; sourceTree = "<group>"; };
8BA05AE30720742100365D66 /* CAStreamBasicDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAStreamBasicDescription.cpp; sourceTree = "<group>"; };
8BA05AE40720742100365D66 /* CAStreamBasicDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAStreamBasicDescription.h; sourceTree = "<group>"; };
8BA05AF9072074E100365D66 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
8BA05AFA072074E100365D66 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
8BA05B01072074F900365D66 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
8BA05B050720754400365D66 /* CAAUParameter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAAUParameter.cpp; sourceTree = "<group>"; };
8BA05B060720754400365D66 /* CAAUParameter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAAUParameter.h; sourceTree = "<group>"; };
8BC6025B073B072D006C4272 /* Dynamics3Mono.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Dynamics3Mono.h; sourceTree = "<group>"; };
8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D01CCD20486CAD60068D4B7 /* Dynamics3Mono.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dynamics3Mono.component; sourceTree = BUILT_PRODUCTS_DIR; };
F7C347EE0ECE5AF8008ADFB6 /* AUBaseHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AUBaseHelper.cpp; path = Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
F7C347EF0ECE5AF8008ADFB6 /* AUBaseHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AUBaseHelper.h; path = Extras/CoreAudio/AudioUnits/AUPublic/Utility/AUBaseHelper.h; sourceTree = SYSTEM_DEVELOPER_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D01CCCD0486CAD60068D4B7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8BA05AFC072074E100365D66 /* AudioToolbox.framework in Frameworks */,
8BA05AFD072074E100365D66 /* AudioUnit.framework in Frameworks */,
8BA05B02072074F900365D66 /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
089C166AFE841209C02AAC07 /* Dynamics3Mono */ = {
isa = PBXGroup;
children = (
08FB77ADFE841716C02AAC07 /* Source */,
089C167CFE841241C02AAC07 /* Resources */,
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
19C28FB4FE9D528D11CA2CBB /* Products */,
);
name = Dynamics3Mono;
sourceTree = "<group>";
};
089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
8B5C7FBF076FB2C200A15F61 /* CoreAudio.framework */,
8BA05B01072074F900365D66 /* CoreServices.framework */,
8BA05AF9072074E100365D66 /* AudioToolbox.framework */,
8BA05AFA072074E100365D66 /* AudioUnit.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
8D01CCD10486CAD60068D4B7 /* Info.plist */,
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
);
name = Resources;
sourceTree = "<group>";
};
08FB77ADFE841716C02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
8BA05A56072072A900365D66 /* AU Source */,
8BA05AEB0720742700365D66 /* PublicUtility */,
8BA05A7D072073D200365D66 /* AUPublic */,
);
name = Source;
sourceTree = "<group>";
};
19C28FB4FE9D528D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D01CCD20486CAD60068D4B7 /* Dynamics3Mono.component */,
);
name = Products;
sourceTree = "<group>";
};
8BA05A56072072A900365D66 /* AU Source */ = {
isa = PBXGroup;
children = (
8BC6025B073B072D006C4272 /* Dynamics3Mono.h */,
8BA05A660720730100365D66 /* Dynamics3Mono.cpp */,
8BA05A670720730100365D66 /* Dynamics3Mono.exp */,
8BA05A680720730100365D66 /* Dynamics3Mono.r */,
8BA05A690720730100365D66 /* Dynamics3MonoVersion.h */,
);
name = "AU Source";
sourceTree = "<group>";
};
8BA05A7D072073D200365D66 /* AUPublic */ = {
isa = PBXGroup;
children = (
8BA05A7E072073D200365D66 /* AUBase */,
8BA05A99072073D200365D66 /* OtherBases */,
8BA05AA6072073D200365D66 /* Utility */,
);
name = AUPublic;
path = Extras/CoreAudio/AudioUnits/AUPublic;
sourceTree = SYSTEM_DEVELOPER_DIR;
};
8BA05A7E072073D200365D66 /* AUBase */ = {
isa = PBXGroup;
children = (
8BA05A7F072073D200365D66 /* AUBase.cpp */,
8BA05A80072073D200365D66 /* AUBase.h */,
8BA05A81072073D200365D66 /* AUDispatch.cpp */,
8BA05A82072073D200365D66 /* AUDispatch.h */,
8BA05A83072073D200365D66 /* AUInputElement.cpp */,
8BA05A84072073D200365D66 /* AUInputElement.h */,
8BA05A85072073D200365D66 /* AUOutputElement.cpp */,
8BA05A86072073D200365D66 /* AUOutputElement.h */,
8BA05A87072073D200365D66 /* AUResources.r */,
8BA05A88072073D200365D66 /* AUScopeElement.cpp */,
8BA05A89072073D200365D66 /* AUScopeElement.h */,
8BA05A8A072073D200365D66 /* ComponentBase.cpp */,
8BA05A8B072073D200365D66 /* ComponentBase.h */,
);
path = AUBase;
sourceTree = "<group>";
};
8BA05A99072073D200365D66 /* OtherBases */ = {
isa = PBXGroup;
children = (
8BA05A9A072073D200365D66 /* AUEffectBase.cpp */,
8BA05A9B072073D200365D66 /* AUEffectBase.h */,
);
path = OtherBases;
sourceTree = "<group>";
};
8BA05AA6072073D200365D66 /* Utility */ = {
isa = PBXGroup;
children = (
F7C347EE0ECE5AF8008ADFB6 /* AUBaseHelper.cpp */,
F7C347EF0ECE5AF8008ADFB6 /* AUBaseHelper.h */,
8BA05AA7072073D200365D66 /* AUBuffer.cpp */,
8BA05AA8072073D200365D66 /* AUBuffer.h */,
8BA05AA9072073D200365D66 /* AUDebugDispatcher.cpp */,
8BA05AAA072073D200365D66 /* AUDebugDispatcher.h */,
8BA05AAB072073D200365D66 /* AUInputFormatConverter.h */,
8BA05AAC072073D200365D66 /* AUSilentTimeout.h */,
8BA05AAD072073D200365D66 /* AUTimestampGenerator.h */,
);
path = Utility;
sourceTree = "<group>";
};
8BA05AEB0720742700365D66 /* PublicUtility */ = {
isa = PBXGroup;
children = (
8BA05B050720754400365D66 /* CAAUParameter.cpp */,
8BA05B060720754400365D66 /* CAAUParameter.h */,
8BA05ADF0720742100365D66 /* CAAudioChannelLayout.cpp */,
8BA05AE00720742100365D66 /* CAAudioChannelLayout.h */,
8BA05AE10720742100365D66 /* CAMutex.cpp */,
8BA05AE20720742100365D66 /* CAMutex.h */,
8BA05AE30720742100365D66 /* CAStreamBasicDescription.cpp */,
8BA05AE40720742100365D66 /* CAStreamBasicDescription.h */,
3EEA126D089847F5002C6BFC /* CAVectorUnitTypes.h */,
3EEA126B089847F5002C6BFC /* CAVectorUnit.cpp */,
3EEA126C089847F5002C6BFC /* CAVectorUnit.h */,
);
name = PublicUtility;
path = Extras/CoreAudio/PublicUtility;
sourceTree = SYSTEM_DEVELOPER_DIR;
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
8D01CCC70486CAD60068D4B7 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8BA05A6E0720730100365D66 /* Dynamics3MonoVersion.h in Headers */,
8BA05AAF072073D300365D66 /* AUBase.h in Headers */,
8BA05AB1072073D300365D66 /* AUDispatch.h in Headers */,
8BA05AB3072073D300365D66 /* AUInputElement.h in Headers */,
8BA05AB5072073D300365D66 /* AUOutputElement.h in Headers */,
8BA05AB8072073D300365D66 /* AUScopeElement.h in Headers */,
8BA05ABA072073D300365D66 /* ComponentBase.h in Headers */,
8BA05AC7072073D300365D66 /* AUEffectBase.h in Headers */,
8BA05AD3072073D300365D66 /* AUBuffer.h in Headers */,
8BA05AD5072073D300365D66 /* AUDebugDispatcher.h in Headers */,
8BA05AD6072073D300365D66 /* AUInputFormatConverter.h in Headers */,
8BA05AD7072073D300365D66 /* AUSilentTimeout.h in Headers */,
8BA05AD8072073D300365D66 /* AUTimestampGenerator.h in Headers */,
8BA05AE60720742100365D66 /* CAAudioChannelLayout.h in Headers */,
8BA05AE80720742100365D66 /* CAMutex.h in Headers */,
8BA05AEA0720742100365D66 /* CAStreamBasicDescription.h in Headers */,
8BA05B080720754400365D66 /* CAAUParameter.h in Headers */,
8BC6025C073B072D006C4272 /* Dynamics3Mono.h in Headers */,
3EEA126F089847F5002C6BFC /* CAVectorUnit.h in Headers */,
3EEA1270089847F5002C6BFC /* CAVectorUnitTypes.h in Headers */,
F7C347F10ECE5AF8008ADFB6 /* AUBaseHelper.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8D01CCC60486CAD60068D4B7 /* Dynamics3Mono */ = {
isa = PBXNativeTarget;
buildConfigurationList = 3E4BA243089833B7007656EC /* Build configuration list for PBXNativeTarget "Dynamics3Mono" */;
buildPhases = (
8D01CCC70486CAD60068D4B7 /* Headers */,
8D01CCC90486CAD60068D4B7 /* Resources */,
8D01CCCB0486CAD60068D4B7 /* Sources */,
8D01CCCD0486CAD60068D4B7 /* Frameworks */,
8D01CCCF0486CAD60068D4B7 /* Rez */,
);
buildRules = (
);
dependencies = (
);
name = Dynamics3Mono;
productInstallPath = "$(HOME)/Library/Bundles";
productName = Dynamics3Mono;
productReference = 8D01CCD20486CAD60068D4B7 /* Dynamics3Mono.component */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 3E4BA247089833B7007656EC /* Build configuration list for PBXProject "Dynamics3Mono" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 089C166AFE841209C02AAC07 /* Dynamics3Mono */;
projectDirPath = "";
projectRoot = "";
targets = (
8D01CCC60486CAD60068D4B7 /* Dynamics3Mono */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D01CCC90486CAD60068D4B7 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXRezBuildPhase section */
8D01CCCF0486CAD60068D4B7 /* Rez */ = {
isa = PBXRezBuildPhase;
buildActionMask = 2147483647;
files = (
8B4119B70749654200361ABE /* Dynamics3Mono.r in Rez */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXRezBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D01CCCB0486CAD60068D4B7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8BA05A6B0720730100365D66 /* Dynamics3Mono.cpp in Sources */,
8BA05AAE072073D300365D66 /* AUBase.cpp in Sources */,
8BA05AB0072073D300365D66 /* AUDispatch.cpp in Sources */,
8BA05AB2072073D300365D66 /* AUInputElement.cpp in Sources */,
8BA05AB4072073D300365D66 /* AUOutputElement.cpp in Sources */,
8BA05AB7072073D300365D66 /* AUScopeElement.cpp in Sources */,
8BA05AB9072073D300365D66 /* ComponentBase.cpp in Sources */,
8BA05AC6072073D300365D66 /* AUEffectBase.cpp in Sources */,
8BA05AD2072073D300365D66 /* AUBuffer.cpp in Sources */,
8BA05AD4072073D300365D66 /* AUDebugDispatcher.cpp in Sources */,
8BA05AE50720742100365D66 /* CAAudioChannelLayout.cpp in Sources */,
8BA05AE70720742100365D66 /* CAMutex.cpp in Sources */,
8BA05AE90720742100365D66 /* CAStreamBasicDescription.cpp in Sources */,
8BA05B070720754400365D66 /* CAAUParameter.cpp in Sources */,
3EEA126E089847F5002C6BFC /* CAVectorUnit.cpp in Sources */,
F7C347F00ECE5AF8008ADFB6 /* AUBaseHelper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C167EFE841241C02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
3E4BA244089833B7007656EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
EXPORTED_SYMBOLS_FILE = Dynamics3Mono.exp;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GENERATE_PKGINFO_FILE = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Audio/Plug-Ins/Components/";
LIBRARY_STYLE = Bundle;
OTHER_LDFLAGS = "-bundle";
OTHER_REZFLAGS = "-d ppc_$ppc -d i386_$i386 -d ppc64_$ppc64 -d x86_64_$x86_64 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I \"$(DEVELOPER_DIR)/Examples/CoreAudio/AudioUnits/AUPublic/AUBase\"";
PRODUCT_NAME = Dynamics3Mono;
WRAPPER_EXTENSION = component;
};
name = Debug;
};
3E4BA245089833B7007656EC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
x86_64,
);
EXPORTED_SYMBOLS_FILE = Dynamics3Mono.exp;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GENERATE_PKGINFO_FILE = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Library/Audio/Plug-Ins/Components/";
LIBRARY_STYLE = Bundle;
MACOSX_DEPLOYMENT_TARGET = 10.4;
OTHER_LDFLAGS = "-bundle";
OTHER_REZFLAGS = "-d ppc_$ppc -d i386_$i386 -d x86_64_$x86_64 -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers -I \"$(DEVELOPER_DIR)/Examples/CoreAudio/AudioUnits/AUPublic/AUBase\"";
PRODUCT_NAME = Dynamics3Mono;
SDKROOT = macosx10.5;
STRIP_INSTALLED_PRODUCT = YES;
STRIP_STYLE = all;
WRAPPER_EXTENSION = component;
};
name = Release;
};
3E4BA248089833B7007656EC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = c99;
SDKROOT = macosx10.6;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
};
name = Debug;
};
3E4BA249089833B7007656EC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = c99;
SDKROOT = macosx10.6;
WARNING_CFLAGS = (
"-Wmost",
"-Wno-four-char-constants",
"-Wno-unknown-pragmas",
);
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
3E4BA243089833B7007656EC /* Build configuration list for PBXNativeTarget "Dynamics3Mono" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E4BA244089833B7007656EC /* Debug */,
3E4BA245089833B7007656EC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
3E4BA247089833B7007656EC /* Build configuration list for PBXProject "Dynamics3Mono" */ = {
isa = XCConfigurationList;
buildConfigurations = (
3E4BA248089833B7007656EC /* Debug */,
3E4BA249089833B7007656EC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
rootObject = 089C1669FE841209C02AAC07 /* Project object */;
}

View file

@ -0,0 +1,58 @@
/*
* File: Dynamics3MonoVersion.h
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __Dynamics3MonoVersion_h__
#define __Dynamics3MonoVersion_h__
#ifdef DEBUG
#define kDynamics3MonoVersion 0xFFFFFFFF
#else
#define kDynamics3MonoVersion 0x00010000
#endif
//~~~~~~~~~~~~~~ Change!!! ~~~~~~~~~~~~~~~~~~~~~//
#define Dynamics3Mono_COMP_MANF 'Dthr'
#define Dynamics3Mono_COMP_SUBTYPE 'dym3'
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
#endif

Binary file not shown.

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.airwindows.audiounit.${PRODUCT_NAME:identifier}</string>
<key>CFBundleName</key>
<string>${PROJECTNAMEASIDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>DthX</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildVersion</key>
<string>3</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>ProjectName</key>
<string>${EXECUTABLE_NAME}</string>
<key>SourceVersion</key>
<string>590000</string>
</dict>
</plist>

View file

@ -312,14 +312,32 @@ void PunchyDeluxe::PunchyDeluxeKernel::Process( const Float32 *inSourceP,
}
inputSample += band;
inputSample *= drive;
inputSample = sin(fmin(fmax(inputSample,-M_PI),M_PI));
inputSample = fmin(fmax(inputSample,-2.032610446872596),2.032610446872596);
long double X = inputSample * inputSample;
long double temp = inputSample * X;
inputSample -= (temp*0.125); temp *= X;
inputSample += (temp*0.0078125); temp *= X;
inputSample -= (temp*0.000244140625); temp *= X;
inputSample += (temp*0.000003814697265625); temp *= X;
inputSample -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (pad < 1.0) {
inputSample *= pad;
}
inputSample = sin(fmin(fmax(inputSample,-M_PI),M_PI));
inputSample = fmin(fmax(inputSample,-2.032610446872596),2.032610446872596);
long double X = inputSample * inputSample;
long double temp = inputSample * X;
inputSample -= (temp*0.125); temp *= X;
inputSample += (temp*0.0078125); temp *= X;
inputSample -= (temp*0.000244140625); temp *= X;
inputSample += (temp*0.000003814697265625); temp *= X;
inputSample -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin 32 bit floating point dither
int expon; frexpf((float)inputSample, &expon);

View file

@ -49,15 +49,15 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 772137586;
PBXWorkspaceStateSaveDate = 772137586;
PBXPerProjectTemplateStateSaveDate = 786871716;
PBXWorkspaceStateSaveDate = 786871716;
};
perUserProjectItems = {
8B65E1DF2E05BCBE00CB683A /* PlistBookmark */ = 8B65E1DF2E05BCBE00CB683A /* PlistBookmark */;
8B670B492E05E0D800AB1898 /* PBXTextBookmark */ = 8B670B492E05E0D800AB1898 /* PBXTextBookmark */;
8B670B4A2E05E0D800AB1898 /* PBXTextBookmark */ = 8B670B4A2E05E0D800AB1898 /* PBXTextBookmark */;
8B670B8D2E05E3F800AB1898 /* PBXTextBookmark */ = 8B670B8D2E05E3F800AB1898 /* PBXTextBookmark */;
8B670B8E2E05E3F800AB1898 /* PBXTextBookmark */ = 8B670B8E2E05E3F800AB1898 /* PBXTextBookmark */;
8BE3CAB82EE6B5B7004F72BD /* PBXTextBookmark */ = 8BE3CAB82EE6B5B7004F72BD /* PBXTextBookmark */;
8BE3CABD2EE6B5DA004F72BD /* PBXTextBookmark */ = 8BE3CABD2EE6B5DA004F72BD /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
@ -90,44 +90,24 @@
fRef = 8BA05A660720730100365D66 /* PunchyDeluxe.cpp */;
name = "PunchyDeluxe.cpp: 322";
rLen = 0;
rLoc = 14357;
rLoc = 14848;
rType = 0;
vrLen = 207;
vrLoc = 14454;
};
8B670B8D2E05E3F800AB1898 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* PunchyDeluxeVersion.h */;
name = "PunchyDeluxeVersion.h: 54";
rLen = 0;
rLoc = 2925;
rType = 0;
vrLen = 250;
vrLoc = 2738;
};
8B670B8E2E05E3F800AB1898 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* PunchyDeluxeVersion.h */;
name = "PunchyDeluxeVersion.h: 54";
rLen = 0;
rLoc = 2925;
rType = 0;
vrLen = 250;
vrLoc = 2738;
};
8BA05A660720730100365D66 /* PunchyDeluxe.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {920, 6516}}";
sepNavSelRange = "{14417, 0}";
sepNavVisRange = "{10831, 1456}";
sepNavWindowFrame = "{{777, 58}, {967, 804}}";
sepNavIntBoundsRect = "{{0, 0}, {920, 6714}}";
sepNavSelRange = "{15388, 0}";
sepNavVisRange = "{13978, 1640}";
sepNavWindowFrame = "{{473, 58}, {967, 804}}";
};
};
8BA05A690720730100365D66 /* PunchyDeluxeVersion.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1038, 1206}}";
sepNavIntBoundsRect = "{{0, 0}, {1038, 1224}}";
sepNavSelRange = "{2925, 0}";
sepNavVisRange = "{2738, 250}";
sepNavVisRange = "{2744, 244}";
sepNavWindowFrame = "{{15, 69}, {967, 804}}";
};
};
@ -153,6 +133,26 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8BE3CAB82EE6B5B7004F72BD /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* PunchyDeluxeVersion.h */;
name = "PunchyDeluxeVersion.h: 54";
rLen = 0;
rLoc = 2925;
rType = 0;
vrLen = 244;
vrLoc = 2744;
};
8BE3CABD2EE6B5DA004F72BD /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* PunchyDeluxeVersion.h */;
name = "PunchyDeluxeVersion.h: 54";
rLen = 0;
rLoc = 2925;
rType = 0;
vrLen = 244;
vrLoc = 2744;
};
8D01CCC60486CAD60068D4B7 /* PunchyDeluxe */ = {
activeExec = 0;
};

View file

@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@ -326,7 +324,7 @@
<real>288</real>
</array>
<key>RubberWindowFrame</key>
<string>852 175 841 654 0 0 1440 878 </string>
<string>599 175 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -354,13 +352,13 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B670B8E2E05E3F800AB1898</string>
<string>8BE3CABD2EE6B5DA004F72BD</string>
<key>history</key>
<array>
<string>8B65E1DF2E05BCBE00CB683A</string>
<string>8B670B492E05E0D800AB1898</string>
<string>8B670B4A2E05E0D800AB1898</string>
<string>8B670B8D2E05E3F800AB1898</string>
<string>8BE3CAB82EE6B5B7004F72BD</string>
</array>
</dict>
<key>SplitCount</key>
@ -374,18 +372,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {531, 202}}</string>
<string>{{0, 0}, {531, 188}}</string>
<key>RubberWindowFrame</key>
<string>852 175 841 654 0 0 1440 878 </string>
<string>599 175 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>202pt</string>
<string>188pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>406pt</string>
<string>420pt</string>
<key>Tabs</key>
<array>
<dict>
@ -399,9 +397,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {531, 379}}</string>
<key>RubberWindowFrame</key>
<string>852 175 841 654 0 0 1440 878 </string>
<string>{{10, 27}, {531, 393}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -455,7 +451,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {531, 339}}</string>
<string>{{10, 27}, {531, 393}}</string>
<key>RubberWindowFrame</key>
<string>599 175 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -483,11 +481,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B670B8F2E05E3F800AB1898</string>
<string>8BE3CABE2EE6B5DA004F72BD</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B670B902E05E3F800AB1898</string>
<string>8BE3CABF2EE6B5DA004F72BD</string>
<string>8BD7274A1D46E5A5000176F0</string>
<string>8B670B912E05E3F800AB1898</string>
<string>8BE3CAC02EE6B5DA004F72BD</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -660,7 +658,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>772137976.13086605</real>
<real>786871770.92796195</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -677,11 +675,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8B670B922E05E3F800AB1898</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/PunchyDeluxe/PunchyDeluxe.xcodeproj</string>
<string>8BE3CAC12EE6B5DA004F72BD</string>
<string>/Users/christopherjohnson/Desktop/PunchyDeluxe/PunchyDeluxe.xcodeproj</string>
</array>
<key>WindowString</key>
<string>852 175 841 654 0 0 1440 878 </string>
<string>599 175 841 654 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -333,7 +333,16 @@ void PunchyGuitar::PunchyGuitarKernel::Process( const Float32 *inSourceP,
}
inputSample += (band*angG[9]);
inputSample *= drive;
inputSample = sin(fmin(fmax(inputSample,-M_PI),M_PI));
inputSample = fmin(fmax(inputSample,-2.032610446872596),2.032610446872596);
long double X = inputSample * inputSample;
long double temp = inputSample * X;
inputSample -= (temp*0.125); temp *= X;
inputSample += (temp*0.0078125); temp *= X;
inputSample -= (temp*0.000244140625); temp *= X;
inputSample += (temp*0.000003814697265625); temp *= X;
inputSample -= (temp*0.0000000298023223876953125); temp *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
}
if (gateroller < 1.0)

View file

@ -49,18 +49,31 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 769342354;
PBXWorkspaceStateSaveDate = 769342354;
PBXPerProjectTemplateStateSaveDate = 786870753;
PBXWorkspaceStateSaveDate = 786870753;
};
perUserProjectItems = {
8B33D5B72DF3AC0A0044A4FF /* PBXTextBookmark */ = 8B33D5B72DF3AC0A0044A4FF /* PBXTextBookmark */;
8B8448722DDB4044001CED69 /* PlistBookmark */ = 8B8448722DDB4044001CED69 /* PlistBookmark */;
8B8448732DDB4044001CED69 /* PBXTextBookmark */ = 8B8448732DDB4044001CED69 /* PBXTextBookmark */;
8B8448742DDB4044001CED69 /* PBXTextBookmark */ = 8B8448742DDB4044001CED69 /* PBXTextBookmark */;
8BE3CA8E2EE6B21B004F72BD /* PBXBookmark */ = 8BE3CA8E2EE6B21B004F72BD /* PBXBookmark */;
8BE3CA9D2EE6B542004F72BD /* PBXTextBookmark */ = 8BE3CA9D2EE6B542004F72BD /* PBXTextBookmark */;
8BE3CAA02EE6B558004F72BD /* PBXTextBookmark */ = 8BE3CAA02EE6B558004F72BD /* PBXTextBookmark */;
8BE3CAA62EE6B558004F72BD /* PBXTextBookmark */ = 8BE3CAA62EE6B558004F72BD /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B33D5B72DF3AC0A0044A4FF /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* PunchyGuitarVersion.h */;
name = "PunchyGuitarVersion.h: 54";
rLen = 0;
rLoc = 2927;
rType = 0;
vrLen = 250;
vrLoc = 2739;
};
8B8448722DDB4044001CED69 /* PlistBookmark */ = {
isa = PlistBookmark;
fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */;
@ -71,50 +84,30 @@
);
name = /Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/PunchyGuitar/Info.plist;
rLen = 0;
rLoc = 9223372036854775807;
};
8B8448732DDB4044001CED69 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* PunchyGuitar.h */;
name = "PunchyGuitar.h: 66";
rLen = 0;
rLoc = 3313;
rType = 0;
vrLen = 498;
vrLoc = 3080;
};
8B8448742DDB4044001CED69 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* PunchyGuitar.h */;
name = "PunchyGuitar.h: 66";
rLen = 0;
rLoc = 3313;
rType = 0;
vrLen = 498;
vrLoc = 3080;
rLoc = 9223372036854775808;
};
8BA05A660720730100365D66 /* PunchyGuitar.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1098, 6750}}";
sepNavSelRange = "{14699, 54}";
sepNavVisRange = "{13541, 1270}";
sepNavWindowFrame = "{{640, 41}, {1145, 837}}";
sepNavIntBoundsRect = "{{0, 0}, {1050, 7326}}";
sepNavSelRange = "{15245, 0}";
sepNavVisRange = "{13640, 1612}";
sepNavWindowFrame = "{{32, 38}, {1097, 840}}";
};
};
8BA05A690720730100365D66 /* PunchyGuitarVersion.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1092, 1062}}";
sepNavIntBoundsRect = "{{0, 0}, {1056, 1206}}";
sepNavSelRange = "{2927, 0}";
sepNavVisRange = "{1658, 1332}";
sepNavVisRange = "{2739, 250}";
sepNavWindowFrame = "{{15, 188}, {1139, 685}}";
};
};
8BC6025B073B072D006C4272 /* PunchyGuitar.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1029, 3294}}";
sepNavIntBoundsRect = "{{0, 0}, {498, 3240}}";
sepNavSelRange = "{3313, 0}";
sepNavVisRange = "{3080, 498}";
sepNavWindowFrame = "{{688, 77}, {749, 800}}";
sepNavVisRange = "{3127, 400}";
sepNavWindowFrame = "{{17, 53}, {749, 800}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
@ -131,6 +124,40 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8BE3CA8E2EE6B21B004F72BD /* PBXBookmark */ = {
isa = PBXBookmark;
fRef = 8BA05A660720730100365D66 /* PunchyGuitar.cpp */;
};
8BE3CA9D2EE6B542004F72BD /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* PunchyGuitar.h */;
name = "PunchyGuitar.h: 66";
rLen = 0;
rLoc = 3313;
rType = 0;
vrLen = 400;
vrLoc = 3127;
};
8BE3CAA02EE6B558004F72BD /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* PunchyGuitar.h */;
name = "PunchyGuitar.h: 66";
rLen = 0;
rLoc = 3313;
rType = 0;
vrLen = 400;
vrLoc = 3127;
};
8BE3CAA62EE6B558004F72BD /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* PunchyGuitar.cpp */;
name = "PunchyGuitar.cpp: 346";
rLen = 0;
rLoc = 15245;
rType = 0;
vrLen = 1612;
vrLoc = 13640;
};
8D01CCC60486CAD60068D4B7 /* PunchyGuitar */ = {
activeExec = 0;
};

View file

@ -222,7 +222,48 @@
</dict>
</array>
<key>OpenEditors</key>
<array/>
<array>
<dict>
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8BE3CAA42EE6B558004F72BD</string>
<key>PBXProjectModuleLabel</key>
<string>PunchyGuitar.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8BE3CAA52EE6B558004F72BD</string>
<key>PBXProjectModuleLabel</key>
<string>PunchyGuitar.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8BE3CAA62EE6B558004F72BD</string>
<key>history</key>
<array>
<string>8BE3CA8E2EE6B21B004F72BD</string>
</array>
</dict>
<key>SplitCount</key>
<string>1</string>
</dict>
<key>StatusBarVisibility</key>
<true/>
</dict>
<key>Geometry</key>
<dict>
<key>Frame</key>
<string>{{0, 20}, {1097, 743}}</string>
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
<string>32 94 1097 784 0 0 1440 878 </string>
</dict>
</dict>
</array>
<key>PerspectiveWidths</key>
<array>
<integer>841</integer>
@ -256,8 +297,6 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@ -302,7 +341,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>4</integer>
<integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
@ -326,7 +365,7 @@
<real>288</real>
</array>
<key>RubberWindowFrame</key>
<string>574 182 841 654 0 0 1440 878 </string>
<string>44 208 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -354,11 +393,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8B8448742DDB4044001CED69</string>
<string>8BE3CAA02EE6B558004F72BD</string>
<key>history</key>
<array>
<string>8B8448722DDB4044001CED69</string>
<string>8B8448732DDB4044001CED69</string>
<string>8B33D5B72DF3AC0A0044A4FF</string>
<string>8BE3CA9D2EE6B542004F72BD</string>
</array>
</dict>
<key>SplitCount</key>
@ -372,18 +412,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {531, 216}}</string>
<string>{{0, 0}, {531, 188}}</string>
<key>RubberWindowFrame</key>
<string>574 182 841 654 0 0 1440 878 </string>
<string>44 208 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>216pt</string>
<string>188pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>392pt</string>
<string>420pt</string>
<key>Tabs</key>
<array>
<dict>
@ -397,9 +437,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {531, 365}}</string>
<key>RubberWindowFrame</key>
<string>574 182 841 654 0 0 1440 878 </string>
<string>{{10, 27}, {531, 393}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -453,7 +491,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {531, 339}}</string>
<string>{{10, 27}, {531, 393}}</string>
<key>RubberWindowFrame</key>
<string>44 208 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -481,11 +521,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8B8448752DDB4044001CED69</string>
<string>8BE3CAA12EE6B558004F72BD</string>
<string>1CA23ED40692098700951B8B</string>
<string>8B8448762DDB4044001CED69</string>
<string>8BE3CAA22EE6B558004F72BD</string>
<string>8BD7274A1D46E5A5000176F0</string>
<string>8B8448772DDB4044001CED69</string>
<string>8BE3CAA32EE6B558004F72BD</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -658,7 +698,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>769343556.30281198</real>
<real>786871640.10477197</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -675,11 +715,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8B8448782DDB4044001CED69</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/PunchyGuitar/PunchyGuitar.xcodeproj</string>
<string>8BE3CAA42EE6B558004F72BD</string>
<string>/Users/christopherjohnson/Desktop/PunchyGuitar/PunchyGuitar.xcodeproj</string>
</array>
<key>WindowString</key>
<string>574 182 841 654 0 0 1440 878 </string>
<string>44 208 841 654 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -250,7 +250,7 @@ ComponentResult ConsoleHBuss::Reset(AudioUnitScope inScope, AudioUnitElement in
//SmoothEQ3
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompF[bez_cycle] = 1.0;
bezCompS[bez_cycle] = 1.0;
//Dynamics2
@ -303,35 +303,45 @@ OSStatus ConsoleHBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioAction
double bassGain = (GetParameter( kParam_LOW )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
double omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
@ -522,101 +532,79 @@ OSStatus ConsoleHBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioAction
} else lowpass[hilp_cR1] = lowpass[hilp_cR2] = lowpass[hilp_cL1] = lowpass[hilp_cL2] = 0.0;
//another stage of Highpass/Lowpass before bringing in the parametric bands
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
inputSampleL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
inputSampleR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
}
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//Dynamics2
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * bezRez);
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_C] = bezCompF[bez_B];
bezCompF[bez_B] = bezCompF[bez_A];
bezCompF[bez_A] = bezCompF[bez_Ctrl];
bezCompF[bez_Ctrl] = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * sloRez);
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_C] = bezCompS[bez_B];
bezCompS[bez_B] = bezCompS[bez_A];
bezCompS[bez_A] = bezCompS[bez_Ctrl];
bezCompS[bez_Ctrl] = 0.0;
}
double CBF = (bezCompF[bez_C]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_B]*bezCompF[bez_cycle]);
double BAF = (bezCompF[bez_B]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_A]*bezCompF[bez_cycle]);
double CBAF = (bezCompF[bez_B]+(CBF*(1.0-bezCompF[bez_cycle]))+(BAF*bezCompF[bez_cycle]))*0.5;
double CBS = (bezCompS[bez_C]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_B]*bezCompS[bez_cycle]);
double BAS = (bezCompS[bez_B]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_A]*bezCompS[bez_cycle]);
double CBAS = (bezCompS[bez_B]+(CBS*(1.0-bezCompS[bez_cycle]))+(BAS*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBAS,CBAF); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBAS*-CBAMax)+(CBAF*CBAMax)+1.0)*0.5;
inputSampleL *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
inputSampleR *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
} else {bezCompF[bez_Ctrl] = 0.0; bezCompS[bez_Ctrl] = 0.0;}
//Dynamics2 custom version for buss
if (highpassEngage) { //distributed Highpass
highpass[hilp_temp] = (inputSampleL*highpass[hilp_e0])+highpass[hilp_eL1];
@ -679,47 +667,39 @@ OSStatus ConsoleHBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioAction
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleL *= 0.92;
//end TapeHack section
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double sat = inputSampleL * X;
inputSampleL -= (sat*0.125); sat *= X;
inputSampleL += (sat*0.0078125); sat *= X;
inputSampleL -= (sat*0.000244140625); sat *= X;
inputSampleL += (sat*0.000003814697265625); sat *= X;
inputSampleL -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleR *= 0.92;
//end TapeHack section
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
sat = inputSampleR * X;
inputSampleR -= (sat*0.125); sat *= X;
inputSampleR += (sat*0.0078125); sat *= X;
inputSampleR -= (sat*0.000244140625); sat *= X;
inputSampleR += (sat*0.000003814697265625); sat *= X;
inputSampleR -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//we are leaving it as a clip that will go over 0dB.
//it is a softclip so it will give you a more forgiving experience,
//but you are meant to not drive the softclip for just level.
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);

View file

@ -161,25 +161,16 @@ public:
//SmoothEQ3
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
//Dynamics2
//Dynamics2 custom for buss
enum {
hilp_freq, hilp_temp,

View file

@ -405,10 +405,10 @@ ComponentResult ConsoleHChannel::Reset(AudioUnitScope inScope, AudioUnitElement
}
//HipCrush with four bands
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPositionL[count] = 0.0;
@ -477,6 +477,7 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double moreTapeHack = (GetParameter( kParam_MOR )*2.0)+1.0;
bool tapehackOff = (GetParameter( kParam_MOR ) == 0.0);
switch ((int)GetParameter( kParam_TRM )){
case 0: moreTapeHack *= 0.5; break;
case 1: break;
@ -494,110 +495,123 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
double bassGain = (GetParameter( kParam_LOW )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
double omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
double crossFade = GetParameter( kParam_CRS );
bool hipcrushOff = (crossFade == 0.0);
if (!hipcrushOff) {
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
}
//HipCrush with four bands
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 8.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ),12.0) / overallscale;
sloRez = fmin(fmax(sloRez-(bezRez*0.5),0.00001),1.0);
double bezThresh = pow(1.0-GetParameter( kParam_THR ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_GAT ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
double gate = pow(pow(GetParameter( kParam_GAT ),4.0),sqrt(bezCThresh+1.0));
//Dynamics2
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_LOP ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_HIP ),overallscale+2.0); //the highpass
@ -613,393 +627,359 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
double darkSampleL = inputSampleL;
double darkSampleR = inputSampleR;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL; avg32R[avgPos] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x]; darkSampleR += avg32R[x];}
darkSampleL /= 32.0; darkSampleR /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL; avg16R[avgPos%16] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x]; darkSampleR += avg16R[x];}
darkSampleL /= 16.0; darkSampleR /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL; avg8R[avgPos%8] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x]; darkSampleR += avg8R[x];}
darkSampleL /= 8.0; darkSampleR /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL; avg4R[avgPos%4] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x]; darkSampleR += avg4R[x];}
darkSampleL /= 4.0; darkSampleR /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL; avg2R[avgPos%2] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x]; darkSampleR += avg2R[x];}
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//begin Discontinuity section
inputSampleR *= moreTapeHack;
inputSampleR *= moreDiscontinuity;
dBaR[dBaXR] = inputSampleR; dBaPosR *= 0.5; dBaPosR += fabs((inputSampleR*((inputSampleR*0.25)-0.5))*0.5);
dBaPosR = fmin(dBaPosR,1.0);
dBdly = floor(dBaPosR*dscBuf);
dBi = (dBaPosR*dscBuf)-dBdly;
inputSampleR = dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleR += dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*dBi;
dBaXR++; if (dBaXR < 0 || dBaXR >= dscBuf) dBaXR = 0;
inputSampleR /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
//trim control gets to work even when MORE is off
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
double smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!tapehackOff) {
double darkSampleL = inputSampleL;
double darkSampleR = inputSampleR;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL; avg32R[avgPos] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x]; darkSampleR += avg32R[x];}
darkSampleL /= 32.0; darkSampleR /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL; avg16R[avgPos%16] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x]; darkSampleR += avg16R[x];}
darkSampleL /= 16.0; darkSampleR /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL; avg8R[avgPos%8] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x]; darkSampleR += avg8R[x];}
darkSampleL /= 8.0; darkSampleR /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL; avg4R[avgPos%4] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x]; darkSampleR += avg4R[x];}
darkSampleL /= 4.0; darkSampleR /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL; avg2R[avgPos%2] = darkSampleR;
darkSampleL = 0.0; darkSampleR = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x]; darkSampleR += avg2R[x];}
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin Discontinuity section
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//begin Discontinuity section
inputSampleR *= moreDiscontinuity;
dBaR[dBaXR] = inputSampleR; dBaPosR *= 0.5; dBaPosR += fabs((inputSampleR*((inputSampleR*0.25)-0.5))*0.5);
dBaPosR = fmin(dBaPosR,1.0);
dBdly = floor(dBaPosR*dscBuf);
dBi = (dBaPosR*dscBuf)-dBdly;
inputSampleR = dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleR += dBaR[dBaXR-dBdly +((dBaXR-dBdly < 0)?dscBuf:0)]*dBi;
dBaXR++; if (dBaXR < 0 || dBaXR >= dscBuf) dBaXR = 0;
inputSampleR /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
}
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
double smoothEQR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double smoothEQL = inputSampleL;
double smoothEQR = inputSampleR;
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
double trebleFastR = inputSampleR;
outSample = (trebleFastR * highFast[biq_a0]) + highFast[biq_sR1];
highFast[biq_sR1] = (trebleFastR * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sR2];
highFast[biq_sR2] = (trebleFastR * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastR = outSample; trebleFastR -= midFastR;
outSample = (midFastR * lowFast[biq_a0]) + lowFast[biq_sR1];
lowFast[biq_sR1] = (midFastR * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sR2];
lowFast[biq_sR2] = (midFastR * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastR = outSample; midFastR -= bassFastR;
trebleFastR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastRIIR = (highFastRIIR*highCoef) + (trebleFastR*(1.0-highCoef));
midFastR = highFastRIIR; trebleFastR -= midFastR;
lowFastRIIR = (lowFastRIIR*lowCoef) + (midFastR*(1.0-lowCoef));
bassFastR = lowFastRIIR; midFastR -= bassFastR;
smoothEQR = (bassFastR*bassGain) + (midFastR*midGain) + (trebleFastR*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
double parametricL = 0.0;
double parametricR = 0.0;
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
if (!hipcrushOff) {
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow R
high[biqs_outR] = inputSampleR * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outR] * high[biqs_a0]) + high[biqs_aR1];
high[biqs_aR1] = high[biqs_aR2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aR2] = (high[biqs_outR] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outR] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outR] *= bitFactor;
high[biqs_outR] = floor(high[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outR] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outR] * high[biqs_c0]) + high[biqs_cR1];
high[biqs_cR1] = high[biqs_cR2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cR2] = (high[biqs_outR] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outR] = high[biqs_temp];
high[biqs_outR] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
hmid[biqs_outR] = inputSampleR * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_a0]) + hmid[biqs_aR1];
hmid[biqs_aR1] = hmid[biqs_aR2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aR2] = (hmid[biqs_outR] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outR] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outR] *= bitFactor;
hmid[biqs_outR] = floor(hmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outR] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_c0]) + hmid[biqs_cR1];
hmid[biqs_cR1] = hmid[biqs_cR2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cR2] = (hmid[biqs_outR] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outR] = hmid[biqs_temp];
hmid[biqs_outR] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
lmid[biqs_outR] = inputSampleR * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_a0]) + lmid[biqs_aR1];
lmid[biqs_aR1] = lmid[biqs_aR2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aR2] = (lmid[biqs_outR] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outR] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outR] *= bitFactor;
lmid[biqs_outR] = floor(lmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outR] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_c0]) + lmid[biqs_cR1];
lmid[biqs_cR1] = lmid[biqs_cR2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cR2] = (lmid[biqs_outR] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outR] = lmid[biqs_temp];
lmid[biqs_outR] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
bass[biqs_outR] = inputSampleR * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_a0]) + bass[biqs_aR1];
bass[biqs_aR1] = bass[biqs_aR2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aR2] = (bass[biqs_outR] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outR] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outR] *= bitFactor;
bass[biqs_outR] = floor(bass[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outR] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_c0]) + bass[biqs_cR1];
bass[biqs_cR1] = bass[biqs_cR2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cR2] = (bass[biqs_outR] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outR] = bass[biqs_temp];
bass[biqs_outR] *= bass[biqs_level];
parametricR = high[biqs_outR] + hmid[biqs_outR] + lmid[biqs_outR] + bass[biqs_outR];
//end Stacked Biquad With Reversed Neutron Flow R
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
double parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow R
high[biqs_outR] = inputSampleR * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outR] * high[biqs_a0]) + high[biqs_aR1];
high[biqs_aR1] = high[biqs_aR2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aR2] = (high[biqs_outR] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outR] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outR] *= bitFactor;
high[biqs_outR] = floor(high[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outR] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outR] * high[biqs_c0]) + high[biqs_cR1];
high[biqs_cR1] = high[biqs_cR2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cR2] = (high[biqs_outR] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outR] = high[biqs_temp];
high[biqs_outR] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
hmid[biqs_outR] = inputSampleR * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_a0]) + hmid[biqs_aR1];
hmid[biqs_aR1] = hmid[biqs_aR2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aR2] = (hmid[biqs_outR] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outR] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outR] *= bitFactor;
hmid[biqs_outR] = floor(hmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outR] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outR] * hmid[biqs_c0]) + hmid[biqs_cR1];
hmid[biqs_cR1] = hmid[biqs_cR2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cR2] = (hmid[biqs_outR] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outR] = hmid[biqs_temp];
hmid[biqs_outR] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
lmid[biqs_outR] = inputSampleR * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_a0]) + lmid[biqs_aR1];
lmid[biqs_aR1] = lmid[biqs_aR2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aR2] = (lmid[biqs_outR] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outR] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outR] *= bitFactor;
lmid[biqs_outR] = floor(lmid[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outR] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outR] * lmid[biqs_c0]) + lmid[biqs_cR1];
lmid[biqs_cR1] = lmid[biqs_cR2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cR2] = (lmid[biqs_outR] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outR] = lmid[biqs_temp];
lmid[biqs_outR] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow R
//begin Stacked Biquad With Reversed Neutron Flow R
bass[biqs_outR] = inputSampleR * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_a0]) + bass[biqs_aR1];
bass[biqs_aR1] = bass[biqs_aR2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aR2] = (bass[biqs_outR] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outR] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outR] *= bitFactor;
bass[biqs_outR] = floor(bass[biqs_outR]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outR] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outR] * bass[biqs_c0]) + bass[biqs_cR1];
bass[biqs_cR1] = bass[biqs_cR2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cR2] = (bass[biqs_outR] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outR] = bass[biqs_temp];
bass[biqs_outR] *= bass[biqs_level];
double parametricR = high[biqs_outR] + hmid[biqs_outR] + lmid[biqs_outR] + bass[biqs_outR];
//end Stacked Biquad With Reversed Neutron Flow R
//end HipCrush as four band
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
smoothEQL *= ((bezCThresh*0.5)+1.0);
smoothEQR *= ((bezCThresh*0.5)+1.0);
parametricL *= ((bezCThresh*0.5)+1.0);
parametricR *= ((bezCThresh*0.5)+1.0);
} //makeup gain
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate+(sloRez*bezGate)) bezGate = ((bezGate*overallscale*3.0)+3.0)*(0.25/overallscale);
else bezGate = fmax(0.0, bezGate-(sloRez*sloRez));
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
inputSampleR *= (bezThresh+1.0);
smoothEQL *= (bezThresh+1.0);
smoothEQR *= (bezThresh+1.0);
parametricL *= (bezThresh+1.0);
parametricR *= (bezThresh+1.0);
} //makeup gain
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
if (bezMaxF < gate) bezCompF[bez_SampL] = bezMaxF/gate; //note: SampL is a control voltage,
if (bezCompF[bez_SampL]<gate) bezCompF[bez_SampL] = 0.0; //not a bipolar audio signal
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
if (bezMaxF < gate) bezCompF[bez_SampR] = bezMaxF/gate; //note: SampR is a control voltage,
if (bezCompF[bez_SampR]<gate) bezCompF[bez_SampR] = 0.0; //not a bipolar audio signal
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
double ctrl = fmax(fabs(inputSampleL),fabs(inputSampleR));
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
if (bezCompS[bez_SampL]<gate) bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
if (bezCompS[bez_SampR]<gate) bezCompS[bez_SampR] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
//switch over to the EQed or HipCrushed sound and compress
inputSampleL = (smoothEQL * (1.0-crossFade)) + (parametricL * crossFade);
//apply filtration to what was just the unfiltered sound
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
//apply compression worked out using unfiltered sound
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
//switch over to the EQed or HipCrushed sound and compress
inputSampleR = (smoothEQR * (1.0-crossFade)) + (parametricR * crossFade);
//apply filtration to what was just the unfiltered sound
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//apply compression worked out using unfiltered sound
if (bezGate < 1.0 && gate > 0.0) {inputSampleL *= bezGate; inputSampleR *= bezGate;}
//and gate the lot, if necessary
//Dynamics2
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
inputSampleR *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//Dynamics3, but with crossfade over EQ or HipCrush
const double temp = (double)nSampleFrames/inFramesToProcess;
const double hFreq = (hFreqA*temp)+(hFreqB*(1.0-temp));
@ -1026,7 +1006,7 @@ OSStatus ConsoleHChannel::ProcessBufferLists(AudioUnitRenderActionFlags & ioAct
iirHPositionR[count] = 0.0;
iirHAngleR[count] = 0.0;
}
} //blank out highpass if jut switched off
} //blank out highpass if just switched off
}
const double lFreq = (lFreqA*temp)+(lFreqB*(1.0-temp));
if (lFreq < 1.0) {

View file

@ -236,26 +236,18 @@ public:
//HipCrush with four bands
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

View file

@ -379,10 +379,10 @@ void ConsoleHPre::ConsoleHPreKernel::Reset()
}
//HipCrush with four bands
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPosition[count] = 0.0;
@ -440,6 +440,7 @@ void ConsoleHPre::ConsoleHPreKernel::Process( const Float32 *inSourceP,
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double moreTapeHack = (GetParameter( kParam_MOR )*2.0)+1.0;
bool tapehackOff = (GetParameter( kParam_MOR ) == 0.0);
switch ((int)GetParameter( kParam_TRM )){
case 0: moreTapeHack *= 0.5; break;
case 1: break;
@ -457,109 +458,123 @@ void ConsoleHPre::ConsoleHPreKernel::Process( const Float32 *inSourceP,
double bassGain = (GetParameter( kParam_LOW )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
//separate from filtering stage, this is amplitude, centered on 1.0 unity gain
double highCoef = 0.0;
double lowCoef = 0.0;
double omega = 0.0;
double biqK = 0.0;
double norm = 0.0;
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
double omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
double biqK = 2.0 - cos(omega);
double highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
double lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
double norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
bool eqOff = (trebleGain == 1.0 && midGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
//SmoothEQ3 is how to get 3rd order steepness at very low CPU.
//because sample rate varies, you could also vary the crossovers
//you can't vary Q because math is simplified to take advantage of
//how the accurate Q value for this filter is always exactly 1.0.
highFast[biq_freq] = (4000.0/GetSampleRate());
omega = 2.0*M_PI*(4000.0/GetSampleRate()); //mid-high crossover freq
biqK = 2.0 - cos(omega);
highCoef = -sqrt(biqK*biqK - 1.0) + biqK;
lowFast[biq_freq] = (200.0/GetSampleRate());
omega = 2.0*M_PI*(200.0/GetSampleRate()); //low-mid crossover freq
biqK = 2.0 - cos(omega);
lowCoef = -sqrt(biqK*biqK - 1.0) + biqK;
//exponential IIR filter as part of an accurate 3rd order Butterworth filter
biqK = tan(M_PI * highFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
highFast[biq_a0] = biqK * biqK * norm;
highFast[biq_a1] = 2.0 * highFast[biq_a0];
highFast[biq_a2] = highFast[biq_a0];
highFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
highFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
biqK = tan(M_PI * lowFast[biq_freq]);
norm = 1.0 / (1.0 + biqK + biqK*biqK);
lowFast[biq_a0] = biqK * biqK * norm;
lowFast[biq_a1] = 2.0 * lowFast[biq_a0];
lowFast[biq_a2] = lowFast[biq_a0];
lowFast[biq_b1] = 2.0 * (biqK*biqK - 1.0) * norm;
lowFast[biq_b2] = (1.0 - biqK + biqK*biqK) * norm;
//custom biquad setup with Q = 1.0 gets to omit some divides
}
//SmoothEQ3
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
double crossFade = GetParameter( kParam_CRS );
bool hipcrushOff = (crossFade == 0.0);
if (!hipcrushOff) {
high[biqs_freq] = (((pow(GetParameter( kParam_TRF ),2.0)*16000.0)+1000.0)/GetSampleRate());
if (high[biqs_freq] < 0.0001) high[biqs_freq] = 0.0001;
high[biqs_bit] = (GetParameter( kParam_TRB )*2.0)-1.0;
high[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_TRG ),2.0))*1.618033988749894848204586;
high[biqs_reso] = pow(GetParameter( kParam_TRG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * high[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
high[biqs_a0] = biqK / (high[biqs_reso]*0.618033988749894848204586) * norm;
high[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_b2] = (1.0 - biqK / (high[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
high[biqs_c0] = biqK / (high[biqs_reso]*1.618033988749894848204586) * norm;
high[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
high[biqs_d2] = (1.0 - biqK / (high[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//high
hmid[biqs_freq] = (((pow(GetParameter( kParam_HMF ),3.0)*7000.0)+300.0)/GetSampleRate());
if (hmid[biqs_freq] < 0.0001) hmid[biqs_freq] = 0.0001;
hmid[biqs_bit] = (GetParameter( kParam_HMB )*2.0)-1.0;
hmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_HMG ),2.0))*1.618033988749894848204586;
hmid[biqs_reso] = pow(GetParameter( kParam_HMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * hmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
hmid[biqs_a0] = biqK / (hmid[biqs_reso]*0.618033988749894848204586) * norm;
hmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_b2] = (1.0 - biqK / (hmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
hmid[biqs_c0] = biqK / (hmid[biqs_reso]*1.618033988749894848204586) * norm;
hmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
hmid[biqs_d2] = (1.0 - biqK / (hmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//hmid
lmid[biqs_freq] = (((pow(GetParameter( kParam_LMF ),3.0)*3000.0)+40.0)/GetSampleRate());
if (lmid[biqs_freq] < 0.00001) lmid[biqs_freq] = 0.00001;
lmid[biqs_bit] = (GetParameter( kParam_LMB )*2.0)-1.0;
lmid[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_LMG ),2.0))*1.618033988749894848204586;
lmid[biqs_reso] = pow(GetParameter( kParam_LMG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * lmid[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
lmid[biqs_a0] = biqK / (lmid[biqs_reso]*0.618033988749894848204586) * norm;
lmid[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_b2] = (1.0 - biqK / (lmid[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
lmid[biqs_c0] = biqK / (lmid[biqs_reso]*1.618033988749894848204586) * norm;
lmid[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
lmid[biqs_d2] = (1.0 - biqK / (lmid[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//lmid
bass[biqs_freq] = (((pow(GetParameter( kParam_BSF ),4.0)*1000.0)+20.0)/GetSampleRate());
if (bass[biqs_freq] < 0.00001) bass[biqs_freq] = 0.00001;
bass[biqs_bit] = (GetParameter( kParam_BSB )*2.0)-1.0;
bass[biqs_level] = (1.0-pow(1.0-GetParameter( kParam_BSG ),2.0))*1.618033988749894848204586;
bass[biqs_reso] = pow(GetParameter( kParam_BSG )+0.618033988749894848204586,2.0);
biqK = tan(M_PI * bass[biqs_freq]);
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK);
bass[biqs_a0] = biqK / (bass[biqs_reso]*0.618033988749894848204586) * norm;
bass[biqs_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_b2] = (1.0 - biqK / (bass[biqs_reso]*0.618033988749894848204586) + biqK * biqK) * norm;
norm = 1.0 / (1.0 + biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK);
bass[biqs_c0] = biqK / (bass[biqs_reso]*1.618033988749894848204586) * norm;
bass[biqs_d1] = 2.0 * (biqK * biqK - 1.0) * norm;
bass[biqs_d2] = (1.0 - biqK / (bass[biqs_reso]*1.618033988749894848204586) + biqK * biqK) * norm;
//bass
}
//HipCrush with four bands
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 8.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ),12.0) / overallscale;
sloRez = fmin(fmax(sloRez-(bezRez*0.5),0.00001),1.0);
double bezThresh = pow(1.0-GetParameter( kParam_THR ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_GAT ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
double gate = pow(pow(GetParameter( kParam_GAT ),4.0),sqrt(bezCThresh+1.0));
//Dynamics2
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_LOP ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_HIP ),overallscale+2.0); //the highpass
@ -572,220 +587,219 @@ void ConsoleHPre::ConsoleHPreKernel::Process( const Float32 *inSourceP,
double inputSampleL = *sourceP;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpd * 1.18e-17;
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
//trim control gets to work even when MORE is off
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
double smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
if (!tapehackOff) {
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
}
double smoothEQL = inputSampleL;
if (!eqOff) {
double trebleFastL = inputSampleL;
double outSample = (trebleFastL * highFast[biq_a0]) + highFast[biq_sL1];
highFast[biq_sL1] = (trebleFastL * highFast[biq_a1]) - (outSample * highFast[biq_b1]) + highFast[biq_sL2];
highFast[biq_sL2] = (trebleFastL * highFast[biq_a2]) - (outSample * highFast[biq_b2]);
double midFastL = outSample; trebleFastL -= midFastL;
outSample = (midFastL * lowFast[biq_a0]) + lowFast[biq_sL1];
lowFast[biq_sL1] = (midFastL * lowFast[biq_a1]) - (outSample * lowFast[biq_b1]) + lowFast[biq_sL2];
lowFast[biq_sL2] = (midFastL * lowFast[biq_a2]) - (outSample * lowFast[biq_b2]);
double bassFastL = outSample; midFastL -= bassFastL;
trebleFastL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//first stage of two crossovers is biquad of exactly 1.0 Q
highFastLIIR = (highFastLIIR*highCoef) + (trebleFastL*(1.0-highCoef));
midFastL = highFastLIIR; trebleFastL -= midFastL;
lowFastLIIR = (lowFastLIIR*lowCoef) + (midFastL*(1.0-lowCoef));
bassFastL = lowFastLIIR; midFastL -= bassFastL;
smoothEQL = (bassFastL*bassGain) + (midFastL*midGain) + (trebleFastL*trebleGain);
//second stage of two crossovers is the exponential filters
//this produces a slightly steeper Butterworth filter very cheaply
}
//SmoothEQ3
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
double parametricL = 0.0;
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
if (!hipcrushOff) {
//begin Stacked Biquad With Reversed Neutron Flow L
high[biqs_outL] = inputSampleL * fabs(high[biqs_level]);
high[biqs_temp] = (high[biqs_outL] * high[biqs_a0]) + high[biqs_aL1];
high[biqs_aL1] = high[biqs_aL2] - (high[biqs_temp]*high[biqs_b1]);
high[biqs_aL2] = (high[biqs_outL] * -high[biqs_a0]) - (high[biqs_temp]*high[biqs_b2]);
high[biqs_outL] = high[biqs_temp];
if (high[biqs_bit] != 0.0) {
double bitFactor = high[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
high[biqs_outL] *= bitFactor;
high[biqs_outL] = floor(high[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
high[biqs_outL] /= bitFactor;
}
high[biqs_temp] = (high[biqs_outL] * high[biqs_c0]) + high[biqs_cL1];
high[biqs_cL1] = high[biqs_cL2] - (high[biqs_temp]*high[biqs_d1]);
high[biqs_cL2] = (high[biqs_outL] * -high[biqs_c0]) - (high[biqs_temp]*high[biqs_d2]);
high[biqs_outL] = high[biqs_temp];
high[biqs_outL] *= high[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
hmid[biqs_outL] = inputSampleL * fabs(hmid[biqs_level]);
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_a0]) + hmid[biqs_aL1];
hmid[biqs_aL1] = hmid[biqs_aL2] - (hmid[biqs_temp]*hmid[biqs_b1]);
hmid[biqs_aL2] = (hmid[biqs_outL] * -hmid[biqs_a0]) - (hmid[biqs_temp]*hmid[biqs_b2]);
hmid[biqs_outL] = hmid[biqs_temp];
if (hmid[biqs_bit] != 0.0) {
double bitFactor = hmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
hmid[biqs_outL] *= bitFactor;
hmid[biqs_outL] = floor(hmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
hmid[biqs_outL] /= bitFactor;
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
}
hmid[biqs_temp] = (hmid[biqs_outL] * hmid[biqs_c0]) + hmid[biqs_cL1];
hmid[biqs_cL1] = hmid[biqs_cL2] - (hmid[biqs_temp]*hmid[biqs_d1]);
hmid[biqs_cL2] = (hmid[biqs_outL] * -hmid[biqs_c0]) - (hmid[biqs_temp]*hmid[biqs_d2]);
hmid[biqs_outL] = hmid[biqs_temp];
hmid[biqs_outL] *= hmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
lmid[biqs_outL] = inputSampleL * fabs(lmid[biqs_level]);
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_a0]) + lmid[biqs_aL1];
lmid[biqs_aL1] = lmid[biqs_aL2] - (lmid[biqs_temp]*lmid[biqs_b1]);
lmid[biqs_aL2] = (lmid[biqs_outL] * -lmid[biqs_a0]) - (lmid[biqs_temp]*lmid[biqs_b2]);
lmid[biqs_outL] = lmid[biqs_temp];
if (lmid[biqs_bit] != 0.0) {
double bitFactor = lmid[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
lmid[biqs_outL] *= bitFactor;
lmid[biqs_outL] = floor(lmid[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
lmid[biqs_outL] /= bitFactor;
}
lmid[biqs_temp] = (lmid[biqs_outL] * lmid[biqs_c0]) + lmid[biqs_cL1];
lmid[biqs_cL1] = lmid[biqs_cL2] - (lmid[biqs_temp]*lmid[biqs_d1]);
lmid[biqs_cL2] = (lmid[biqs_outL] * -lmid[biqs_c0]) - (lmid[biqs_temp]*lmid[biqs_d2]);
lmid[biqs_outL] = lmid[biqs_temp];
lmid[biqs_outL] *= lmid[biqs_level];
//end Stacked Biquad With Reversed Neutron Flow L
//begin Stacked Biquad With Reversed Neutron Flow L
bass[biqs_outL] = inputSampleL * fabs(bass[biqs_level]);
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_a0]) + bass[biqs_aL1];
bass[biqs_aL1] = bass[biqs_aL2] - (bass[biqs_temp]*bass[biqs_b1]);
bass[biqs_aL2] = (bass[biqs_outL] * -bass[biqs_a0]) - (bass[biqs_temp]*bass[biqs_b2]);
bass[biqs_outL] = bass[biqs_temp];
if (bass[biqs_bit] != 0.0) {
double bitFactor = bass[biqs_bit];
bool crushGate = (bitFactor < 0.0);
bitFactor = pow(2.0,fmin(fmax((1.0-fabs(bitFactor))*16.0,0.5),16.0));
bass[biqs_outL] *= bitFactor;
bass[biqs_outL] = floor(bass[biqs_outL]+(crushGate?0.5/bitFactor:0.0));
bass[biqs_outL] /= bitFactor;
}
bass[biqs_temp] = (bass[biqs_outL] * bass[biqs_c0]) + bass[biqs_cL1];
bass[biqs_cL1] = bass[biqs_cL2] - (bass[biqs_temp]*bass[biqs_d1]);
bass[biqs_cL2] = (bass[biqs_outL] * -bass[biqs_c0]) - (bass[biqs_temp]*bass[biqs_d2]);
bass[biqs_outL] = bass[biqs_temp];
bass[biqs_outL] *= bass[biqs_level];
double parametricL = high[biqs_outL] + hmid[biqs_outL] + lmid[biqs_outL] + bass[biqs_outL];
//end Stacked Biquad With Reversed Neutron Flow L
//end HipCrush as four band
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
smoothEQL *= ((bezCThresh*0.5)+1.0);
parametricL *= ((bezCThresh*0.5)+1.0);
} //makeup gain
if (fabs(inputSampleL) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (fabs(inputSampleL) > gate+(sloRez*bezGate)) bezGate = ((bezGate*overallscale*3.0)+3.0)*(0.25/overallscale);
else bezGate = fmax(0.0, bezGate-(sloRez*sloRez));
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezMaxF = fmax(bezMaxF,fabs(inputSampleL));
if (bezCompF[bez_cycle] > 1.0) {
if (bezMaxF < gate) bezCompF[bez_SampL] = bezMaxF/gate; //note: SampL is a control voltage,
if (bezCompF[bez_SampL]<gate) bezCompF[bez_SampL] = 0.0; //not a bipolar audio signal
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezMaxF = 0.0;
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
smoothEQL *= (bezThresh+1.0);
parametricL *= (bezThresh+1.0);
} //makeup gain
double ctrl = fabs(inputSampleL);
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage.
if (bezCompS[bez_cycle] > 1.0) {
if (bezCompS[bez_SampL]<gate) bezCompS[bez_SampL] = 0.0;
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
//switch over to the EQed or HipCrushed sound and compress
inputSampleL = (smoothEQL * (1.0-crossFade)) + (parametricL * crossFade);
//apply filtration to what was just the unfiltered sound
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
//apply compression worked out using unfiltered sound
if (bezGate < 1.0 && gate > 0.0) inputSampleL *= bezGate;
//Dynamics2
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//Dynamics3, but with crossfade over EQ or HipCrush
const double temp = (double)nSampleFrames/inFramesToProcess;
const double hFreq = (hFreqA*temp)+(hFreqB*(1.0-temp));

View file

@ -245,20 +245,18 @@ public:
//HipCrush with four bands
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPosition[23];
double iirHAngle[23];

View file

@ -59,17 +59,17 @@ ConsoleX2Buss::ConsoleX2Buss(AudioUnit component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
SetParameter(kParam_E, kDefaultValue_ParamE );
SetParameter(kParam_F, kDefaultValue_ParamF );
SetParameter(kParam_G, kDefaultValue_ParamG );
SetParameter(kParam_H, kDefaultValue_ParamH );
SetParameter(kParam_I, kDefaultValue_ParamI );
SetParameter(kParam_J, kDefaultValue_ParamJ );
SetParameter(kParam_K, kDefaultValue_ParamK );
SetParameter(kParam_HIG, kDefaultValue_ParamHIG );
SetParameter(kParam_HMG, kDefaultValue_ParamHMG );
SetParameter(kParam_LMG, kDefaultValue_ParamLMG );
SetParameter(kParam_BSG, kDefaultValue_ParamBSG );
SetParameter(kParam_HIF, kDefaultValue_ParamHIF );
SetParameter(kParam_HMF, kDefaultValue_ParamHMF );
SetParameter(kParam_LMF, kDefaultValue_ParamLMF );
SetParameter(kParam_BSF, kDefaultValue_ParamBSF );
SetParameter(kParam_THR, kDefaultValue_ParamTHR );
SetParameter(kParam_PAN, kDefaultValue_ParamPAN );
SetParameter(kParam_FAD, kDefaultValue_ParamFAD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
@ -106,85 +106,85 @@ ComponentResult ConsoleX2Buss::GetParameterInfo(AudioUnitScope inScope,
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
case kParam_HIG:
AUBase::FillInParameterName (outParameterInfo, kParameterHIGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterAUnit;
outParameterInfo.unitName = kParameterHIGUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
outParameterInfo.defaultValue = kDefaultValue_ParamHIG;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
case kParam_HMG:
AUBase::FillInParameterName (outParameterInfo, kParameterHMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
outParameterInfo.defaultValue = kDefaultValue_ParamHMG;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
case kParam_LMG:
AUBase::FillInParameterName (outParameterInfo, kParameterLMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
outParameterInfo.defaultValue = kDefaultValue_ParamLMG;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
case kParam_BSG:
AUBase::FillInParameterName (outParameterInfo, kParameterBSGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
outParameterInfo.defaultValue = kDefaultValue_ParamBSG;
break;
case kParam_E:
AUBase::FillInParameterName (outParameterInfo, kParameterEName, false);
case kParam_HIF:
AUBase::FillInParameterName (outParameterInfo, kParameterHIFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterEUnit;
outParameterInfo.unitName = kParameterHIFUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamE;
outParameterInfo.defaultValue = kDefaultValue_ParamHIF;
break;
case kParam_F:
AUBase::FillInParameterName (outParameterInfo, kParameterFName, false);
case kParam_HMF:
AUBase::FillInParameterName (outParameterInfo, kParameterHMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
outParameterInfo.defaultValue = kDefaultValue_ParamHMF;
break;
case kParam_G:
AUBase::FillInParameterName (outParameterInfo, kParameterGName, false);
case kParam_LMF:
AUBase::FillInParameterName (outParameterInfo, kParameterLMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamG;
outParameterInfo.defaultValue = kDefaultValue_ParamLMF;
break;
case kParam_H:
AUBase::FillInParameterName (outParameterInfo, kParameterHName, false);
case kParam_BSF:
AUBase::FillInParameterName (outParameterInfo, kParameterBSFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamH;
outParameterInfo.defaultValue = kDefaultValue_ParamBSF;
break;
case kParam_I:
AUBase::FillInParameterName (outParameterInfo, kParameterIName, false);
case kParam_THR:
AUBase::FillInParameterName (outParameterInfo, kParameterTHRName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterIUnit;
outParameterInfo.unitName = kParameterTHRUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamI;
outParameterInfo.defaultValue = kDefaultValue_ParamTHR;
break;
case kParam_J:
AUBase::FillInParameterName (outParameterInfo, kParameterJName, false);
case kParam_PAN:
AUBase::FillInParameterName (outParameterInfo, kParameterPANName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamJ;
outParameterInfo.defaultValue = kDefaultValue_ParamPAN;
break;
case kParam_K:
AUBase::FillInParameterName (outParameterInfo, kParameterKName, false);
case kParam_FAD:
AUBase::FillInParameterName (outParameterInfo, kParameterFADName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamK;
outParameterInfo.defaultValue = kDefaultValue_ParamFAD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
@ -276,7 +276,7 @@ ComponentResult ConsoleX2Buss::Reset(AudioUnitScope inScope, AudioUnitElement i
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompF[bez_cycle] = 1.0;
bezCompS[bez_cycle] = 1.0;
//Dynamics2
@ -317,133 +317,141 @@ OSStatus ConsoleX2Buss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
int spacing = floor(overallscale*2.0);
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double trebleGain = (GetParameter( kParam_A )-0.5)*2.0;
double trebleGain = (GetParameter( kParam_HIG )-0.5)*2.0;
trebleGain = 1.0+(trebleGain*fabs(trebleGain)*fabs(trebleGain));
double highmidGain = (GetParameter( kParam_B )-0.5)*2.0;
double highmidGain = (GetParameter( kParam_HMG )-0.5)*2.0;
highmidGain = 1.0+(highmidGain*fabs(highmidGain)*fabs(highmidGain));
double lowmidGain = (GetParameter( kParam_C )-0.5)*2.0;
double lowmidGain = (GetParameter( kParam_LMG )-0.5)*2.0;
lowmidGain = 1.0+(lowmidGain*fabs(lowmidGain)*fabs(lowmidGain));
double bassGain = (GetParameter( kParam_D )-0.5)*2.0;
double bassGain = (GetParameter( kParam_BSG )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
double highCoef = 0.0;
double midCoef = 0.0;
double lowCoef = 0.0;
double trebleRef = GetParameter( kParam_E )-0.5;
double highmidRef = GetParameter( kParam_F )-0.5;
double lowmidRef = GetParameter( kParam_G )-0.5;
double bassRef = GetParameter( kParam_H )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
double highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
bool eqOff = (trebleGain == 1.0 && highmidGain == 1.0 && lowmidGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
double trebleRef = GetParameter( kParam_HIF )-0.5;
double highmidRef = GetParameter( kParam_HMF )-0.5;
double lowmidRef = GetParameter( kParam_LMF )-0.5;
double bassRef = GetParameter( kParam_BSF )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
}
//SmoothEQ2
double bezCThresh = pow(1.0-GetParameter( kParam_I ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_I ), 12.360679774997898) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_I ),10.0) / overallscale;
double bezCThresh = pow(1.0-GetParameter( kParam_THR ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_THR ), 12.360679774997898) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_THR ),10.0) / overallscale;
sloRez = fmin(fmax(sloRez,0.00001),1.0);
bezRez = fmin(fmax(bezRez,0.00001),1.0);
//Dynamics2
panA = panB; panB = GetParameter( kParam_J )*1.57079633;
inTrimA = inTrimB; inTrimB = GetParameter( kParam_K )*2.0;
panA = panB; panB = GetParameter( kParam_PAN )*1.57079633;
inTrimA = inTrimB; inTrimB = GetParameter( kParam_FAD )*2.0;
//Console
while (nSampleFrames-- > 0) {
@ -462,198 +470,176 @@ OSStatus ConsoleX2Buss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
if (inputSampleR < -1.0) inputSampleR = -1.0;
else if (inputSampleR < 0.0) inputSampleR = expm1((log1p(inputSampleR) * 0.6180339887498949));
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highLIIR = (highLIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highLIIR; trebleL -= highmidL;
midLIIR = (midLIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midLIIR; highmidL -= lowmidL;
lowLIIR = (lowLIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowLIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
double trebleR = inputSampleR;
outSample = (trebleR * highA[biq_a0]) + highA[biq_sR1];
highA[biq_sR1] = (trebleR * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sR2];
highA[biq_sR2] = (trebleR * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midA[biq_a0]) + midA[biq_sR1];
midA[biq_sR1] = (highmidR * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sR2];
midA[biq_sR2] = (highmidR * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowA[biq_a0]) + lowA[biq_sR1];
lowA[biq_sR1] = (lowmidR * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sR2];
lowA[biq_sR2] = (lowmidR * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//first stage of three crossovers
outSample = (trebleR * highB[biq_a0]) + highB[biq_sR1];
highB[biq_sR1] = (trebleR * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sR2];
highB[biq_sR2] = (trebleR * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midB[biq_a0]) + midB[biq_sR1];
midB[biq_sR1] = (highmidR * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sR2];
midB[biq_sR2] = (highmidR * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowB[biq_a0]) + lowB[biq_sR1];
lowB[biq_sR1] = (lowmidR * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sR2];
lowB[biq_sR2] = (lowmidR * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//second stage of three crossovers
outSample = (trebleR * highC[biq_a0]) + highC[biq_sR1];
highC[biq_sR1] = (trebleR * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sR2];
highC[biq_sR2] = (trebleR * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midC[biq_a0]) + midC[biq_sR1];
midC[biq_sR1] = (highmidR * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sR2];
midC[biq_sR2] = (highmidR * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowC[biq_a0]) + lowC[biq_sR1];
lowC[biq_sR1] = (lowmidR * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sR2];
lowC[biq_sR2] = (lowmidR * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//third stage of three crossovers
highRIIR = (highRIIR*highCoef) + (trebleR*(1.0-highCoef));
highmidR = highRIIR; trebleR -= highmidR;
midRIIR = (midRIIR*midCoef) + (highmidR*(1.0-midCoef));
lowmidR = midRIIR; highmidR -= lowmidR;
lowRIIR = (lowRIIR*lowCoef) + (lowmidR*(1.0-lowCoef));
bassR = lowRIIR; lowmidR -= bassR;
inputSampleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//fourth stage of three crossovers is the exponential filters
if (!eqOff) {
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highLIIR = (highLIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highLIIR; trebleL -= highmidL;
midLIIR = (midLIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midLIIR; highmidL -= lowmidL;
lowLIIR = (lowLIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowLIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
double trebleR = inputSampleR;
outSample = (trebleR * highA[biq_a0]) + highA[biq_sR1];
highA[biq_sR1] = (trebleR * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sR2];
highA[biq_sR2] = (trebleR * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midA[biq_a0]) + midA[biq_sR1];
midA[biq_sR1] = (highmidR * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sR2];
midA[biq_sR2] = (highmidR * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowA[biq_a0]) + lowA[biq_sR1];
lowA[biq_sR1] = (lowmidR * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sR2];
lowA[biq_sR2] = (lowmidR * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//first stage of three crossovers
outSample = (trebleR * highB[biq_a0]) + highB[biq_sR1];
highB[biq_sR1] = (trebleR * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sR2];
highB[biq_sR2] = (trebleR * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midB[biq_a0]) + midB[biq_sR1];
midB[biq_sR1] = (highmidR * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sR2];
midB[biq_sR2] = (highmidR * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowB[biq_a0]) + lowB[biq_sR1];
lowB[biq_sR1] = (lowmidR * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sR2];
lowB[biq_sR2] = (lowmidR * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//second stage of three crossovers
outSample = (trebleR * highC[biq_a0]) + highC[biq_sR1];
highC[biq_sR1] = (trebleR * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sR2];
highC[biq_sR2] = (trebleR * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidR = outSample; trebleR -= highmidR;
outSample = (highmidR * midC[biq_a0]) + midC[biq_sR1];
midC[biq_sR1] = (highmidR * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sR2];
midC[biq_sR2] = (highmidR * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidR = outSample; highmidR -= lowmidR;
outSample = (lowmidR * lowC[biq_a0]) + lowC[biq_sR1];
lowC[biq_sR1] = (lowmidR * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sR2];
lowC[biq_sR2] = (lowmidR * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassR = outSample; lowmidR -= bassR;
trebleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//third stage of three crossovers
highRIIR = (highRIIR*highCoef) + (trebleR*(1.0-highCoef));
highmidR = highRIIR; trebleR -= highmidR;
midRIIR = (midRIIR*midCoef) + (highmidR*(1.0-midCoef));
lowmidR = midRIIR; highmidR -= lowmidR;
lowRIIR = (lowRIIR*lowCoef) + (lowmidR*(1.0-lowCoef));
bassR = lowRIIR; lowmidR -= bassR;
inputSampleR = (bassR*bassGain) + (lowmidR*lowmidGain) + (highmidR*highmidGain) + (trebleR*trebleGain);
//fourth stage of three crossovers is the exponential filters
}
//SmoothEQ2
if (bezCThresh > 0.0) {
inputSampleL *= ((bezCThresh*0.5)+1.0);
inputSampleR *= ((bezCThresh*0.5)+1.0);
}
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezCompF[bez_SampR] += (fabs(inputSampleR) * bezRez);
bezMaxF = fmax(bezMaxF,fmax(fabs(inputSampleL),fabs(inputSampleR)));
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezCompF[bez_CR] = bezCompF[bez_BR];
bezCompF[bez_BR] = bezCompF[bez_AR];
bezCompF[bez_AR] = bezCompF[bez_SampR];
bezCompF[bez_SampR] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage
bezCompS[bez_SampR] += (fabs(inputSampleR) * sloRez); //note: SampR is a control voltage
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
bezCompS[bez_CR] = bezCompS[bez_BR];
bezCompS[bez_BR] = bezCompS[bez_AR];
bezCompS[bez_AR] = bezCompS[bez_SampR];
bezCompS[bez_SampR] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
double CBFR = (bezCompF[bez_CR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BR]*bezCompF[bez_cycle]);
double BAFR = (bezCompF[bez_BR]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AR]*bezCompF[bez_cycle]);
double CBAFR = (bezCompF[bez_BR]+(CBFR*(1.0-bezCompF[bez_cycle]))+(BAFR*bezCompF[bez_cycle]))*0.5;
double CBSR = (bezCompS[bez_CR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BR]*bezCompS[bez_cycle]);
double BASR = (bezCompS[bez_BR]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AR]*bezCompS[bez_cycle]);
double CBASR = (bezCompS[bez_BR]+(CBSR*(1.0-bezCompS[bez_cycle]))+(BASR*bezCompS[bez_cycle]))*0.5;
CBAMax = fmax(CBASR,CBAFR); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
CBAFade = ((CBASR*-CBAMax)+(CBAFR*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleR *= 1.0-(fmin(((CBASR*(1.0-CBAFade))+(CBAFR*CBAFade))*bezCThresh,1.0));
//Dynamics2
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * bezRez);
if (bezCompF[bez_cycle] > 1.0) {
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_C] = bezCompF[bez_B];
bezCompF[bez_B] = bezCompF[bez_A];
bezCompF[bez_A] = bezCompF[bez_Ctrl];
bezCompF[bez_Ctrl] = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_Ctrl] += (fmax(fabs(inputSampleL),fabs(inputSampleR)) * sloRez);
if (bezCompS[bez_cycle] > 1.0) {
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_C] = bezCompS[bez_B];
bezCompS[bez_B] = bezCompS[bez_A];
bezCompS[bez_A] = bezCompS[bez_Ctrl];
bezCompS[bez_Ctrl] = 0.0;
}
double CBF = (bezCompF[bez_C]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_B]*bezCompF[bez_cycle]);
double BAF = (bezCompF[bez_B]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_A]*bezCompF[bez_cycle]);
double CBAF = (bezCompF[bez_B]+(CBF*(1.0-bezCompF[bez_cycle]))+(BAF*bezCompF[bez_cycle]))*0.5;
double CBS = (bezCompS[bez_C]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_B]*bezCompS[bez_cycle]);
double BAS = (bezCompS[bez_B]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_A]*bezCompS[bez_cycle]);
double CBAS = (bezCompS[bez_B]+(CBS*(1.0-bezCompS[bez_cycle]))+(BAS*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBAS,CBAF); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBAS*-CBAMax)+(CBAF*CBAMax)+1.0)*0.5;
inputSampleL *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
inputSampleR *= 1.0-(fmin(((CBAS*(1.0-CBAFade))+(CBAF*CBAFade))*bezCThresh,1.0));
} else {bezCompF[bez_Ctrl] = 0.0; bezCompS[bez_Ctrl] = 0.0;}
//Dynamics2 custom version for buss
const double temp = (double)nSampleFrames/inFramesToProcess;
double gainR = (panA*temp)+(panB*(1.0-temp));
@ -698,48 +684,39 @@ OSStatus ConsoleX2Buss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
darkSampleL /= 2.0; darkSampleR /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
double avgSlewL = fmin(lastSlewL*lastSlewL*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223);
lastSlewR += fabs(lastSlewpleR-inputSampleR); lastSlewpleR = inputSampleR;
double avgSlewR = fmin(lastSlewR,1.0);
double avgSlewR = fmin(lastSlewR*lastSlewR*(0.0635-(overallscale*0.0018436)),1.0);
lastSlewR = fmax(lastSlewR*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
inputSampleR = (inputSampleR*(1.0-avgSlewR)) + (darkSampleR*avgSlewR);
//begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleL *= 0.92;
//end TapeHack section
inputSampleL = fmin(fmax(inputSampleL,-2.032610446872596),2.032610446872596);
long double X = inputSampleL * inputSampleL;
long double sat = inputSampleL * X;
inputSampleL -= (sat*0.125); sat *= X;
inputSampleL += (sat*0.0078125); sat *= X;
inputSampleL -= (sat*0.000244140625); sat *= X;
inputSampleL += (sat*0.000003814697265625); sat *= X;
inputSampleL -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//begin TapeHack section
inputSampleR = fmax(fmin(inputSampleR,2.305929007734908),-2.305929007734908);
addtwo = inputSampleR * inputSampleR;
empower = inputSampleR * addtwo; // inputSampleR to the third power
inputSampleR -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleR += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleR -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleR += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleR -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
inputSampleR *= 0.92;
//end TapeHack section
//Discontapeity
inputSampleR = fmin(fmax(inputSampleR,-2.032610446872596),2.032610446872596);
X = inputSampleR * inputSampleR;
sat = inputSampleR * X;
inputSampleR -= (sat*0.125); sat *= X;
inputSampleR += (sat*0.0078125); sat *= X;
inputSampleR -= (sat*0.000244140625); sat *= X;
inputSampleR += (sat*0.000003814697265625); sat *= X;
inputSampleR -= (sat*0.0000000298023223876953125); sat *= X;
//purestsaturation: sine, except all the corrections
//retain mantissa of a long double increasing power function
//we are leaving it as a clip that will go over 0dB.
//it is a softclip so it will give you a more forgiving experience,
//but you are meant to not drive the softclip for just level.
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);

View file

@ -54,45 +54,49 @@
#pragma mark ____ConsoleX2Buss Parameters
// parameters
static const float kDefaultValue_ParamA = 0.5;
static const float kDefaultValue_ParamB = 0.5;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.5;
static const float kDefaultValue_ParamE = 0.5;
static const float kDefaultValue_ParamF = 0.5;
static const float kDefaultValue_ParamG = 0.5;
static const float kDefaultValue_ParamH = 0.5;
static const float kDefaultValue_ParamI = 1.0;
static const float kDefaultValue_ParamJ = 0.5;
static const float kDefaultValue_ParamK = 0.5;
static const float kDefaultValue_ParamHIG = 0.5;
static const float kDefaultValue_ParamHMG = 0.5;
static const float kDefaultValue_ParamLMG = 0.5;
static const float kDefaultValue_ParamBSG = 0.5;
static CFStringRef kParameterAUnit = CFSTR("eq");
static CFStringRef kParameterAName = CFSTR("High");
static CFStringRef kParameterBName = CFSTR("HMid");
static CFStringRef kParameterCName = CFSTR("LMid");
static CFStringRef kParameterDName = CFSTR("Bass");
static CFStringRef kParameterEUnit = CFSTR("freq");
static CFStringRef kParameterEName = CFSTR("HighF");
static CFStringRef kParameterFName = CFSTR("HMidF");
static CFStringRef kParameterGName = CFSTR("LMidF");
static CFStringRef kParameterHName = CFSTR("BassF");
static CFStringRef kParameterIUnit = CFSTR("dyn");
static CFStringRef kParameterIName = CFSTR("Thresh");
static CFStringRef kParameterJName = CFSTR("Pan");
static CFStringRef kParameterKName = CFSTR("Fader");
static const float kDefaultValue_ParamHIF = 0.5;
static const float kDefaultValue_ParamHMF = 0.5;
static const float kDefaultValue_ParamLMF = 0.5;
static const float kDefaultValue_ParamBSF = 0.5;
static const float kDefaultValue_ParamTHR = 1.0;
static const float kDefaultValue_ParamPAN = 0.5;
static const float kDefaultValue_ParamFAD = 0.5;
static CFStringRef kParameterHIGUnit = CFSTR("eq");
static CFStringRef kParameterHIGName = CFSTR("High");
static CFStringRef kParameterHMGName = CFSTR("HMid");
static CFStringRef kParameterLMGName = CFSTR("LMid");
static CFStringRef kParameterBSGName = CFSTR("Bass");
static CFStringRef kParameterHIFUnit = CFSTR("freq");
static CFStringRef kParameterHIFName = CFSTR("HighF");
static CFStringRef kParameterHMFName = CFSTR("HMidF");
static CFStringRef kParameterLMFName = CFSTR("LMidF");
static CFStringRef kParameterBSFName = CFSTR("BassF");
static CFStringRef kParameterTHRUnit = CFSTR("dyn");
static CFStringRef kParameterTHRName = CFSTR("Thresh");
static CFStringRef kParameterPANName = CFSTR("Pan");
static CFStringRef kParameterFADName = CFSTR("Fader");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
kParam_K =10,
kParam_HIG =0,
kParam_HMG =1,
kParam_LMG =2,
kParam_BSG =3,
kParam_HIF =4,
kParam_HMF =5,
kParam_LMF =6,
kParam_BSF =7,
kParam_THR =8,
kParam_PAN =9,
kParam_FAD =10,
//Add your parameters here...
kNumberOfParameters=11
};
@ -155,7 +159,7 @@ public:
biq_sR1,
biq_sR2,
biq_total
}; //coefficient interpolating bessel filter, stereo
}; //coefficient interpolating filter, stereo
double highA[biq_total];
double highB[biq_total];
double highC[biq_total];
@ -176,25 +180,16 @@ public:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
//Dynamics2
//Dynamics2 custom for buss
double avg32L[33];
double avg32R[33];
@ -217,6 +212,7 @@ public:
double panB;
double inTrimA;
double inTrimB;
uint32_t fpdL;
uint32_t fpdR;
};

File diff suppressed because it is too large Load diff

View file

@ -54,67 +54,75 @@
#pragma mark ____ConsoleX2Channel Parameters
// parameters
static const int kDefaultValue_ParamA = 1;
static const float kDefaultValue_ParamB = 0.0;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.5;
static const float kDefaultValue_ParamE = 0.5;
static const float kDefaultValue_ParamF = 0.5;
static const float kDefaultValue_ParamG = 0.5;
static const float kDefaultValue_ParamH = 0.5;
static const float kDefaultValue_ParamI = 0.5;
static const float kDefaultValue_ParamJ = 0.5;
static const float kDefaultValue_ParamK = 1.0;
static const float kDefaultValue_ParamL = 0.5;
static const float kDefaultValue_ParamM = 0.5;
static const float kDefaultValue_ParamN = 0.0;
static const float kDefaultValue_ParamO = 1.0;
static const float kDefaultValue_ParamP = 0.0;
static const float kDefaultValue_ParamQ = 0.5;
static const float kDefaultValue_ParamR = 0.5;
static const int kDefaultValue_ParamTRM = 1;
static const float kDefaultValue_ParamMOR = 0.0;
static CFStringRef kParameterAName = CFSTR("Trim");
static CFStringRef kParameterBName = CFSTR("More");
static CFStringRef kParameterCUnit = CFSTR("eq");
static CFStringRef kParameterCName = CFSTR("High");
static CFStringRef kParameterDName = CFSTR("HMid");
static CFStringRef kParameterEName = CFSTR("LMid");
static CFStringRef kParameterFName = CFSTR("Bass");
static CFStringRef kParameterGUnit = CFSTR("freq");
static CFStringRef kParameterGName = CFSTR("HighF");
static CFStringRef kParameterHName = CFSTR("HMidF");
static CFStringRef kParameterIName = CFSTR("LMidF");
static CFStringRef kParameterJName = CFSTR("BassF");
static CFStringRef kParameterKUnit = CFSTR("dyn");
static CFStringRef kParameterKName = CFSTR("Thresh");
static CFStringRef kParameterLName = CFSTR("Attack");
static CFStringRef kParameterMName = CFSTR("Release");
static CFStringRef kParameterNName = CFSTR("Gate");
static CFStringRef kParameterOUnit = CFSTR("fltr");
static CFStringRef kParameterOName = CFSTR("Lowpass");
static CFStringRef kParameterPName = CFSTR("Hipass");
static CFStringRef kParameterQName = CFSTR("Pan");
static CFStringRef kParameterRName = CFSTR("Fader");
static const float kDefaultValue_ParamHIG = 0.5;
static const float kDefaultValue_ParamHMG = 0.5;
static const float kDefaultValue_ParamLMG = 0.5;
static const float kDefaultValue_ParamBSG = 0.5;
static const float kDefaultValue_ParamHIF = 0.5;
static const float kDefaultValue_ParamHMF = 0.5;
static const float kDefaultValue_ParamLMF = 0.5;
static const float kDefaultValue_ParamBSF = 0.5;
static const float kDefaultValue_ParamTHR = 1.0;
static const float kDefaultValue_ParamATK = 0.5;
static const float kDefaultValue_ParamRLS = 0.5;
static const float kDefaultValue_ParamGAT = 0.0;
static const float kDefaultValue_ParamLOP = 1.0;
static const float kDefaultValue_ParamHIP = 0.0;
static const float kDefaultValue_ParamPAN = 0.5;
static const float kDefaultValue_ParamFAD = 0.5;
static CFStringRef kParameterTRMName = CFSTR("Trim");
static CFStringRef kParameterMORName = CFSTR("More");
static CFStringRef kParameterHIGUnit = CFSTR("eq");
static CFStringRef kParameterHIGName = CFSTR("High");
static CFStringRef kParameterHMGName = CFSTR("HMid");
static CFStringRef kParameterLMGName = CFSTR("LMid");
static CFStringRef kParameterBSGName = CFSTR("Bass");
static CFStringRef kParameterHIFUnit = CFSTR("freq");
static CFStringRef kParameterHIFName = CFSTR("HighF");
static CFStringRef kParameterHMFName = CFSTR("HMidF");
static CFStringRef kParameterLMFName = CFSTR("LMidF");
static CFStringRef kParameterBSFName = CFSTR("BassF");
static CFStringRef kParameterTHRUnit = CFSTR("dyn");
static CFStringRef kParameterTHRName = CFSTR("Thresh");
static CFStringRef kParameterATKName = CFSTR("Attack");
static CFStringRef kParameterRLSName = CFSTR("Release");
static CFStringRef kParameterGATName = CFSTR("Gate");
static CFStringRef kParameterLOPUnit = CFSTR("fltr");
static CFStringRef kParameterLOPName = CFSTR("Lowpass");
static CFStringRef kParameterHIPName = CFSTR("Hipass");
static CFStringRef kParameterPANName = CFSTR("Pan");
static CFStringRef kParameterFADName = CFSTR("Fader");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
kParam_K =10,
kParam_L =11,
kParam_M =12,
kParam_N =13,
kParam_O =14,
kParam_P =15,
kParam_Q =16,
kParam_R =17,
kParam_TRM =0,
kParam_MOR =1,
kParam_HIG =2,
kParam_HMG =3,
kParam_LMG =4,
kParam_BSG =5,
kParam_HIF =6,
kParam_HMF =7,
kParam_LMF =8,
kParam_BSF =9,
kParam_THR =10,
kParam_ATK =11,
kParam_RLS =12,
kParam_GAT =13,
kParam_LOP =14,
kParam_HIP =15,
kParam_PAN =16,
kParam_FAD =17,
//Add your parameters here...
kNumberOfParameters=18
};
@ -200,26 +208,18 @@ public:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_AR,
bez_BR,
bez_CR,
bez_InR,
bez_UnInR,
bez_SampR,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPositionL[23];
double iirHAngleL[23];

View file

@ -59,23 +59,23 @@ ConsoleX2Pre::ConsoleX2Pre(AudioUnit component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
SetParameter(kParam_E, kDefaultValue_ParamE );
SetParameter(kParam_F, kDefaultValue_ParamF );
SetParameter(kParam_G, kDefaultValue_ParamG );
SetParameter(kParam_H, kDefaultValue_ParamH );
SetParameter(kParam_I, kDefaultValue_ParamI );
SetParameter(kParam_J, kDefaultValue_ParamJ );
SetParameter(kParam_K, kDefaultValue_ParamK );
SetParameter(kParam_L, kDefaultValue_ParamL );
SetParameter(kParam_M, kDefaultValue_ParamM );
SetParameter(kParam_N, kDefaultValue_ParamN );
SetParameter(kParam_O, kDefaultValue_ParamO );
SetParameter(kParam_P, kDefaultValue_ParamP );
SetParameter(kParam_Q, kDefaultValue_ParamQ );
SetParameter(kParam_TRM, kDefaultValue_ParamTRM );
SetParameter(kParam_MOR, kDefaultValue_ParamMOR );
SetParameter(kParam_HIG, kDefaultValue_ParamHIG );
SetParameter(kParam_HMG, kDefaultValue_ParamHMG );
SetParameter(kParam_LMG, kDefaultValue_ParamLMG );
SetParameter(kParam_BSG, kDefaultValue_ParamBSG );
SetParameter(kParam_HIF, kDefaultValue_ParamHIF );
SetParameter(kParam_HMF, kDefaultValue_ParamHMF );
SetParameter(kParam_LMF, kDefaultValue_ParamLMF );
SetParameter(kParam_BSF, kDefaultValue_ParamBSF );
SetParameter(kParam_THR, kDefaultValue_ParamTHR );
SetParameter(kParam_ATK, kDefaultValue_ParamATK );
SetParameter(kParam_RLS, kDefaultValue_ParamRLS );
SetParameter(kParam_GAT, kDefaultValue_ParamGAT );
SetParameter(kParam_LOP, kDefaultValue_ParamLOP );
SetParameter(kParam_HIP, kDefaultValue_ParamHIP );
SetParameter(kParam_FAD, kDefaultValue_ParamFAD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
@ -112,128 +112,128 @@ ComponentResult ConsoleX2Pre::GetParameterInfo(AudioUnitScope inScope,
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
case kParam_TRM:
AUBase::FillInParameterName (outParameterInfo, kParameterTRMName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Indexed;
outParameterInfo.minValue = 0;
outParameterInfo.maxValue = 4;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
outParameterInfo.defaultValue = kDefaultValue_ParamTRM;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
case kParam_MOR:
AUBase::FillInParameterName (outParameterInfo, kParameterMORName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
outParameterInfo.defaultValue = kDefaultValue_ParamMOR;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
case kParam_HIG:
AUBase::FillInParameterName (outParameterInfo, kParameterHIGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterCUnit;
outParameterInfo.unitName = kParameterHIGUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
outParameterInfo.defaultValue = kDefaultValue_ParamHIG;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
case kParam_HMG:
AUBase::FillInParameterName (outParameterInfo, kParameterHMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
outParameterInfo.defaultValue = kDefaultValue_ParamHMG;
break;
case kParam_E:
AUBase::FillInParameterName (outParameterInfo, kParameterEName, false);
case kParam_LMG:
AUBase::FillInParameterName (outParameterInfo, kParameterLMGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamE;
outParameterInfo.defaultValue = kDefaultValue_ParamLMG;
break;
case kParam_F:
AUBase::FillInParameterName (outParameterInfo, kParameterFName, false);
case kParam_BSG:
AUBase::FillInParameterName (outParameterInfo, kParameterBSGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
outParameterInfo.defaultValue = kDefaultValue_ParamBSG;
break;
case kParam_G:
AUBase::FillInParameterName (outParameterInfo, kParameterGName, false);
case kParam_HIF:
AUBase::FillInParameterName (outParameterInfo, kParameterHIFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterGUnit;
outParameterInfo.unitName = kParameterHIFUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamG;
outParameterInfo.defaultValue = kDefaultValue_ParamHIF;
break;
case kParam_H:
AUBase::FillInParameterName (outParameterInfo, kParameterHName, false);
case kParam_HMF:
AUBase::FillInParameterName (outParameterInfo, kParameterHMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamH;
outParameterInfo.defaultValue = kDefaultValue_ParamHMF;
break;
case kParam_I:
AUBase::FillInParameterName (outParameterInfo, kParameterIName, false);
case kParam_LMF:
AUBase::FillInParameterName (outParameterInfo, kParameterLMFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamI;
outParameterInfo.defaultValue = kDefaultValue_ParamLMF;
break;
case kParam_J:
AUBase::FillInParameterName (outParameterInfo, kParameterJName, false);
case kParam_BSF:
AUBase::FillInParameterName (outParameterInfo, kParameterBSFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamJ;
outParameterInfo.defaultValue = kDefaultValue_ParamBSF;
break;
case kParam_K:
AUBase::FillInParameterName (outParameterInfo, kParameterKName, false);
case kParam_THR:
AUBase::FillInParameterName (outParameterInfo, kParameterTHRName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterKUnit;
outParameterInfo.unitName = kParameterTHRUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamK;
outParameterInfo.defaultValue = kDefaultValue_ParamTHR;
break;
case kParam_L:
AUBase::FillInParameterName (outParameterInfo, kParameterLName, false);
case kParam_ATK:
AUBase::FillInParameterName (outParameterInfo, kParameterATKName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamL;
outParameterInfo.defaultValue = kDefaultValue_ParamATK;
break;
case kParam_M:
AUBase::FillInParameterName (outParameterInfo, kParameterMName, false);
case kParam_RLS:
AUBase::FillInParameterName (outParameterInfo, kParameterRLSName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamM;
outParameterInfo.defaultValue = kDefaultValue_ParamRLS;
break;
case kParam_N:
AUBase::FillInParameterName (outParameterInfo, kParameterNName, false);
case kParam_GAT:
AUBase::FillInParameterName (outParameterInfo, kParameterGATName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamN;
outParameterInfo.defaultValue = kDefaultValue_ParamGAT;
break;
case kParam_O:
AUBase::FillInParameterName (outParameterInfo, kParameterOName, false);
case kParam_LOP:
AUBase::FillInParameterName (outParameterInfo, kParameterLOPName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_CustomUnit;
outParameterInfo.unitName = kParameterOUnit;
outParameterInfo.unitName = kParameterLOPUnit;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamO;
outParameterInfo.defaultValue = kDefaultValue_ParamLOP;
break;
case kParam_P:
AUBase::FillInParameterName (outParameterInfo, kParameterPName, false);
case kParam_HIP:
AUBase::FillInParameterName (outParameterInfo, kParameterHIPName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamP;
outParameterInfo.defaultValue = kDefaultValue_ParamHIP;
break;
case kParam_Q:
AUBase::FillInParameterName (outParameterInfo, kParameterQName, false);
case kParam_FAD:
AUBase::FillInParameterName (outParameterInfo, kParameterFADName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamQ;
outParameterInfo.defaultValue = kDefaultValue_ParamFAD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
@ -306,10 +306,10 @@ void ConsoleX2Pre::ConsoleX2PreKernel::Reset()
lowIIR = 0.0;
//SmoothEQ2
for (int x = 0; x < bez_total; x++) {bezCompF[x] = 0.0;bezCompS[x] = 0.0;}
bezCompF[bez_cycle] = 1.0; bezMaxF = 0.0;
bezCompS[bez_cycle] = 1.0; bezGate = 2.0;
//Dynamics2
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
for(int count = 0; count < 22; count++) {
iirHPosition[count] = 0.0;
@ -366,323 +366,321 @@ void ConsoleX2Pre::ConsoleX2PreKernel::Process( const Float32 *inSourceP,
int spacing = floor(overallscale*2.0);
if (spacing < 2) spacing = 2; if (spacing > 32) spacing = 32;
double moreTapeHack = (GetParameter( kParam_B )*2.0)+1.0;
switch ((int)GetParameter( kParam_A )){
double moreTapeHack = (GetParameter( kParam_MOR )*2.0)+1.0;
bool tapehackOff = (GetParameter( kParam_MOR ) == 0.0);
switch ((int)GetParameter( kParam_TRM )){
case 0: moreTapeHack *= 0.5; break;
case 1: break;
case 2: moreTapeHack *= 2.0; break;
case 3: moreTapeHack *= 4.0; break;
case 4: moreTapeHack *= 8.0; break;
}
double moreDiscontinuity = fmax(pow(GetParameter( kParam_B )*0.42,3.0)*overallscale,0.00001);
double moreDiscontinuity = fmax(pow(GetParameter( kParam_MOR )*0.42,3.0)*overallscale,0.00001);
//Discontapeity
double trebleGain = (GetParameter( kParam_C )-0.5)*2.0;
double trebleGain = (GetParameter( kParam_HIG )-0.5)*2.0;
trebleGain = 1.0+(trebleGain*fabs(trebleGain)*fabs(trebleGain));
double highmidGain = (GetParameter( kParam_D )-0.5)*2.0;
double highmidGain = (GetParameter( kParam_HMG )-0.5)*2.0;
highmidGain = 1.0+(highmidGain*fabs(highmidGain)*fabs(highmidGain));
double lowmidGain = (GetParameter( kParam_E )-0.5)*2.0;
double lowmidGain = (GetParameter( kParam_LMG )-0.5)*2.0;
lowmidGain = 1.0+(lowmidGain*fabs(lowmidGain)*fabs(lowmidGain));
double bassGain = (GetParameter( kParam_F )-0.5)*2.0;
double bassGain = (GetParameter( kParam_BSG )-0.5)*2.0;
bassGain = 1.0+(bassGain*fabs(bassGain)*fabs(bassGain));
double highCoef = 0.0;
double midCoef = 0.0;
double lowCoef = 0.0;
double trebleRef = GetParameter( kParam_G )-0.5;
double highmidRef = GetParameter( kParam_H )-0.5;
double lowmidRef = GetParameter( kParam_I )-0.5;
double bassRef = GetParameter( kParam_J )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
double highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
double lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
bool eqOff = (trebleGain == 1.0 && highmidGain == 1.0 && lowmidGain == 1.0 && bassGain == 1.0);
//we get to completely bypass EQ if we're truly not using it. The mechanics of it mean that
//it cancels out to bit-identical anyhow, but we get to skip the calculation
if (!eqOff) {
double trebleRef = GetParameter( kParam_HIF )-0.5;
double highmidRef = GetParameter( kParam_HMF )-0.5;
double lowmidRef = GetParameter( kParam_LMF )-0.5;
double bassRef = GetParameter( kParam_BSF )-0.5;
double highF = 0.75 + ((trebleRef+trebleRef+trebleRef+highmidRef)*0.125);
double bassF = 0.25 + ((lowmidRef+bassRef+bassRef+bassRef)*0.125);
double midF = (highF*0.5) + (bassF*0.5) + ((highmidRef+lowmidRef)*0.125);
double highQ = fmax(fmin(1.0+(highmidRef-trebleRef),4.0),0.125);
double midQ = fmax(fmin(1.0+(lowmidRef-highmidRef),4.0),0.125);
double lowQ = fmax(fmin(1.0+(bassRef-lowmidRef),4.0),0.125);
highA[biq_freq] = ((pow(highF,3)*20000.0)/GetSampleRate());
highC[biq_freq] = highB[biq_freq] = highA[biq_freq] = fmax(fmin(highA[biq_freq],0.4999),0.00025);
double highFreq = pow(highF,3)*20000.0;
double omega = 2.0*M_PI*(highFreq/GetSampleRate());
double biqK = 2.0-cos(omega);
highCoef = -sqrt((biqK*biqK)-1.0)+biqK;
highA[biq_reso] = 2.24697960 * highQ;
highB[biq_reso] = 0.80193774 * highQ;
highC[biq_reso] = 0.55495813 * highQ;
midA[biq_freq] = ((pow(midF,3)*20000.0)/GetSampleRate());
midC[biq_freq] = midB[biq_freq] = midA[biq_freq] = fmax(fmin(midA[biq_freq],0.4999),0.00025);
double midFreq = pow(midF,3)*20000.0;
omega = 2.0*M_PI*(midFreq/GetSampleRate());
biqK = 2.0-cos(omega);
midCoef = -sqrt((biqK*biqK)-1.0)+biqK;
midA[biq_reso] = 2.24697960 * midQ;
midB[biq_reso] = 0.80193774 * midQ;
midC[biq_reso] = 0.55495813 * midQ;
lowA[biq_freq] = ((pow(bassF,3)*20000.0)/GetSampleRate());
lowC[biq_freq] = lowB[biq_freq] = lowA[biq_freq] = fmax(fmin(lowA[biq_freq],0.4999),0.00025);
double lowFreq = pow(bassF,3)*20000.0;
omega = 2.0*M_PI*(lowFreq/GetSampleRate());
biqK = 2.0-cos(omega);
lowCoef = -sqrt((biqK*biqK)-1.0)+biqK;
lowA[biq_reso] = 2.24697960 * lowQ;
lowB[biq_reso] = 0.80193774 * lowQ;
lowC[biq_reso] = 0.55495813 * lowQ;
biqK = tan(M_PI * highA[biq_freq]);
double norm = 1.0 / (1.0 + biqK / highA[biq_reso] + biqK * biqK);
highA[biq_a0] = biqK * biqK * norm;
highA[biq_a1] = 2.0 * highA[biq_a0];
highA[biq_a2] = highA[biq_a0];
highA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highA[biq_b2] = (1.0 - biqK / highA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highB[biq_freq]);
norm = 1.0 / (1.0 + biqK / highB[biq_reso] + biqK * biqK);
highB[biq_a0] = biqK * biqK * norm;
highB[biq_a1] = 2.0 * highB[biq_a0];
highB[biq_a2] = highB[biq_a0];
highB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highB[biq_b2] = (1.0 - biqK / highB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * highC[biq_freq]);
norm = 1.0 / (1.0 + biqK / highC[biq_reso] + biqK * biqK);
highC[biq_a0] = biqK * biqK * norm;
highC[biq_a1] = 2.0 * highC[biq_a0];
highC[biq_a2] = highC[biq_a0];
highC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
highC[biq_b2] = (1.0 - biqK / highC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midA[biq_freq]);
norm = 1.0 / (1.0 + biqK / midA[biq_reso] + biqK * biqK);
midA[biq_a0] = biqK * biqK * norm;
midA[biq_a1] = 2.0 * midA[biq_a0];
midA[biq_a2] = midA[biq_a0];
midA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midA[biq_b2] = (1.0 - biqK / midA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midB[biq_freq]);
norm = 1.0 / (1.0 + biqK / midB[biq_reso] + biqK * biqK);
midB[biq_a0] = biqK * biqK * norm;
midB[biq_a1] = 2.0 * midB[biq_a0];
midB[biq_a2] = midB[biq_a0];
midB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midB[biq_b2] = (1.0 - biqK / midB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * midC[biq_freq]);
norm = 1.0 / (1.0 + biqK / midC[biq_reso] + biqK * biqK);
midC[biq_a0] = biqK * biqK * norm;
midC[biq_a1] = 2.0 * midC[biq_a0];
midC[biq_a2] = midC[biq_a0];
midC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
midC[biq_b2] = (1.0 - biqK / midC[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowA[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowA[biq_reso] + biqK * biqK);
lowA[biq_a0] = biqK * biqK * norm;
lowA[biq_a1] = 2.0 * lowA[biq_a0];
lowA[biq_a2] = lowA[biq_a0];
lowA[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowA[biq_b2] = (1.0 - biqK / lowA[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowB[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowB[biq_reso] + biqK * biqK);
lowB[biq_a0] = biqK * biqK * norm;
lowB[biq_a1] = 2.0 * lowB[biq_a0];
lowB[biq_a2] = lowB[biq_a0];
lowB[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowB[biq_b2] = (1.0 - biqK / lowB[biq_reso] + biqK * biqK) * norm;
biqK = tan(M_PI * lowC[biq_freq]);
norm = 1.0 / (1.0 + biqK / lowC[biq_reso] + biqK * biqK);
lowC[biq_a0] = biqK * biqK * norm;
lowC[biq_a1] = 2.0 * lowC[biq_a0];
lowC[biq_a2] = lowC[biq_a0];
lowC[biq_b1] = 2.0 * (biqK * biqK - 1.0) * norm;
lowC[biq_b2] = (1.0 - biqK / lowC[biq_reso] + biqK * biqK) * norm;
}
//SmoothEQ2
double bezCThresh = pow(1.0-GetParameter( kParam_K ), 6.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_L ), 8.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_M ),12.0) / overallscale;
sloRez = fmin(fmax(sloRez-(bezRez*0.5),0.00001),1.0);
double bezThresh = pow(1.0-GetParameter( kParam_THR ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_ATK ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_RLS ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_GAT ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
double gate = pow(pow(GetParameter( kParam_N ),4.0),sqrt(bezCThresh+1.0));
//Dynamics2
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_O ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_P ),overallscale+2.0); //the highpass
lFreqA = lFreqB; lFreqB = pow(fmax(GetParameter( kParam_LOP ),0.002),overallscale); //the lowpass
hFreqA = hFreqB; hFreqB = pow(GetParameter( kParam_HIP ),overallscale+2.0); //the highpass
//Cabs2
inTrimA = inTrimB; inTrimB = GetParameter( kParam_Q )*2.0;
inTrimA = inTrimB; inTrimB = GetParameter( kParam_FAD )*2.0;
//Console
while (nSampleFrames-- > 0) {
double inputSampleL = *sourceP;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpd * 1.18e-17;
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreTapeHack;
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//trim control gets to work even when MORE is off
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
if (!tapehackOff) {
double darkSampleL = inputSampleL;
if (avgPos > 31) avgPos = 0;
if (spacing > 31) {
avg32L[avgPos] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 32; x++) {darkSampleL += avg32L[x];}
darkSampleL /= 32.0;
} if (spacing > 15) {
avg16L[avgPos%16] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 16; x++) {darkSampleL += avg16L[x];}
darkSampleL /= 16.0;
} if (spacing > 7) {
avg8L[avgPos%8] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 8; x++) {darkSampleL += avg8L[x];}
darkSampleL /= 8.0;
} if (spacing > 3) {
avg4L[avgPos%4] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 4; x++) {darkSampleL += avg4L[x];}
darkSampleL /= 4.0;
} if (spacing > 1) {
avg2L[avgPos%2] = darkSampleL;
darkSampleL = 0.0;
for (int x = 0; x < 2; x++) {darkSampleL += avg2L[x];}
darkSampleL /= 2.0;
} avgPos++;
lastSlewL += fabs(lastSlewpleL-inputSampleL); lastSlewpleL = inputSampleL;
double avgSlewL = fmin(lastSlewL,1.0);
lastSlewL = fmax(lastSlewL*0.78,2.39996322972865332223); //look up Golden Angle, it's cool
inputSampleL = (inputSampleL*(1.0-avgSlewL)) + (darkSampleL*avgSlewL);
//begin Discontinuity section
inputSampleL *= moreDiscontinuity;
dBaL[dBaXL] = inputSampleL; dBaPosL *= 0.5; dBaPosL += fabs((inputSampleL*((inputSampleL*0.25)-0.5))*0.5);
dBaPosL = fmin(dBaPosL,1.0);
int dBdly = floor(dBaPosL*dscBuf);
double dBi = (dBaPosL*dscBuf)-dBdly;
inputSampleL = dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*(1.0-dBi);
dBdly++; inputSampleL += dBaL[dBaXL-dBdly +((dBaXL-dBdly < 0)?dscBuf:0)]*dBi;
dBaXL++; if (dBaXL < 0 || dBaXL >= dscBuf) dBaXL = 0;
inputSampleL /= moreDiscontinuity;
//end Discontinuity section, begin TapeHack section
inputSampleL = fmax(fmin(inputSampleL,2.305929007734908),-2.305929007734908);
double addtwo = inputSampleL * inputSampleL;
double empower = inputSampleL * addtwo; // inputSampleL to the third power
inputSampleL -= (empower / 6.0);
empower *= addtwo; // to the fifth power
inputSampleL += (empower / 69.0);
empower *= addtwo; //seventh
inputSampleL -= (empower / 2530.08);
empower *= addtwo; //ninth
inputSampleL += (empower / 224985.6);
empower *= addtwo; //eleventh
inputSampleL -= (empower / 9979200.0f);
//this is a degenerate form of a Taylor Series to approximate sin()
//end TapeHack section
//Discontapeity
}
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highIIR = (highIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highIIR; trebleL -= highmidL;
midIIR = (midIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midIIR; highmidL -= lowmidL;
lowIIR = (lowIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
if (!eqOff) {
double trebleL = inputSampleL;
double outSample = (trebleL * highA[biq_a0]) + highA[biq_sL1];
highA[biq_sL1] = (trebleL * highA[biq_a1]) - (outSample * highA[biq_b1]) + highA[biq_sL2];
highA[biq_sL2] = (trebleL * highA[biq_a2]) - (outSample * highA[biq_b2]);
double highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midA[biq_a0]) + midA[biq_sL1];
midA[biq_sL1] = (highmidL * midA[biq_a1]) - (outSample * midA[biq_b1]) + midA[biq_sL2];
midA[biq_sL2] = (highmidL * midA[biq_a2]) - (outSample * midA[biq_b2]);
double lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowA[biq_a0]) + lowA[biq_sL1];
lowA[biq_sL1] = (lowmidL * lowA[biq_a1]) - (outSample * lowA[biq_b1]) + lowA[biq_sL2];
lowA[biq_sL2] = (lowmidL * lowA[biq_a2]) - (outSample * lowA[biq_b2]);
double bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//first stage of three crossovers
outSample = (trebleL * highB[biq_a0]) + highB[biq_sL1];
highB[biq_sL1] = (trebleL * highB[biq_a1]) - (outSample * highB[biq_b1]) + highB[biq_sL2];
highB[biq_sL2] = (trebleL * highB[biq_a2]) - (outSample * highB[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midB[biq_a0]) + midB[biq_sL1];
midB[biq_sL1] = (highmidL * midB[biq_a1]) - (outSample * midB[biq_b1]) + midB[biq_sL2];
midB[biq_sL2] = (highmidL * midB[biq_a2]) - (outSample * midB[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowB[biq_a0]) + lowB[biq_sL1];
lowB[biq_sL1] = (lowmidL * lowB[biq_a1]) - (outSample * lowB[biq_b1]) + lowB[biq_sL2];
lowB[biq_sL2] = (lowmidL * lowB[biq_a2]) - (outSample * lowB[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//second stage of three crossovers
outSample = (trebleL * highC[biq_a0]) + highC[biq_sL1];
highC[biq_sL1] = (trebleL * highC[biq_a1]) - (outSample * highC[biq_b1]) + highC[biq_sL2];
highC[biq_sL2] = (trebleL * highC[biq_a2]) - (outSample * highC[biq_b2]);
highmidL = outSample; trebleL -= highmidL;
outSample = (highmidL * midC[biq_a0]) + midC[biq_sL1];
midC[biq_sL1] = (highmidL * midC[biq_a1]) - (outSample * midC[biq_b1]) + midC[biq_sL2];
midC[biq_sL2] = (highmidL * midC[biq_a2]) - (outSample * midC[biq_b2]);
lowmidL = outSample; highmidL -= lowmidL;
outSample = (lowmidL * lowC[biq_a0]) + lowC[biq_sL1];
lowC[biq_sL1] = (lowmidL * lowC[biq_a1]) - (outSample * lowC[biq_b1]) + lowC[biq_sL2];
lowC[biq_sL2] = (lowmidL * lowC[biq_a2]) - (outSample * lowC[biq_b2]);
bassL = outSample; lowmidL -= bassL;
trebleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//third stage of three crossovers
highIIR = (highIIR*highCoef) + (trebleL*(1.0-highCoef));
highmidL = highIIR; trebleL -= highmidL;
midIIR = (midIIR*midCoef) + (highmidL*(1.0-midCoef));
lowmidL = midIIR; highmidL -= lowmidL;
lowIIR = (lowIIR*lowCoef) + (lowmidL*(1.0-lowCoef));
bassL = lowIIR; lowmidL -= bassL;
inputSampleL = (bassL*bassGain) + (lowmidL*lowmidGain) + (highmidL*highmidGain) + (trebleL*trebleGain);
//fourth stage of three crossovers is the exponential filters
}
//SmoothEQ2
if (fabs(inputSampleL) > gate+(sloRez*bezGate)) bezGate = ((bezGate*overallscale*3.0)+3.0)*(0.25/overallscale);
else bezGate = fmax(0.0, bezGate-(sloRez*sloRez));
if (bezCThresh > 0.0) inputSampleL *= ((bezCThresh*0.5)+1.0);
bezCompF[bez_cycle] += bezRez;
bezCompF[bez_SampL] += (fabs(inputSampleL) * bezRez);
bezMaxF = fmax(bezMaxF,fabs(inputSampleL));
if (bezCompF[bez_cycle] > 1.0) {
if (bezMaxF < gate) bezCompF[bez_SampL] = bezMaxF/gate; //note: SampL is a control voltage,
if (bezCompF[bez_SampL]<gate) bezCompF[bez_SampL] = 0.0; //not a bipolar audio signal
bezCompF[bez_cycle] -= 1.0;
bezCompF[bez_CL] = bezCompF[bez_BL];
bezCompF[bez_BL] = bezCompF[bez_AL];
bezCompF[bez_AL] = bezCompF[bez_SampL];
bezCompF[bez_SampL] = 0.0;
bezMaxF = 0.0;
}
bezCompS[bez_cycle] += sloRez;
bezCompS[bez_SampL] += (fabs(inputSampleL) * sloRez); //note: SampL is a control voltage.
if (bezCompS[bez_cycle] > 1.0) {
if (bezCompS[bez_SampL]<gate) bezCompS[bez_SampL] = 0.0;
bezCompS[bez_cycle] -= 1.0;
bezCompS[bez_CL] = bezCompS[bez_BL];
bezCompS[bez_BL] = bezCompS[bez_AL];
bezCompS[bez_AL] = bezCompS[bez_SampL];
bezCompS[bez_SampL] = 0.0;
}
double CBFL = (bezCompF[bez_CL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_BL]*bezCompF[bez_cycle]);
double BAFL = (bezCompF[bez_BL]*(1.0-bezCompF[bez_cycle]))+(bezCompF[bez_AL]*bezCompF[bez_cycle]);
double CBAFL = (bezCompF[bez_BL]+(CBFL*(1.0-bezCompF[bez_cycle]))+(BAFL*bezCompF[bez_cycle]))*0.5;
double CBSL = (bezCompS[bez_CL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_BL]*bezCompS[bez_cycle]);
double BASL = (bezCompS[bez_BL]*(1.0-bezCompS[bez_cycle]))+(bezCompS[bez_AL]*bezCompS[bez_cycle]);
double CBASL = (bezCompS[bez_BL]+(CBSL*(1.0-bezCompS[bez_cycle]))+(BASL*bezCompS[bez_cycle]))*0.5;
double CBAMax = fmax(CBASL,CBAFL); if (CBAMax > 0.0) CBAMax = 1.0/CBAMax;
double CBAFade = ((CBASL*-CBAMax)+(CBAFL*CBAMax)+1.0)*0.5;
if (bezCThresh > 0.0) inputSampleL *= 1.0-(fmin(((CBASL*(1.0-CBAFade))+(CBAFL*CBAFade))*bezCThresh,1.0));
if (bezGate < 1.0 && gate > 0.0) inputSampleL *= bezGate;
//Dynamics2
if (bezThresh > 0.0) {
if (fabs(inputSampleL) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
inputSampleL *= (bezThresh+1.0);
double ctrl = fabs(inputSampleL);
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
} else bezComp[bez_Ctrl] = 0.0;
//Dynamics3
const double temp = (double)nSampleFrames/inFramesToProcess;
const double hFreq = (hFreqA*temp)+(hFreqB*(1.0-temp));

View file

@ -54,64 +54,72 @@
#pragma mark ____ConsoleX2Pre Parameters
// parameters
static const int kDefaultValue_ParamA = 1;
static const float kDefaultValue_ParamB = 0.0;
static const float kDefaultValue_ParamC = 0.5;
static const float kDefaultValue_ParamD = 0.5;
static const float kDefaultValue_ParamE = 0.5;
static const float kDefaultValue_ParamF = 0.5;
static const float kDefaultValue_ParamG = 0.5;
static const float kDefaultValue_ParamH = 0.5;
static const float kDefaultValue_ParamI = 0.5;
static const float kDefaultValue_ParamJ = 0.5;
static const float kDefaultValue_ParamK = 1.0;
static const float kDefaultValue_ParamL = 0.5;
static const float kDefaultValue_ParamM = 0.5;
static const float kDefaultValue_ParamN = 0.0;
static const float kDefaultValue_ParamO = 1.0;
static const float kDefaultValue_ParamP = 0.0;
static const float kDefaultValue_ParamQ = 0.5;
static const int kDefaultValue_ParamTRM = 1;
static const float kDefaultValue_ParamMOR = 0.0;
static CFStringRef kParameterAName = CFSTR("Trim");
static CFStringRef kParameterBName = CFSTR("More");
static CFStringRef kParameterCUnit = CFSTR("eq");
static CFStringRef kParameterCName = CFSTR("High");
static CFStringRef kParameterDName = CFSTR("HMid");
static CFStringRef kParameterEName = CFSTR("LMid");
static CFStringRef kParameterFName = CFSTR("Bass");
static CFStringRef kParameterGUnit = CFSTR("freq");
static CFStringRef kParameterGName = CFSTR("HighF");
static CFStringRef kParameterHName = CFSTR("HMidF");
static CFStringRef kParameterIName = CFSTR("LMidF");
static CFStringRef kParameterJName = CFSTR("BassF");
static CFStringRef kParameterKUnit = CFSTR("dyn");
static CFStringRef kParameterKName = CFSTR("Thresh");
static CFStringRef kParameterLName = CFSTR("Attack");
static CFStringRef kParameterMName = CFSTR("Release");
static CFStringRef kParameterNName = CFSTR("Gate");
static CFStringRef kParameterOUnit = CFSTR("fltr");
static CFStringRef kParameterOName = CFSTR("Lowpass");
static CFStringRef kParameterPName = CFSTR("Hipass");
static CFStringRef kParameterQName = CFSTR("Fader");
static const float kDefaultValue_ParamHIG = 0.5;
static const float kDefaultValue_ParamHMG = 0.5;
static const float kDefaultValue_ParamLMG = 0.5;
static const float kDefaultValue_ParamBSG = 0.5;
static const float kDefaultValue_ParamHIF = 0.5;
static const float kDefaultValue_ParamHMF = 0.5;
static const float kDefaultValue_ParamLMF = 0.5;
static const float kDefaultValue_ParamBSF = 0.5;
static const float kDefaultValue_ParamTHR = 1.0;
static const float kDefaultValue_ParamATK = 0.5;
static const float kDefaultValue_ParamRLS = 0.5;
static const float kDefaultValue_ParamGAT = 0.0;
static const float kDefaultValue_ParamLOP = 1.0;
static const float kDefaultValue_ParamHIP = 0.0;
static const float kDefaultValue_ParamFAD = 0.5;
static CFStringRef kParameterTRMName = CFSTR("Trim");
static CFStringRef kParameterMORName = CFSTR("More");
static CFStringRef kParameterHIGUnit = CFSTR("eq");
static CFStringRef kParameterHIGName = CFSTR("High");
static CFStringRef kParameterHMGName = CFSTR("HMid");
static CFStringRef kParameterLMGName = CFSTR("LMid");
static CFStringRef kParameterBSGName = CFSTR("Bass");
static CFStringRef kParameterHIFUnit = CFSTR("freq");
static CFStringRef kParameterHIFName = CFSTR("HighF");
static CFStringRef kParameterHMFName = CFSTR("HMidF");
static CFStringRef kParameterLMFName = CFSTR("LMidF");
static CFStringRef kParameterBSFName = CFSTR("BassF");
static CFStringRef kParameterTHRUnit = CFSTR("dyn");
static CFStringRef kParameterTHRName = CFSTR("Thresh");
static CFStringRef kParameterATKName = CFSTR("Attack");
static CFStringRef kParameterRLSName = CFSTR("Release");
static CFStringRef kParameterGATName = CFSTR("Gate");
static CFStringRef kParameterLOPUnit = CFSTR("fltr");
static CFStringRef kParameterLOPName = CFSTR("Lowpass");
static CFStringRef kParameterHIPName = CFSTR("Hipass");
static CFStringRef kParameterFADName = CFSTR("Fader");
enum {
kParam_A =0,
kParam_B =1,
kParam_C =2,
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
kParam_K =10,
kParam_L =11,
kParam_M =12,
kParam_N =13,
kParam_O =14,
kParam_P =15,
kParam_Q =16,
kParam_TRM =0,
kParam_MOR =1,
kParam_HIG =2,
kParam_HMG =3,
kParam_LMG =4,
kParam_BSG =5,
kParam_HIF =6,
kParam_HMF =7,
kParam_LMF =8,
kParam_BSF =9,
kParam_THR =10,
kParam_ATK =11,
kParam_RLS =12,
kParam_GAT =13,
kParam_LOP =14,
kParam_HIP =15,
kParam_FAD =16,
//Add your parameters here...
kNumberOfParameters=17
};
@ -208,20 +216,18 @@ public:
//SmoothEQ2
enum {
bez_AL,
bez_BL,
bez_CL,
bez_InL,
bez_UnInL,
bez_SampL,
bez_A,
bez_B,
bez_C,
bez_Ctrl,
bez_cycle,
bez_total
}; //the new undersampling. bez signifies the bezier curve reconstruction
double bezCompF[bez_total];
double bezMaxF;
double bezCompS[bez_total];
double bezComp[bez_total];
double bezMax;
double bezMin;
double bezGate;
//Dynamics2
//Dynamics3
double iirHPosition[23];
double iirHAngle[23];

View file

@ -0,0 +1,293 @@
/*
* File: Dynamics3.cpp
*
* Version: 1.0
*
* Created: 11/20/25
*
* Copyright: Copyright © 2025 Airwindows, Airwindows uses the MIT license
*
* Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
* consideration of your agreement to the following terms, and your use, installation, modification
* or redistribution of this Apple software constitutes acceptance of these terms. If you do
* not agree with these terms, please do not use, install, modify or redistribute this Apple
* software.
*
* In consideration of your agreement to abide by the following terms, and subject to these terms,
* Apple grants you a personal, non-exclusive license, under Apple's copyrights in this
* original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the
* Apple Software, with or without modifications, in source and/or binary forms; provided that if you
* redistribute the Apple Software in its entirety and without modifications, you must retain this
* notice and the following text and disclaimers in all such redistributions of the Apple Software.
* Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to
* endorse or promote products derived from the Apple Software without specific prior written
* permission from Apple. Except as expressly stated in this notice, no other rights or
* licenses, express or implied, are granted by Apple herein, including but not limited to any
* patent rights that may be infringed by your derivative works or by other works in which the
* Apple Software may be incorporated.
*
* The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
* IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
* OR IN COMBINATION WITH YOUR PRODUCTS.
*
* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER
* UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN
* IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*=============================================================================
Dynamics3.cpp
=============================================================================*/
#include "Dynamics3.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AUDIOCOMPONENT_ENTRY(AUBaseFactory, Dynamics3)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::Dynamics3
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dynamics3::Dynamics3(AudioUnit component)
: AUEffectBase(component)
{
CreateElements();
Globals()->UseIndexedParameters(kNumberOfParameters);
SetParameter(kParam_A, kDefaultValue_ParamA );
SetParameter(kParam_B, kDefaultValue_ParamB );
SetParameter(kParam_C, kDefaultValue_ParamC );
SetParameter(kParam_D, kDefaultValue_ParamD );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetParameterValueStrings
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings)
{
return kAudioUnitErr_InvalidProperty;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetParameterInfo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetParameterInfo(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
AudioUnitParameterInfo &outParameterInfo )
{
ComponentResult result = noErr;
outParameterInfo.flags = kAudioUnitParameterFlag_IsWritable
| kAudioUnitParameterFlag_IsReadable;
if (inScope == kAudioUnitScope_Global) {
switch(inParameterID)
{
case kParam_A:
AUBase::FillInParameterName (outParameterInfo, kParameterAName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamA;
break;
case kParam_B:
AUBase::FillInParameterName (outParameterInfo, kParameterBName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamB;
break;
case kParam_C:
AUBase::FillInParameterName (outParameterInfo, kParameterCName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamC;
break;
case kParam_D:
AUBase::FillInParameterName (outParameterInfo, kParameterDName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamD;
break;
default:
result = kAudioUnitErr_InvalidParameter;
break;
}
} else {
result = kAudioUnitErr_InvalidParameter;
}
return result;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetPropertyInfo
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetPropertyInfo (AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
UInt32 & outDataSize,
Boolean & outWritable)
{
return AUEffectBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// state that plugin supports only stereo-in/stereo-out processing
UInt32 Dynamics3::SupportedNumChannels(const AUChannelInfo ** outInfo)
{
if (outInfo != NULL)
{
static AUChannelInfo info;
info.inChannels = 2;
info.outChannels = 2;
*outInfo = &info;
}
return 1;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::GetProperty
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::GetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData )
{
return AUEffectBase::GetProperty (inID, inScope, inElement, outData);
}
// Dynamics3::Initialize
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::Initialize()
{
ComponentResult result = AUEffectBase::Initialize();
if (result == noErr)
Reset(kAudioUnitScope_Global, 0);
return result;
}
#pragma mark ____Dynamics3EffectKernel
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::Dynamics3Kernel::Reset()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult Dynamics3::Reset(AudioUnitScope inScope, AudioUnitElement inElement)
{
for (int x = 0; x < bez_total; x++) bezComp[x] = 0.0;
bezComp[bez_cycle] = 1.0; bezMax = 0.0; bezMin = 0.0;
bezGate = 2.0;
//Dynamics3
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
return noErr;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Dynamics3::ProcessBufferLists
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OSStatus Dynamics3::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags,
const AudioBufferList & inBuffer,
AudioBufferList & outBuffer,
UInt32 inFramesToProcess)
{
Float32 * inputL = (Float32*)(inBuffer.mBuffers[0].mData);
Float32 * inputR = (Float32*)(inBuffer.mBuffers[1].mData);
Float32 * outputL = (Float32*)(outBuffer.mBuffers[0].mData);
Float32 * outputR = (Float32*)(outBuffer.mBuffers[1].mData);
UInt32 nSampleFrames = inFramesToProcess;
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= GetSampleRate();
double bezThresh = pow(1.0-GetParameter( kParam_A ), 4.0) * 8.0;
double bezRez = pow(1.0-GetParameter( kParam_B ), 4.0) / overallscale;
double sloRez = pow(1.0-GetParameter( kParam_C ), 4.0) / overallscale;
double gate = pow(GetParameter( kParam_D ),4.0);
bezRez = fmin(fmax(bezRez,0.0001),1.0);
sloRez = fmin(fmax(sloRez,0.0001),1.0);
//Dynamics3
while (nSampleFrames-- > 0) {
double inputSampleL = *inputL;
double inputSampleR = *inputR;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fmax(fabs(inputSampleL),fabs(inputSampleR)) > gate) bezGate = overallscale/fmin(bezRez,sloRez);
else bezGate = bezGate = fmax(0.000001, bezGate-fmin(bezRez,sloRez));
if (bezThresh > 0.0) {
inputSampleL *= (bezThresh+1.0);
inputSampleR *= (bezThresh+1.0);
}
double ctrl = fmax(fabs(inputSampleL),fabs(inputSampleR));
bezMax = fmax(bezMax,ctrl);
bezMin = fmax(bezMin-sloRez,ctrl);
bezComp[bez_cycle] += bezRez;
bezComp[bez_Ctrl] += (bezMin * bezRez);
if (bezComp[bez_cycle] > 1.0) {
if (bezGate < 1.0) bezComp[bez_Ctrl] /= bezGate;
bezComp[bez_cycle] -= 1.0;
bezComp[bez_C] = bezComp[bez_B];
bezComp[bez_B] = bezComp[bez_A];
bezComp[bez_A] = bezComp[bez_Ctrl];
bezComp[bez_Ctrl] = 0.0;
bezMax = 0.0;
}
double CB = (bezComp[bez_C]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_B]*bezComp[bez_cycle]);
double BA = (bezComp[bez_B]*(1.0-bezComp[bez_cycle]))+(bezComp[bez_A]*bezComp[bez_cycle]);
double CBA = (bezComp[bez_B]+(CB*(1.0-bezComp[bez_cycle]))+(BA*bezComp[bez_cycle]))*0.5;
if (bezThresh > 0.0) {
inputSampleL *= 1.0-(fmin(CBA*bezThresh,1.0));
inputSampleR *= 1.0-(fmin(CBA*bezThresh,1.0));
}
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither
*outputL = inputSampleL;
*outputR = inputSampleR;
//direct stereo out
inputL += 1;
inputR += 1;
outputL += 1;
outputR += 1;
}
return noErr;
}

View file

@ -0,0 +1,2 @@
_Dynamics3Entry
_Dynamics3Factory

Some files were not shown because too many files have changed in this diff Show more