BiquadHiLo

This commit is contained in:
Christopher Johnson 2025-01-05 19:54:14 -05:00
parent 30a0d7948b
commit 0ca3303525
26 changed files with 1254 additions and 958 deletions

View file

@ -13,7 +13,7 @@ Amp Sims: GrindAmp, FireAmp, LeadAmp, CrickBass, Wolfbot, LilAmp, MidAmp, BigAmp
Bass: DubSub2, OrbitKick, Hermepass, BassKit, DubCenter, DubSub, Floor, Infrasonic, FathomFive
Biquads: BiquadStack, BiquadNonLin, BiquadPlus, Biquad, BiquadDouble, BiquadOneHalf, BiquadTriple, Biquad2
Biquads: BiquadStack, BiquadNonLin, BiquadHiLo, BiquadPlus, Biquad, BiquadDouble, BiquadOneHalf, BiquadTriple, Biquad2
Brightness: Air4, Air3, PlatinumSlew, DeBess, GoldenSlew, Sinew, SlewSonic, Acceleration2, DeEss, Smooth, EverySlew, Slew3, Slew2, Slew, Air2, Air, PurestAir, Acceleration, DeHiss, Hypersonic, HypersonX, Ultrasonic, UltrasonicLite, UltrasonicMed, UltrasonX
@ -359,6 +359,20 @@ Because I sometimes like mocking up effects and plugins out of component parts.
The real answer is because thats how I roll. Nobody asked for this. But maybe you reach for a biquad filter for simple tone shaping, and you keep trying to find a butter zone between too shallow, and too resonant. This might become your go-to basic filter. I cant predict what will take off: for all I know, this is THE basic digital filter everyones been waiting for, the one that just sounds right for every purpose. Or not. But you cant know until you try :)
############ BiquadHiLo is the highpass and lowpass filter in ConsoleX.
Pretty straightforward: this is effectively the same thing as the highpass and lowpass used in ConsoleX. Except, in practice it's absolutely not, because in ConsoleX both of these are distributed filters. That means as signal hits the Stonefire section with dynamics, it will have hit some of the highpassing and lowpassing, but not all of it: some of it will happen after the dynamics. Some of it will happen after the four-band parametric EQ, which is somewhat nonlinear. The lowpass in particular gets to work as a distributed filter against aliasing, especially if you're running at high sample rate.
But here it's just those filters as a one-piece unit.
That also means you can use it as those filters, but in a much more lightweight form than in ConsoleX. I'm hoping ConsoleX is working out for people (it will be a while before I'm finished explaining all that, and getting it working on everybody's DAW, if that's even possible!). But though it is prettier and a lot fancier, it's way more complicated.
In the video I made, I demonstrate how you might be running something like a guitar into virtual tape (ToTape8 in this case) and from there into ConsoleX. But there are some things you simply can't do when processing the sound AFTER the tape. Sometimes there's a reason to shape the sound going in front of the tape, so it can hit those harmonics harder with less extra frequencies flying around… and BiquadHiLo can work for 'trapping in' a sound like that so it can hit tape even harder and produce a really direct, clear sound.
And of course you can use ConsoleXPre for exactly that purpose and have all the EQs or even dynamics going, both in front of and after the tape, but much like you have access to three bands of the parametric EQ in 'Parametric', and have the dynamics in 'StoneFireComp', you have the additional filters in BiquadHiLo.
If all goes well I can have the 'mastering' (a very airwindowsized take on mastering) plugin by next week, but while I work on more fixes for ConsoleX, here's a spare filter to have :)
############ BiquadNonLin is Capacitor2, but for biquad filtering.
A biquad filter is a very basic piece of typical DAW EQs. If you were going to think of the most ordinary, normal, non-special digital EQ that would sound like every other digital EQ, you're probably going to be stacking up biquad filters. It is the most boring of digital filters, at least ones that are kind of flexible.

View file

