BiquadHiLo

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

View file

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

View file

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

View file

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

View file

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

View file

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