diff --git a/Airwindopedia.txt b/Airwindopedia.txt index c63781ca1..523619bce 100644 --- a/Airwindopedia.txt +++ b/Airwindopedia.txt @@ -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 that’s 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 can’t predict what will take off: for all I know, this is THE basic digital filter everyone’s been waiting for, the one that just sounds right for every purpose. Or not. But you can’t 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. diff --git a/plugins/LinuxVST/src/Mastering/Mastering.cpp b/plugins/LinuxVST/src/Mastering/Mastering.cpp index 42bd78ff2..b62b7b285 100755 --- a/plugins/LinuxVST/src/Mastering/Mastering.cpp +++ b/plugins/LinuxVST/src/Mastering/Mastering.cpp @@ -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! } } diff --git a/plugins/LinuxVST/src/Mastering/Mastering.h b/plugins/LinuxVST/src/Mastering/Mastering.h index a3165b57a..e51767747 100755 --- a/plugins/LinuxVST/src/Mastering/Mastering.h +++ b/plugins/LinuxVST/src/Mastering/Mastering.h @@ -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, diff --git a/plugins/LinuxVST/src/Mastering/MasteringProc.cpp b/plugins/LinuxVST/src/Mastering/MasteringProc.cpp index 92fe6dd55..835ac9049 100755 --- a/plugins/LinuxVST/src/Mastering/MasteringProc.cpp +++ b/plugins/LinuxVST/src/Mastering/MasteringProc.cpp @@ -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 diff --git a/plugins/MacAU/Mastering/Mastering.cpp b/plugins/MacAU/Mastering/Mastering.cpp index 27a149138..93933fdb9 100755 --- a/plugins/MacAU/Mastering/Mastering.cpp +++ b/plugins/MacAU/Mastering/Mastering.cpp @@ -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 diff --git a/plugins/MacAU/Mastering/Mastering.h b/plugins/MacAU/Mastering/Mastering.h index 4fd36fe4e..b257437b2 100755 --- a/plugins/MacAU/Mastering/Mastering.h +++ b/plugins/MacAU/Mastering/Mastering.h @@ -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 diff --git a/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser index fedf33c7a..1b4b60f2b 100755 --- a/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser @@ -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 */ = { diff --git a/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 index 9f91ca4b9..d7dc4255b 100755 --- a/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 @@ -324,7 +324,7 @@ 185 RubberWindowFrame - 0 299 810 487 0 0 1440 878 + 29 275 810 487 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -340,7 +340,7 @@ PBXProjectModuleGUID 8BC435722CC6F8650098AE55 PBXProjectModuleLabel - Mastering.cpp + Mastering.h PBXSplitModuleInNavigatorKey Split0 @@ -348,14 +348,15 @@ PBXProjectModuleGUID 8BC435732CC6F8650098AE55 PBXProjectModuleLabel - Mastering.cpp + Mastering.h _historyCapacity 0 bookmark - 8BC437832CC7CCED0098AE55 + 8B965A692D26B080004D9AF8 history - 8BC4371D2CC70EE00098AE55 + 8B679E312D24813200C14ACE + 8BB7CE152D25C50500084318 SplitCount @@ -369,18 +370,18 @@ GeometryConfiguration Frame - {{0, 0}, {603, 86}} + {{0, 0}, {603, 69}} RubberWindowFrame - 0 299 810 487 0 0 1440 878 + 29 275 810 487 0 0 1440 878 Module PBXNavigatorGroup Proportion - 86pt + 69pt Proportion - 355pt + 372pt Tabs @@ -394,9 +395,9 @@ GeometryConfiguration Frame - {{10, 27}, {603, 328}} + {{10, 27}, {603, 345}} RubberWindowFrame - 0 299 810 487 0 0 1440 878 + 29 275 810 487 0 0 1440 878 Module XCDetailModule @@ -430,7 +431,7 @@ GeometryConfiguration Frame - {{10, 31}, {603, 297}} + {{10, 27}, {603, 297}} Module PBXCVSModule @@ -450,7 +451,7 @@ GeometryConfiguration Frame - {{10, 27}, {603, 282}} + {{10, 27}, {603, 312}} Module PBXBuildResultsModule @@ -478,11 +479,11 @@ TableOfContents - 8BC437842CC7CCED0098AE55 + 8B965A6A2D26B080004D9AF8 1CA23ED40692098700951B8B - 8BC437852CC7CCED0098AE55 + 8B965A6B2D26B080004D9AF8 8BC435722CC6F8650098AE55 - 8BC437862CC7CCED0098AE55 + 8B965A6C2D26B080004D9AF8 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -635,7 +636,7 @@ StatusbarIsVisible TimeStamp - 751291629.93373895 + 757510272.42657495 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -652,11 +653,10 @@ 5 WindowOrderList - 8BC437872CC7CCED0098AE55 /Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/Mastering/Mastering.xcodeproj WindowString - 0 299 810 487 0 0 1440 878 + 29 275 810 487 0 0 1440 878 WindowToolsV3 diff --git a/plugins/MacSignedAU/Mastering/Mastering.cpp b/plugins/MacSignedAU/Mastering/Mastering.cpp index 497fe7a46..bf5f8a129 100755 --- a/plugins/MacSignedAU/Mastering/Mastering.cpp +++ b/plugins/MacSignedAU/Mastering/Mastering.cpp @@ -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 diff --git a/plugins/MacSignedAU/Mastering/Mastering.h b/plugins/MacSignedAU/Mastering/Mastering.h index 4fd36fe4e..b257437b2 100755 --- a/plugins/MacSignedAU/Mastering/Mastering.h +++ b/plugins/MacSignedAU/Mastering/Mastering.h @@ -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 diff --git a/plugins/MacSignedAU/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacSignedAU/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate index 26e4854b1..240418c70 100644 Binary files a/plugins/MacSignedAU/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate and b/plugins/MacSignedAU/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate index 1b0eb5d4f..f44ccc79c 100755 Binary files a/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate and b/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/xcshareddata/xcschemes/Mastering.xcscheme b/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/xcshareddata/xcschemes/Mastering.xcscheme index 25b189cb2..49ff03401 100644 --- a/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/xcshareddata/xcschemes/Mastering.xcscheme +++ b/plugins/MacSignedVST/Mastering/Mastering.xcodeproj/xcshareddata/xcschemes/Mastering.xcscheme @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@ diff --git a/plugins/MacSignedVST/Mastering/source/Mastering.cpp b/plugins/MacSignedVST/Mastering/source/Mastering.cpp index 42bd78ff2..b62b7b285 100755 --- a/plugins/MacSignedVST/Mastering/source/Mastering.cpp +++ b/plugins/MacSignedVST/Mastering/source/Mastering.cpp @@ -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! } } diff --git a/plugins/MacSignedVST/Mastering/source/Mastering.h b/plugins/MacSignedVST/Mastering/source/Mastering.h index a3165b57a..e51767747 100755 --- a/plugins/MacSignedVST/Mastering/source/Mastering.h +++ b/plugins/MacSignedVST/Mastering/source/Mastering.h @@ -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, diff --git a/plugins/MacSignedVST/Mastering/source/MasteringProc.cpp b/plugins/MacSignedVST/Mastering/source/MasteringProc.cpp index 92fe6dd55..835ac9049 100755 --- a/plugins/MacSignedVST/Mastering/source/MasteringProc.cpp +++ b/plugins/MacSignedVST/Mastering/source/MasteringProc.cpp @@ -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 diff --git a/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser index 403ae21bd..af5a7e82a 100755 --- a/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.pbxuser @@ -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; diff --git a/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 index 380594e0b..d01f873af 100755 --- a/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Mastering/Mastering.xcodeproj/christopherjohnson.perspectivev3 @@ -227,7 +227,7 @@ Content PBXProjectModuleGUID - 8BC437A72CC7CE520098AE55 + 8BB7CE1A2D25C50500084318 PBXProjectModuleLabel MasteringProc.cpp PBXSplitModuleInNavigatorKey @@ -235,16 +235,16 @@ Split0 PBXProjectModuleGUID - 8BC437A82CC7CE520098AE55 + 8BB7CE1B2D25C50500084318 PBXProjectModuleLabel MasteringProc.cpp _historyCapacity 0 bookmark - 8BC437A92CC7CE520098AE55 + 8B965A912D26B0A2004D9AF8 history - 8BC437962CC7CE130098AE55 + 8BB7CE1C2D25C50500084318 SplitCount @@ -260,7 +260,7 @@ PBXModuleWindowStatusBarHidden2 RubberWindowFrame - 543 103 895 775 0 0 1440 878 + 381 103 895 775 0 0 1440 878 @@ -364,7 +364,7 @@ 185 RubberWindowFrame - 620 297 810 487 0 0 1440 878 + 576 240 810 487 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -380,7 +380,7 @@ PBXProjectModuleGUID 8B0237581D42B1C400E1E8C8 PBXProjectModuleLabel - Mastering.h + MasteringProc.cpp PBXSplitModuleInNavigatorKey Split0 @@ -388,16 +388,16 @@ PBXProjectModuleGUID 8B0237591D42B1C400E1E8C8 PBXProjectModuleLabel - Mastering.h + MasteringProc.cpp _historyCapacity 0 bookmark - 8BC437A32CC7CE520098AE55 + 8B965A902D26B0A2004D9AF8 history - 8BF17AF32CB7F7B000FAAF3F - 8BC437242CC70EF00098AE55 - 8BC4377F2CC7CCEC0098AE55 + 8B0D55732D234EF000BCAE09 + 8B679E532D24836600C14ACE + 8BB7CE192D25C50500084318 SplitCount @@ -411,18 +411,18 @@ GeometryConfiguration Frame - {{0, 0}, {603, 0}} + {{0, 0}, {603, 32}} RubberWindowFrame - 620 297 810 487 0 0 1440 878 + 576 240 810 487 0 0 1440 878 Module PBXNavigatorGroup Proportion - 0pt + 32pt Proportion - 441pt + 409pt Tabs @@ -436,9 +436,9 @@ GeometryConfiguration Frame - {{10, 27}, {603, 414}} + {{10, 27}, {603, 382}} RubberWindowFrame - 620 297 810 487 0 0 1440 878 + 576 240 810 487 0 0 1440 878 Module XCDetailModule @@ -520,11 +520,11 @@ TableOfContents - 8BC437A42CC7CE520098AE55 + 8B965A822D26B0A2004D9AF8 1CA23ED40692098700951B8B - 8BC437A52CC7CE520098AE55 + 8B965A832D26B0A2004D9AF8 8B0237581D42B1C400E1E8C8 - 8BC437A62CC7CE520098AE55 + 8B965A842D26B0A2004D9AF8 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -697,7 +697,7 @@ StatusbarIsVisible TimeStamp - 751291986.86297703 + 757510306.54983306 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -715,10 +715,10 @@ WindowOrderList /Users/christopherjohnson/Desktop/airwindows/plugins/MacVST/Mastering/Mastering.xcodeproj - 8BC437A72CC7CE520098AE55 + 8BB7CE1A2D25C50500084318 WindowString - 620 297 810 487 0 0 1440 878 + 576 240 810 487 0 0 1440 878 WindowToolsV3 diff --git a/plugins/MacVST/Mastering/source/Mastering.cpp b/plugins/MacVST/Mastering/source/Mastering.cpp index 42bd78ff2..b62b7b285 100755 --- a/plugins/MacVST/Mastering/source/Mastering.cpp +++ b/plugins/MacVST/Mastering/source/Mastering.cpp @@ -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! } } diff --git a/plugins/MacVST/Mastering/source/Mastering.h b/plugins/MacVST/Mastering/source/Mastering.h index a3165b57a..e51767747 100755 --- a/plugins/MacVST/Mastering/source/Mastering.h +++ b/plugins/MacVST/Mastering/source/Mastering.h @@ -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, diff --git a/plugins/MacVST/Mastering/source/MasteringProc.cpp b/plugins/MacVST/Mastering/source/MasteringProc.cpp index 92fe6dd55..835ac9049 100755 --- a/plugins/MacVST/Mastering/source/MasteringProc.cpp +++ b/plugins/MacVST/Mastering/source/MasteringProc.cpp @@ -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 diff --git a/plugins/WinVST/Mastering/.vs/VSTProject/v14/.suo b/plugins/WinVST/Mastering/.vs/VSTProject/v14/.suo index 248fbe7b4..019d81539 100755 Binary files a/plugins/WinVST/Mastering/.vs/VSTProject/v14/.suo and b/plugins/WinVST/Mastering/.vs/VSTProject/v14/.suo differ diff --git a/plugins/WinVST/Mastering/Mastering.cpp b/plugins/WinVST/Mastering/Mastering.cpp index 42bd78ff2..b62b7b285 100755 --- a/plugins/WinVST/Mastering/Mastering.cpp +++ b/plugins/WinVST/Mastering/Mastering.cpp @@ -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! } } diff --git a/plugins/WinVST/Mastering/Mastering.h b/plugins/WinVST/Mastering/Mastering.h index a3165b57a..e51767747 100755 --- a/plugins/WinVST/Mastering/Mastering.h +++ b/plugins/WinVST/Mastering/Mastering.h @@ -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, diff --git a/plugins/WinVST/Mastering/MasteringProc.cpp b/plugins/WinVST/Mastering/MasteringProc.cpp index 92fe6dd55..835ac9049 100755 --- a/plugins/WinVST/Mastering/MasteringProc.cpp +++ b/plugins/WinVST/Mastering/MasteringProc.cpp @@ -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 diff --git a/what.txt b/what.txt index 0ce1a4c31..6b8753a80 100644 --- a/what.txt +++ b/what.txt @@ -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]