@ -12,16 +12,12 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new M
Mastering::Mastering(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.5;
A = 0.0;
B = 0.5;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 0.0;
J = 1.0;
F = 1.0;
for (int x = 0; x < air_total; x++) air[x] = 0.0;
for (int x = 0; x < kal_total; x++) {kalM[x] = 0.0;kalS[x] = 0.0;}
@ -132,10 +128,6 @@ VstInt32 Mastering::getChunk (void** data, bool isPreset)
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
/* 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. */
@ -153,10 +145,6 @@ VstInt32 Mastering::setChunk (void* data, VstInt32 byteSize, bool isPreset)
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]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -172,10 +160,6 @@ void Mastering::setParameter(VstInt32 index, float value) {
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;
default: throw; // unknown parameter, shouldn't happen!
}
}
@ -188,26 +172,18 @@ float Mastering::getParameter(VstInt32 index) {
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;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Mastering::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Air", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Mid", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Low", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Sub", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "XvM-L", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "XvL-S", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "Zoom", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "DarkF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "Ratio", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
case kParamA: vst_strncpy (text, "Glue", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Scope", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Skronk", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Girth", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "Drive", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
@ -219,11 +195,7 @@ void Mastering::getParameterDisplay(VstInt32 index, char *text) {
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: switch((VstInt32)( J * 5.999 )) //0 to almost edge of # of params
case kParamF: switch((VstInt32)( F * 5.999 )) //0 to almost edge of # of params
{ case 0: vst_strncpy (text, "Dark", kVstMaxParamStrLen); break;
case 1: vst_strncpy (text, "TenNines", kVstMaxParamStrLen); break;
case 2: vst_strncpy (text, "TPDFWde", kVstMaxParamStrLen); break;
@ -244,10 +216,6 @@ void Mastering::getParameterLabel(VstInt32 index, char *text) {
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, "", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -22,11 +22,7 @@ enum {
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kNumParameters = 10
kNumParameters = 6
}; //
const int kNumPrograms = 0;
@ -67,10 +63,6 @@ private:
float D;
float E;
float F;
float G;
float H;
float I;
float J;
enum {
pvAL1,

View file

@ -18,37 +18,43 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -164,7 +170,7 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgL] = kalS[kalOutL];
bassL -= subL;
//end KalmanSL
//begin KalmanSR
temp = bassR;
kalS[prevSlewR3] += kalS[prevSampR3] - kalS[prevSampR2]; kalS[prevSlewR3] *= 0.5;
@ -191,40 +197,86 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -274,7 +326,6 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark
@ -678,37 +729,43 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -851,40 +908,86 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -934,7 +1037,6 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark

View file

@ -65,10 +65,6 @@ Mastering::Mastering(AudioUnit component)
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 );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
@ -84,7 +80,7 @@ ComponentResult Mastering::GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings)
{
if ((inScope == kAudioUnitScope_Global) && (inParameterID == kParam_J)) //ID must be actual name of parameter identifier, not number
if ((inScope == kAudioUnitScope_Global) && (inParameterID == kParam_F)) //ID must be actual name of parameter identifier, not number
{
if (outStrings == NULL) return noErr;
CFStringRef strings [] =
@ -161,40 +157,12 @@ ComponentResult Mastering::GetParameterInfo(AudioUnitScope inScope,
break;
case kParam_F:
AUBase::FillInParameterName (outParameterInfo, kParameterFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
break;
case kParam_G:
AUBase::FillInParameterName (outParameterInfo, kParameterGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamG;
break;
case kParam_H:
AUBase::FillInParameterName (outParameterInfo, kParameterHName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamH;
break;
case kParam_I:
AUBase::FillInParameterName (outParameterInfo, kParameterIName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamI;
break;
case kParam_J:
AUBase::FillInParameterName (outParameterInfo, kParameterJName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Indexed;
outParameterInfo.minValue = kDark;
outParameterInfo.maxValue = kBypass;
outParameterInfo.defaultValue = kDefaultValue_ParamJ;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
break;
default:
default:
result = kAudioUnitErr_InvalidParameter;
break;
}
@ -356,36 +324,42 @@ OSStatus Mastering::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
overallscale /= 44100.0;
overallscale *= GetSampleRate();
long double trebleGain = GetParameter( kParam_A )+0.5;
double threshSinew = (0.25+((1.0-GetParameter( kParam_A ))*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-GetParameter( kParam_A ),2.0);
double trebleZoom = GetParameter( kParam_B )-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = GetParameter( kParam_B )+0.5;
long double bassGain = (1.0-GetParameter( kParam_C ))+0.5; //control inverted
long double subGain = GetParameter( kParam_D )+0.5;
//simple four band to adjust
double kalMid = pow(1.0-GetParameter( kParam_E ),3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(GetParameter( kParam_F ),3)));
//crossover frequency between bass/sub
double zoom = (GetParameter( kParam_G )*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(GetParameter( kParam_H ),2)/overallscale;
double depthSinew = GetParameter( kParam_I );
double midZoom = GetParameter( kParam_C )-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(GetParameter( kParam_C )*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(GetParameter( kParam_C )*0.25); //crossover frequency between bass/sub
double bassZoom = (GetParameter( kParam_D )*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((GetParameter( kParam_D )*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (GetParameter( kParam_E )-0.5)+1.0;
long double driveOut = (-(GetParameter( kParam_E )-0.5)*fabs(GetParameter( kParam_E )-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) GetParameter( kParam_J );
int dither = (int) GetParameter( kParam_F );
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (nSampleFrames-- > 0) {
double inputSampleL = *inputL;
double inputSampleR = *inputR;
long double inputSampleL = *inputL;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -528,41 +502,87 @@ OSStatus Mastering::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
if (wasPosClipL == true) { //current will be over

View file

@ -54,22 +54,18 @@
#pragma mark ____Mastering Parameters
// parameters
static const float kDefaultValue_ParamA = 0.5;
static const float kDefaultValue_ParamA = 0.0;
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 = 0.0;
static const int kDark = 1;
static const int kTenNines = 2;
static const int kTPDFWide = 3;
static const int kPaulWide = 4;
static const int kNJAD = 5;
static const int kBypass = 6;
static const int kDefaultValue_ParamJ = kBypass;
static const int kDefaultValue_ParamF = kBypass;
static CFStringRef kMenuItem_Dark = CFSTR ("Dark");
static CFStringRef kMenuItem_TenNines = CFSTR ("Ten Nines");
@ -78,16 +74,12 @@ static CFStringRef kMenuItem_PaulWide = CFSTR ("PaulWide");
static CFStringRef kMenuItem_NJAD = CFSTR ("NJAD");
static CFStringRef kMenuItem_Bypass = CFSTR ("Bypass");
static CFStringRef kParameterAName = CFSTR("Air");
static CFStringRef kParameterBName = CFSTR("Mid");
static CFStringRef kParameterCName = CFSTR("Low");
static CFStringRef kParameterDName = CFSTR("Sub");
static CFStringRef kParameterEName = CFSTR("XvM-L");
static CFStringRef kParameterFName = CFSTR("XvL-S");
static CFStringRef kParameterGName = CFSTR("Zoom");
static CFStringRef kParameterHName = CFSTR("DarkF");
static CFStringRef kParameterIName = CFSTR("Ratio");
static CFStringRef kParameterJName = CFSTR("Dither");
static CFStringRef kParameterAName = CFSTR("Glue");
static CFStringRef kParameterBName = CFSTR("Scope");
static CFStringRef kParameterCName = CFSTR("Skronk");
static CFStringRef kParameterDName = CFSTR("Girth");
static CFStringRef kParameterEName = CFSTR("Drive");
static CFStringRef kParameterFName = CFSTR("Dither");
enum {
kParam_A =0,
@ -96,12 +88,8 @@ enum {
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
//Add your parameters here...
kNumberOfParameters=10
kNumberOfParameters=6
};
#pragma mark ____Mastering

View file

@ -49,23 +49,44 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 751290936;
PBXWorkspaceStateSaveDate = 751290936;
PBXPerProjectTemplateStateSaveDate = 757510262;
PBXWorkspaceStateSaveDate = 757510262;
};
perUserProjectItems = {
8BC4371D2CC70EE00098AE55 /* PBXTextBookmark */ = 8BC4371D2CC70EE00098AE55 /* PBXTextBookmark */;
8BC437832CC7CCED0098AE55 /* PBXTextBookmark */ = 8BC437832CC7CCED0098AE55 /* PBXTextBookmark */;
8B679E312D24813200C14ACE /* PBXTextBookmark */ = 8B679E312D24813200C14ACE /* PBXTextBookmark */;
8B965A692D26B080004D9AF8 /* PBXTextBookmark */ = 8B965A692D26B080004D9AF8 /* PBXTextBookmark */;
8BB7CE152D25C50500084318 /* PBXTextBookmark */ = 8BB7CE152D25C50500084318 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
8B679E312D24813200C14ACE /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Mastering.cpp */;
name = "Mastering.cpp: 344";
rLen = 0;
rLoc = 13773;
rType = 0;
vrLen = 375;
vrLoc = 14775;
};
8B965A692D26B080004D9AF8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* Mastering.h */;
name = "Mastering.h: 238";
rLen = 0;
rLoc = 7277;
rType = 0;
vrLen = 181;
vrLoc = 68;
};
8BA05A660720730100365D66 /* Mastering.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {849, 18270}}";
sepNavSelRange = "{31815, 0}";
sepNavVisRange = "{31575, 221}";
sepNavWindowFrame = "{{8, 49}, {1061, 821}}";
sepNavIntBoundsRect = "{{0, 0}, {1014, 18936}}";
sepNavSelRange = "{12921, 42}";
sepNavVisRange = "{12439, 1871}";
sepNavWindowFrame = "{{28, 57}, {1061, 821}}";
};
};
8BA05A690720730100365D66 /* MasteringVersion.h */ = {
@ -83,32 +104,22 @@
sepNavVisRange = "{0, 1336}";
};
};
8BC4371D2CC70EE00098AE55 /* PBXTextBookmark */ = {
8BB7CE152D25C50500084318 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Mastering.cpp */;
name = "Mastering.cpp: 693";
fRef = 8BC6025B073B072D006C4272 /* Mastering.h */;
name = "Mastering.h: 238";
rLen = 0;
rLoc = 31815;
rLoc = 7277;
rType = 0;
vrLen = 252;
vrLoc = 31544;
};
8BC437832CC7CCED0098AE55 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Mastering.cpp */;
name = "Mastering.cpp: 693";
rLen = 0;
rLoc = 31815;
rType = 0;
vrLen = 221;
vrLoc = 31575;
vrLen = 181;
vrLoc = 68;
};
8BC6025B073B072D006C4272 /* Mastering.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 4950}}";
sepNavSelRange = "{7725, 0}";
sepNavVisRange = "{7429, 835}";
sepNavWindowFrame = "{{26, 47}, {1061, 821}}";
sepNavIntBoundsRect = "{{0, 0}, {1029, 4698}}";
sepNavSelRange = "{7277, 0}";
sepNavVisRange = "{68, 181}";
sepNavWindowFrame = "{{10, 57}, {1061, 821}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {

View file

@ -324,7 +324,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
<string>0 299 810 487 0 0 1440 878 </string>
<string>29 275 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -340,7 +340,7 @@
<key>PBXProjectModuleGUID</key>
<string>8BC435722CC6F8650098AE55</string>
<key>PBXProjectModuleLabel</key>
<string>Mastering.cpp</string>
<string>Mastering.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -348,14 +348,15 @@
<key>PBXProjectModuleGUID</key>
<string>8BC435732CC6F8650098AE55</string>
<key>PBXProjectModuleLabel</key>
<string>Mastering.cpp</string>
<string>Mastering.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8BC437832CC7CCED0098AE55</string>
<string>8B965A692D26B080004D9AF8</string>
<key>history</key>
<array>
<string>8BC4371D2CC70EE00098AE55</string>
<string>8B679E312D24813200C14ACE</string>
<string>8BB7CE152D25C50500084318</string>
</array>
</dict>
<key>SplitCount</key>
@ -369,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {603, 86}}</string>
<string>{{0, 0}, {603, 69}}</string>
<key>RubberWindowFrame</key>
<string>0 299 810 487 0 0 1440 878 </string>
<string>29 275 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>86pt</string>
<string>69pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>355pt</string>
<string>372pt</string>
<key>Tabs</key>
<array>
<dict>
@ -394,9 +395,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 328}}</string>
<string>{{10, 27}, {603, 345}}</string>
<key>RubberWindowFrame</key>
<string>0 299 810 487 0 0 1440 878 </string>
<string>29 275 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -430,7 +431,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 31}, {603, 297}}</string>
<string>{{10, 27}, {603, 297}}</string>
</dict>
<key>Module</key>
<string>PBXCVSModule</string>
@ -450,7 +451,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 282}}</string>
<string>{{10, 27}, {603, 312}}</string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -478,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8BC437842CC7CCED0098AE55</string>
<string>8B965A6A2D26B080004D9AF8</string>
<string>1CA23ED40692098700951B8B</string>
<string>8BC437852CC7CCED0098AE55</string>
<string>8B965A6B2D26B080004D9AF8</string>
<string>8BC435722CC6F8650098AE55</string>
<string>8BC437862CC7CCED0098AE55</string>
<string>8B965A6C2D26B080004D9AF8</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -635,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>751291629.93373895</real>
<real>757510272.42657495</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -652,11 +653,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8BC437872CC7CCED0098AE55</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/Mastering/Mastering.xcodeproj</string>
</array>
<key>WindowString</key>
<string>0 299 810 487 0 0 1440 878 </string>
<string>29 275 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -65,10 +65,6 @@ Mastering::Mastering(AudioUnit component)
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 );
#if AU_DEBUG_DISPATCHER
mDebugDispatcher = new AUDebugDispatcher (this);
@ -84,7 +80,7 @@ ComponentResult Mastering::GetParameterValueStrings(AudioUnitScope inScope,
AudioUnitParameterID inParameterID,
CFArrayRef * outStrings)
{
if ((inScope == kAudioUnitScope_Global) && (inParameterID == kParam_J)) //ID must be actual name of parameter identifier, not number
if ((inScope == kAudioUnitScope_Global) && (inParameterID == kParam_F)) //ID must be actual name of parameter identifier, not number
{
if (outStrings == NULL) return noErr;
CFStringRef strings [] =
@ -161,40 +157,12 @@ ComponentResult Mastering::GetParameterInfo(AudioUnitScope inScope,
break;
case kParam_F:
AUBase::FillInParameterName (outParameterInfo, kParameterFName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
break;
case kParam_G:
AUBase::FillInParameterName (outParameterInfo, kParameterGName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamG;
break;
case kParam_H:
AUBase::FillInParameterName (outParameterInfo, kParameterHName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamH;
break;
case kParam_I:
AUBase::FillInParameterName (outParameterInfo, kParameterIName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Generic;
outParameterInfo.minValue = 0.0;
outParameterInfo.maxValue = 1.0;
outParameterInfo.defaultValue = kDefaultValue_ParamI;
break;
case kParam_J:
AUBase::FillInParameterName (outParameterInfo, kParameterJName, false);
outParameterInfo.unit = kAudioUnitParameterUnit_Indexed;
outParameterInfo.minValue = kDark;
outParameterInfo.maxValue = kBypass;
outParameterInfo.defaultValue = kDefaultValue_ParamJ;
outParameterInfo.defaultValue = kDefaultValue_ParamF;
break;
default:
default:
result = kAudioUnitErr_InvalidParameter;
break;
}
@ -356,36 +324,42 @@ OSStatus Mastering::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
overallscale /= 44100.0;
overallscale *= GetSampleRate();
long double trebleGain = GetParameter( kParam_A )+0.5;
double threshSinew = (0.25+((1.0-GetParameter( kParam_A ))*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-GetParameter( kParam_A ),2.0);
double trebleZoom = GetParameter( kParam_B )-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = GetParameter( kParam_B )+0.5;
long double bassGain = (1.0-GetParameter( kParam_C ))+0.5; //control inverted
long double subGain = GetParameter( kParam_D )+0.5;
//simple four band to adjust
double kalMid = pow(1.0-GetParameter( kParam_E ),3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(GetParameter( kParam_F ),3)));
//crossover frequency between bass/sub
double zoom = (GetParameter( kParam_G )*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(GetParameter( kParam_H ),2)/overallscale;
double depthSinew = GetParameter( kParam_I );
double midZoom = GetParameter( kParam_C )-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(GetParameter( kParam_C )*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(GetParameter( kParam_C )*0.25); //crossover frequency between bass/sub
double bassZoom = (GetParameter( kParam_D )*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((GetParameter( kParam_D )*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (GetParameter( kParam_E )-0.5)+1.0;
long double driveOut = (-(GetParameter( kParam_E )-0.5)*fabs(GetParameter( kParam_E )-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) GetParameter( kParam_J );
int dither = (int) GetParameter( kParam_F );
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (nSampleFrames-- > 0) {
double inputSampleL = *inputL;
double inputSampleR = *inputR;
long double inputSampleL = *inputL;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -528,41 +502,87 @@ OSStatus Mastering::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
if (wasPosClipL == true) { //current will be over

View file

@ -54,22 +54,18 @@
#pragma mark ____Mastering Parameters
// parameters
static const float kDefaultValue_ParamA = 0.5;
static const float kDefaultValue_ParamA = 0.0;
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 = 0.0;
static const int kDark = 1;
static const int kTenNines = 2;
static const int kTPDFWide = 3;
static const int kPaulWide = 4;
static const int kNJAD = 5;
static const int kBypass = 6;
static const int kDefaultValue_ParamJ = kBypass;
static const int kDefaultValue_ParamF = kBypass;
static CFStringRef kMenuItem_Dark = CFSTR ("Dark");
static CFStringRef kMenuItem_TenNines = CFSTR ("Ten Nines");
@ -78,16 +74,12 @@ static CFStringRef kMenuItem_PaulWide = CFSTR ("PaulWide");
static CFStringRef kMenuItem_NJAD = CFSTR ("NJAD");
static CFStringRef kMenuItem_Bypass = CFSTR ("Bypass");
static CFStringRef kParameterAName = CFSTR("Air");
static CFStringRef kParameterBName = CFSTR("Mid");
static CFStringRef kParameterCName = CFSTR("Low");
static CFStringRef kParameterDName = CFSTR("Sub");
static CFStringRef kParameterEName = CFSTR("XvM-L");
static CFStringRef kParameterFName = CFSTR("XvL-S");
static CFStringRef kParameterGName = CFSTR("Zoom");
static CFStringRef kParameterHName = CFSTR("DarkF");
static CFStringRef kParameterIName = CFSTR("Ratio");
static CFStringRef kParameterJName = CFSTR("Dither");
static CFStringRef kParameterAName = CFSTR("Glue");
static CFStringRef kParameterBName = CFSTR("Scope");
static CFStringRef kParameterCName = CFSTR("Skronk");
static CFStringRef kParameterDName = CFSTR("Girth");
static CFStringRef kParameterEName = CFSTR("Drive");
static CFStringRef kParameterFName = CFSTR("Dither");
enum {
kParam_A =0,
@ -96,12 +88,8 @@ enum {
kParam_D =3,
kParam_E =4,
kParam_F =5,
kParam_G =6,
kParam_H =7,
kParam_I =8,
kParam_J =9,
//Add your parameters here...
kNumberOfParameters=10
kNumberOfParameters=6
};
#pragma mark ____Mastering

View file

@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "Gain.vst"
BuildableName = "Mastering.vst"
BlueprintName = "Mastering"
ReferencedContainer = "container:Mastering.xcodeproj">
</BuildableReference>
@ -51,7 +51,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "Gain.vst"
BuildableName = "Mastering.vst"
BlueprintName = "Mastering"
ReferencedContainer = "container:Mastering.xcodeproj">
</BuildableReference>

View file

@ -12,16 +12,12 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new M
Mastering::Mastering(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.5;
A = 0.0;
B = 0.5;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 0.0;
J = 1.0;
F = 1.0;
for (int x = 0; x < air_total; x++) air[x] = 0.0;
for (int x = 0; x < kal_total; x++) {kalM[x] = 0.0;kalS[x] = 0.0;}
@ -132,10 +128,6 @@ VstInt32 Mastering::getChunk (void** data, bool isPreset)
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
/* 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. */
@ -153,10 +145,6 @@ VstInt32 Mastering::setChunk (void* data, VstInt32 byteSize, bool isPreset)
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]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -172,10 +160,6 @@ void Mastering::setParameter(VstInt32 index, float value) {
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;
default: throw; // unknown parameter, shouldn't happen!
}
}
@ -188,26 +172,18 @@ float Mastering::getParameter(VstInt32 index) {
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;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Mastering::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Air", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Mid", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Low", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Sub", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "XvM-L", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "XvL-S", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "Zoom", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "DarkF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "Ratio", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
case kParamA: vst_strncpy (text, "Glue", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Scope", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Skronk", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Girth", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "Drive", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
@ -219,11 +195,7 @@ void Mastering::getParameterDisplay(VstInt32 index, char *text) {
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: switch((VstInt32)( J * 5.999 )) //0 to almost edge of # of params
case kParamF: switch((VstInt32)( F * 5.999 )) //0 to almost edge of # of params
{ case 0: vst_strncpy (text, "Dark", kVstMaxParamStrLen); break;
case 1: vst_strncpy (text, "TenNines", kVstMaxParamStrLen); break;
case 2: vst_strncpy (text, "TPDFWde", kVstMaxParamStrLen); break;
@ -244,10 +216,6 @@ void Mastering::getParameterLabel(VstInt32 index, char *text) {
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, "", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -22,11 +22,7 @@ enum {
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kNumParameters = 10
kNumParameters = 6
}; //
const int kNumPrograms = 0;
@ -67,10 +63,6 @@ private:
float D;
float E;
float F;
float G;
float H;
float I;
float J;
enum {
pvAL1,

View file

@ -18,37 +18,43 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -164,7 +170,7 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgL] = kalS[kalOutL];
bassL -= subL;
//end KalmanSL
//begin KalmanSR
temp = bassR;
kalS[prevSlewR3] += kalS[prevSampR3] - kalS[prevSampR2]; kalS[prevSlewR3] *= 0.5;
@ -191,40 +197,86 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -274,7 +326,6 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark
@ -678,37 +729,43 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -851,40 +908,86 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -934,7 +1037,6 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark

View file

@ -51,16 +51,16 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 751291914;
PBXWorkspaceStateSaveDate = 751291914;
PBXPerProjectTemplateStateSaveDate = 757510293;
PBXWorkspaceStateSaveDate = 757510293;
};
perUserProjectItems = {
8BC437242CC70EF00098AE55 /* PBXTextBookmark */ = 8BC437242CC70EF00098AE55 /* PBXTextBookmark */;
8BC4377F2CC7CCEC0098AE55 /* PBXTextBookmark */ = 8BC4377F2CC7CCEC0098AE55 /* PBXTextBookmark */;
8BC437962CC7CE130098AE55 /* PBXBookmark */ = 8BC437962CC7CE130098AE55 /* PBXBookmark */;
8BC437A32CC7CE520098AE55 /* PBXTextBookmark */ = 8BC437A32CC7CE520098AE55 /* PBXTextBookmark */;
8BC437A92CC7CE520098AE55 /* PBXTextBookmark */ = 8BC437A92CC7CE520098AE55 /* PBXTextBookmark */;
8BF17AF32CB7F7B000FAAF3F /* PBXTextBookmark */ = 8BF17AF32CB7F7B000FAAF3F /* PBXTextBookmark */;
8B0D55732D234EF000BCAE09 /* PBXTextBookmark */ = 8B0D55732D234EF000BCAE09 /* PBXTextBookmark */;
8B679E532D24836600C14ACE /* PBXTextBookmark */ = 8B679E532D24836600C14ACE /* PBXTextBookmark */;
8B965A902D26B0A2004D9AF8 /* PBXTextBookmark */ = 8B965A902D26B0A2004D9AF8 /* PBXTextBookmark */;
8B965A912D26B0A2004D9AF8 /* PBXTextBookmark */ = 8B965A912D26B0A2004D9AF8 /* PBXTextBookmark */;
8BB7CE192D25C50500084318 /* PBXTextBookmark */ = 8BB7CE192D25C50500084318 /* PBXTextBookmark */;
8BB7CE1C2D25C50500084318 /* PBXTextBookmark */ = 8BB7CE1C2D25C50500084318 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@ -68,17 +68,17 @@
};
2407DEB6089929BA00EB68BF /* Mastering.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {948, 4860}}";
sepNavSelRange = "{7531, 13}";
sepNavVisRange = "{739, 942}";
sepNavIntBoundsRect = "{{0, 0}, {795, 4302}}";
sepNavSelRange = "{677, 0}";
sepNavVisRange = "{6065, 292}";
sepNavWindowFrame = "{{545, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* Mastering.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {554, 3600}}";
sepNavSelRange = "{528, 0}";
sepNavVisRange = "{0, 0}";
sepNavIntBoundsRect = "{{0, 0}, {1110, 3402}}";
sepNavSelRange = "{2531, 0}";
sepNavVisRange = "{3589, 822}";
sepNavWindowFrame = "{{545, 47}, {895, 831}}";
};
};
@ -92,10 +92,10 @@
};
24D8286F09A914000093AEF8 /* MasteringProc.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 23598}}";
sepNavSelRange = "{31210, 0}";
sepNavVisRange = "{803, 1981}";
sepNavWindowFrame = "{{543, 47}, {895, 831}}";
sepNavIntBoundsRect = "{{0, 0}, {1011, 26226}}";
sepNavSelRange = "{33722, 0}";
sepNavVisRange = "{387, 1548}";
sepNavWindowFrame = "{{381, 47}, {895, 831}}";
};
};
8B02375E1D42B1C400E1E8C8 /* Source Control */ = {
@ -112,59 +112,65 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8BC437242CC70EF00098AE55 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
name = "MasteringProc.cpp: 325";
rLen = 0;
rLoc = 31418;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8BC4377F2CC7CCEC0098AE55 /* PBXTextBookmark */ = {
8B0D55732D234EF000BCAE09 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 245463B80991757100464AD3 /* Mastering.h */;
name = "Mastering.h: 29";
rLen = 0;
rLoc = 528;
rLoc = 475;
rType = 0;
vrLen = 0;
vrLoc = 0;
vrLen = 138;
vrLoc = 44;
};
8BC437962CC7CE130098AE55 /* PBXBookmark */ = {
isa = PBXBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
};
8BC437A32CC7CE520098AE55 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 245463B80991757100464AD3 /* Mastering.h */;
name = "Mastering.h: 29";
rLen = 0;
rLoc = 528;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8BC437A92CC7CE520098AE55 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
name = "MasteringProc.cpp: 699";
rLen = 0;
rLoc = 31210;
rType = 0;
vrLen = 1981;
vrLoc = 803;
};
8BF17AF32CB7F7B000FAAF3F /* PBXTextBookmark */ = {
8B679E532D24836600C14ACE /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2407DEB6089929BA00EB68BF /* Mastering.cpp */;
name = "Mastering.cpp: 29";
name = "Mastering.cpp: 26";
rLen = 0;
rLoc = 717;
rLoc = 677;
rType = 0;
vrLen = 356;
vrLoc = 5826;
vrLen = 292;
vrLoc = 6065;
};
8B965A902D26B0A2004D9AF8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
name = "MasteringProc.cpp: 762";
rLen = 0;
rLoc = 34149;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8B965A912D26B0A2004D9AF8 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
name = "MasteringProc.cpp: 751";
rLen = 0;
rLoc = 33722;
rType = 0;
vrLen = 1548;
vrLoc = 387;
};
8BB7CE192D25C50500084318 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
name = "MasteringProc.cpp: 762";
rLen = 0;
rLoc = 34149;
rType = 0;
vrLen = 23;
vrLoc = 181;
};
8BB7CE1C2D25C50500084318 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* MasteringProc.cpp */;
name = "MasteringProc.cpp: 751";
rLen = 0;
rLoc = 33722;
rType = 0;
vrLen = 1548;
vrLoc = 387;
};
8D01CCC60486CAD60068D4B7 /* Mastering */ = {
activeExec = 0;

View file

@ -227,7 +227,7 @@
<key>Content</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8BC437A72CC7CE520098AE55</string>
<string>8BB7CE1A2D25C50500084318</string>
<key>PBXProjectModuleLabel</key>
<string>MasteringProc.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
@ -235,16 +235,16 @@
<key>Split0</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8BC437A82CC7CE520098AE55</string>
<string>8BB7CE1B2D25C50500084318</string>
<key>PBXProjectModuleLabel</key>
<string>MasteringProc.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8BC437A92CC7CE520098AE55</string>
<string>8B965A912D26B0A2004D9AF8</string>
<key>history</key>
<array>
<string>8BC437962CC7CE130098AE55</string>
<string>8BB7CE1C2D25C50500084318</string>
</array>
</dict>
<key>SplitCount</key>
@ -260,7 +260,7 @@
<key>PBXModuleWindowStatusBarHidden2</key>
<false/>
<key>RubberWindowFrame</key>
<string>543 103 895 775 0 0 1440 878 </string>
<string>381 103 895 775 0 0 1440 878 </string>
</dict>
</dict>
</array>
@ -364,7 +364,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
<string>620 297 810 487 0 0 1440 878 </string>
<string>576 240 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -380,7 +380,7 @@
<key>PBXProjectModuleGUID</key>
<string>8B0237581D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
<string>Mastering.h</string>
<string>MasteringProc.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -388,16 +388,16 @@
<key>PBXProjectModuleGUID</key>
<string>8B0237591D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
<string>Mastering.h</string>
<string>MasteringProc.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8BC437A32CC7CE520098AE55</string>
<string>8B965A902D26B0A2004D9AF8</string>
<key>history</key>
<array>
<string>8BF17AF32CB7F7B000FAAF3F</string>
<string>8BC437242CC70EF00098AE55</string>
<string>8BC4377F2CC7CCEC0098AE55</string>
<string>8B0D55732D234EF000BCAE09</string>
<string>8B679E532D24836600C14ACE</string>
<string>8BB7CE192D25C50500084318</string>
</array>
</dict>
<key>SplitCount</key>
@ -411,18 +411,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {603, 0}}</string>
<string>{{0, 0}, {603, 32}}</string>
<key>RubberWindowFrame</key>
<string>620 297 810 487 0 0 1440 878 </string>
<string>576 240 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>0pt</string>
<string>32pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>441pt</string>
<string>409pt</string>
<key>Tabs</key>
<array>
<dict>
@ -436,9 +436,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 414}}</string>
<string>{{10, 27}, {603, 382}}</string>
<key>RubberWindowFrame</key>
<string>620 297 810 487 0 0 1440 878 </string>
<string>576 240 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -520,11 +520,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8BC437A42CC7CE520098AE55</string>
<string>8B965A822D26B0A2004D9AF8</string>
<string>1CA23ED40692098700951B8B</string>
<string>8BC437A52CC7CE520098AE55</string>
<string>8B965A832D26B0A2004D9AF8</string>
<string>8B0237581D42B1C400E1E8C8</string>
<string>8BC437A62CC7CE520098AE55</string>
<string>8B965A842D26B0A2004D9AF8</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -697,7 +697,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>751291986.86297703</real>
<real>757510306.54983306</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -715,10 +715,10 @@
<key>WindowOrderList</key>
<array>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacVST/Mastering/Mastering.xcodeproj</string>
<string>8BC437A72CC7CE520098AE55</string>
<string>8BB7CE1A2D25C50500084318</string>
</array>
<key>WindowString</key>
<string>620 297 810 487 0 0 1440 878 </string>
<string>576 240 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View file

@ -12,16 +12,12 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new M
Mastering::Mastering(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.5;
A = 0.0;
B = 0.5;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 0.0;
J = 1.0;
F = 1.0;
for (int x = 0; x < air_total; x++) air[x] = 0.0;
for (int x = 0; x < kal_total; x++) {kalM[x] = 0.0;kalS[x] = 0.0;}
@ -132,10 +128,6 @@ VstInt32 Mastering::getChunk (void** data, bool isPreset)
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
/* 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. */
@ -153,10 +145,6 @@ VstInt32 Mastering::setChunk (void* data, VstInt32 byteSize, bool isPreset)
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]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -172,10 +160,6 @@ void Mastering::setParameter(VstInt32 index, float value) {
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;
default: throw; // unknown parameter, shouldn't happen!
}
}
@ -188,26 +172,18 @@ float Mastering::getParameter(VstInt32 index) {
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;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Mastering::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Air", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Mid", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Low", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Sub", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "XvM-L", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "XvL-S", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "Zoom", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "DarkF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "Ratio", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
case kParamA: vst_strncpy (text, "Glue", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Scope", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Skronk", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Girth", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "Drive", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
@ -219,11 +195,7 @@ void Mastering::getParameterDisplay(VstInt32 index, char *text) {
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: switch((VstInt32)( J * 5.999 )) //0 to almost edge of # of params
case kParamF: switch((VstInt32)( F * 5.999 )) //0 to almost edge of # of params
{ case 0: vst_strncpy (text, "Dark", kVstMaxParamStrLen); break;
case 1: vst_strncpy (text, "TenNines", kVstMaxParamStrLen); break;
case 2: vst_strncpy (text, "TPDFWde", kVstMaxParamStrLen); break;
@ -244,10 +216,6 @@ void Mastering::getParameterLabel(VstInt32 index, char *text) {
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, "", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -22,11 +22,7 @@ enum {
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kNumParameters = 10
kNumParameters = 6
}; //
const int kNumPrograms = 0;
@ -67,10 +63,6 @@ private:
float D;
float E;
float F;
float G;
float H;
float I;
float J;
enum {
pvAL1,

View file

@ -18,37 +18,43 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -164,7 +170,7 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgL] = kalS[kalOutL];
bassL -= subL;
//end KalmanSL
//begin KalmanSR
temp = bassR;
kalS[prevSlewR3] += kalS[prevSampR3] - kalS[prevSampR2]; kalS[prevSlewR3] *= 0.5;
@ -191,40 +197,86 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -274,7 +326,6 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark
@ -678,37 +729,43 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -851,40 +908,86 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -934,7 +1037,6 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark

View file

@ -12,16 +12,12 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new M
Mastering::Mastering(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.5;
A = 0.0;
B = 0.5;
C = 0.5;
D = 0.5;
E = 0.5;
F = 0.5;
G = 0.5;
H = 0.5;
I = 0.0;
J = 1.0;
F = 1.0;
for (int x = 0; x < air_total; x++) air[x] = 0.0;
for (int x = 0; x < kal_total; x++) {kalM[x] = 0.0;kalS[x] = 0.0;}
@ -132,10 +128,6 @@ VstInt32 Mastering::getChunk (void** data, bool isPreset)
chunkData[3] = D;
chunkData[4] = E;
chunkData[5] = F;
chunkData[6] = G;
chunkData[7] = H;
chunkData[8] = I;
chunkData[9] = J;
/* 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. */
@ -153,10 +145,6 @@ VstInt32 Mastering::setChunk (void* data, VstInt32 byteSize, bool isPreset)
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]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
@ -172,10 +160,6 @@ void Mastering::setParameter(VstInt32 index, float value) {
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;
default: throw; // unknown parameter, shouldn't happen!
}
}
@ -188,26 +172,18 @@ float Mastering::getParameter(VstInt32 index) {
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;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Mastering::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Air", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Mid", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Low", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Sub", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "XvM-L", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "XvL-S", kVstMaxParamStrLen); break;
case kParamG: vst_strncpy (text, "Zoom", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "DarkF", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "Ratio", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
case kParamA: vst_strncpy (text, "Glue", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Scope", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Skronk", kVstMaxParamStrLen); break;
case kParamD: vst_strncpy (text, "Girth", kVstMaxParamStrLen); break;
case kParamE: vst_strncpy (text, "Drive", kVstMaxParamStrLen); break;
case kParamF: vst_strncpy (text, "Dither", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
@ -219,11 +195,7 @@ void Mastering::getParameterDisplay(VstInt32 index, char *text) {
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: switch((VstInt32)( J * 5.999 )) //0 to almost edge of # of params
case kParamF: switch((VstInt32)( F * 5.999 )) //0 to almost edge of # of params
{ case 0: vst_strncpy (text, "Dark", kVstMaxParamStrLen); break;
case 1: vst_strncpy (text, "TenNines", kVstMaxParamStrLen); break;
case 2: vst_strncpy (text, "TPDFWde", kVstMaxParamStrLen); break;
@ -244,10 +216,6 @@ void Mastering::getParameterLabel(VstInt32 index, char *text) {
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, "", kVstMaxParamStrLen); break;
case kParamH: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamI: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamJ: vst_strncpy (text, "", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
}
}

View file

@ -22,11 +22,7 @@ enum {
kParamD =3,
kParamE =4,
kParamF =5,
kParamG =6,
kParamH =7,
kParamI =8,
kParamJ =9,
kNumParameters = 10
kNumParameters = 6
}; //
const int kNumPrograms = 0;
@ -67,10 +63,6 @@ private:
float D;
float E;
float F;
float G;
float H;
float I;
float J;
enum {
pvAL1,

View file

@ -18,37 +18,43 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -164,7 +170,7 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgL] = kalS[kalOutL];
bassL -= subL;
//end KalmanSL
//begin KalmanSR
temp = bassR;
kalS[prevSlewR3] += kalS[prevSampR3] - kalS[prevSampR2]; kalS[prevSlewR3] *= 0.5;
@ -191,40 +197,86 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -274,7 +326,6 @@ void Mastering::processReplacing(float **inputs, float **outputs, VstInt32 sampl
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark
@ -678,37 +729,43 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
overallscale /= 44100.0;
overallscale *= getSampleRate();
long double trebleGain = A+0.5;
double threshSinew = (0.25+((1.0-A)*0.333))/overallscale;
double depthSinew = 1.0-pow(1.0-A,2.0);
double trebleZoom = B-0.5;
long double trebleGain = (trebleZoom*fabs(trebleZoom))+1.0;
if (trebleGain > 1.0) trebleGain = pow(trebleGain,3.0+sqrt(overallscale));
//this boost is necessary to adapt to higher sample rates
long double midGain = B+0.5;
long double bassGain = (1.0-C)+0.5;
long double subGain = D+0.5;
//simple four band to adjust
double kalMid = pow(1.0-E,3);
//crossover frequency between mid/bass
double kalSub = (1.0-(pow(F,3)));
//crossover frequency between bass/sub
double zoom = (G*2.0)-1.0;
double zoomStages = (fabs(zoom)*4.0)+1.0;
for (int count = 0; count < sqrt(zoomStages); count++) zoom *= fabs(zoom);
double threshSinew = pow(H,2)/overallscale;
double depthSinew = I;
double midZoom = C-0.5;
long double midGain = (midZoom*fabs(midZoom))+1.0;
double kalMid = 0.35-(C*0.25); //crossover frequency between mid/bass
double kalSub = 0.45+(C*0.25); //crossover frequency between bass/sub
double bassZoom = (D*0.5)-0.25;
long double bassGain = (-bassZoom*fabs(bassZoom))+1.0; //control inverted
long double subGain = ((D*0.25)-0.125)+1.0;
if (subGain < 1.0) subGain = 1.0; //very small sub shift, only pos.
long double driveIn = (E-0.5)+1.0;
long double driveOut = (-(E-0.5)*fabs(E-0.5))+1.0;
int spacing = floor(overallscale); //should give us working basic scaling, usually 2 or 4
if (spacing < 1) spacing = 1; if (spacing > 16) spacing = 16;
int dither = (int) ( J * 5.999 )+1;
int dither = (int) (F*5.999);
int depth = (int)(17.0*overallscale);
if (depth < 3) depth = 3;
if (depth > 98) depth = 98; //for Dark
if (depth < 3) depth = 3; if (depth > 98) depth = 98; //for Dark
while (--sampleFrames >= 0)
{
double inputSampleL = *in1;
double inputSampleR = *in2;
long double inputSampleL = *in1;
long 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;
double drySampleL = inputSampleL;
double drySampleR = inputSampleR;
inputSampleL *= driveIn;
inputSampleR *= driveIn;
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
//begin Air3L
air[pvSL4] = air[pvAL4] - air[pvAL3]; air[pvSL3] = air[pvAL3] - air[pvAL2];
@ -851,40 +908,86 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
kalS[kalAvgR] = kalS[kalOutR];
bassR -= subR;
//end KalmanSR
inputSampleL = (subL*subGain);
inputSampleL += (bassL*bassGain);
inputSampleL += (midL*midGain);
inputSampleL += (trebleL*trebleGain);
inputSampleR = (subR*subGain);
if (bassZoom > 0.0) {
double closer = bassL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassL = (bassL*(1.0-bassZoom))+(sin(closer)*bassZoom);
closer = bassR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
bassR = (bassR*(1.0-bassZoom))+(sin(closer)*bassZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (bassZoom < 0.0) {
double farther = fabs(bassL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassL > 0.0) bassL = (bassL*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassL < 0.0) bassL = (bassL*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
farther = fabs(bassR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (bassR > 0.0) bassR = (bassR*(1.0+bassZoom))-(farther*bassZoom*1.57079633);
if (bassR < 0.0) bassR = (bassR*(1.0+bassZoom))+(farther*bassZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (bassL*bassGain);
inputSampleR += (bassR*bassGain);
if (midZoom > 0.0) {
double closer = midL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midL = (midL*(1.0-midZoom))+(sin(closer)*midZoom);
closer = midR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
midR = (midR*(1.0-midZoom))+(sin(closer)*midZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (midZoom < 0.0) {
double farther = fabs(midL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midL > 0.0) midL = (midL*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midL < 0.0) midL = (midL*(1.0+midZoom))+(farther*midZoom*1.57079633);
farther = fabs(midR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (midR > 0.0) midR = (midR*(1.0+midZoom))-(farther*midZoom*1.57079633);
if (midR < 0.0) midR = (midR*(1.0+midZoom))+(farther*midZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (midL*midGain);
inputSampleR += (midR*midGain);
if (trebleZoom > 0.0) {
double closer = trebleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleL = (trebleL*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
closer = trebleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
trebleR = (trebleR*(1.0-trebleZoom))+(sin(closer)*trebleZoom);
} //zooming in will make the body of the sound louder: it's just Density
if (trebleZoom < 0.0) {
double farther = fabs(trebleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleL > 0.0) trebleL = (trebleL*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleL < 0.0) trebleL = (trebleL*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
farther = fabs(trebleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (trebleR > 0.0) trebleR = (trebleR*(1.0+trebleZoom))-(farther*trebleZoom*1.57079633);
if (trebleR < 0.0) trebleR = (trebleR*(1.0+trebleZoom))+(farther*trebleZoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
inputSampleL += (trebleL*trebleGain);
inputSampleR += (trebleR*trebleGain);
for (int count = 0; count < zoomStages; count++) {
if (zoom > 0.0) {
double closer = inputSampleL * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleL = (inputSampleL*(1.0-zoom))+(sin(closer)*zoom);
closer = inputSampleR * 1.57079633;
if (closer > 1.57079633) closer = 1.57079633;
if (closer < -1.57079633) closer = -1.57079633;
inputSampleR = (inputSampleR*(1.0-zoom))+(sin(closer)*zoom);
} //zooming in will make the body of the sound louder: it's just Density
if (zoom < 0.0) {
double farther = fabs(inputSampleL) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleL > 0.0) inputSampleL = (inputSampleL*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleL < 0.0) inputSampleL = (inputSampleL*(1.0+zoom))+(farther*zoom*1.57079633);
farther = fabs(inputSampleR) * 1.57079633;
if (farther > 1.57079633) farther = 1.0;
else farther = 1.0-cos(farther);
if (inputSampleR > 0.0) inputSampleR = (inputSampleR*(1.0+zoom))-(farther*zoom*1.57079633);
if (inputSampleR < 0.0) inputSampleR = (inputSampleR*(1.0+zoom))+(farther*zoom*1.57079633);
} //zooming out boosts the hottest peaks but cuts back softer stuff
}
inputSampleL *= driveOut;
inputSampleR *= driveOut;
//begin ClipOnly2 stereo as a little, compressed chunk that can be dropped into code
if (inputSampleL > 4.0) inputSampleL = 4.0; if (inputSampleL < -4.0) inputSampleL = -4.0;
@ -934,7 +1037,6 @@ void Mastering::processDoubleReplacing(double **inputs, double **outputs, VstInt
inputSampleR = (inputSampleR * (1.0-depthSinew))+(lastSinewR*depthSinew);
//run Sinew to stop excess slews, but run a dry/wet to allow a range of brights
switch (dither) {
case 1:
//begin Dark

View file

@ -27,7 +27,8 @@ BigAmp is a very flexible amplike thing with a taste for the bizarre.[coll=Lates
Biquad is the Airwindows implementation of a biquad filter.[coll=]
Biquad2 is the Airwindows biquad filter that's more sweepable and synthy.[coll=]
BiquadDouble is a handy Airwindows cascaded biquad filter: steeper roll-off before resonance.[coll=]
BiquadNonLin is Capacitor2, but for biquad filtering.[coll=Latest]
BiquadHiLo is the highpass and lowpass filter in ConsoleX.[coll=]
BiquadNonLin is Capacitor2, but for biquad filtering.[coll=]
BiquadOneHalf is an interleaved biquad filter like Biquad.[coll=]
BiquadPlus is Biquad plus zipper noise suppression! For twiddling the controls.[coll=]
BiquadStack is a way of making a parametric EQ out of stacked biquad filters.[coll=Recommended,Latest]