YNotBandpass

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

View file

@ -173,7 +173,7 @@ ComponentResult ConsoleMCBuss::Initialize()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ComponentResult ConsoleMCBuss::Reset(AudioUnitScope inScope, AudioUnitElement inElement)
{
for (int x = 0; x < gslew_total; x++) gslew[x] = 0.0;
lastSinewL = lastSinewR = 0.0;
subAL = subAR = subBL = subBR = subCL = subCR = subDL = subDR = 0.0;
gainA = gainB = 1.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
@ -198,36 +198,16 @@ OSStatus ConsoleMCBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
overallscale /= 44100.0;
overallscale *= GetSampleRate();
double source = 0.814/overallscale;
gslew[threshold10] = source;
source *= 1.618033988749894848204586;
gslew[threshold9] = source;
source *= 1.618033988749894848204586;
gslew[threshold8] = source;
source *= 1.618033988749894848204586;
gslew[threshold7] = source;
source *= 1.618033988749894848204586;
gslew[threshold6] = source;
source *= 1.618033988749894848204586;
gslew[threshold5] = source;
source *= 1.618033988749894848204586;
gslew[threshold4] = source;
source *= 1.618033988749894848204586;
gslew[threshold3] = source;
source *= 1.618033988749894848204586;
gslew[threshold2] = source;
source *= 1.618033988749894848204586;
gslew[threshold1] = source;
source *= 1.618033988749894848204586;
gainA = gainB;
gainB = sqrt(GetParameter( kParam_One )); //smoothed master fader from Z2 filters
//this will be applied three times: this is to make the various tone alterations
//hit differently at different master fader drive levels.
//in particular, backing off the master fader tightens the super lows
//but opens up the EverySlew, because more of the attentuation happens before
//but opens up the modified Sinew, because more of the attentuation happens before
//you even get to slew clipping :) and if the fader is not active, it bypasses completely.
double threshSinew = 0.5171104/overallscale;
while (nSampleFrames-- > 0) {
double inputSampleL = *inputL;
double inputSampleR = *inputR;
@ -297,24 +277,23 @@ OSStatus ConsoleMCBuss::ProcessBufferLists(AudioUnitRenderActionFlags & ioActio
} //if using the master fader, we are going to attenuate three places.
//after C7Buss but before EverySlew: allow highs to come out a bit more
//when pulling back master fader. Less drive equals more open
//begin EverySlew
for (int x = 20; x < gslew_total; x += 5) { //gslew_total is 50
if (((inputSampleL-gslew[x])-((gslew[x]-gslew[x+2])*0.618033988749894848204586)) > gslew[x+4])
inputSampleL = (gslew[x]-((gslew[x]-gslew[x+2])*0.141)) + (gslew[x+4]*(1.0-0.141));
if (-((inputSampleL-gslew[x])-((gslew[x]-gslew[x+2])*0.618033988749894848204586)) > gslew[x+4])
inputSampleL = (gslew[x]-((gslew[x]-gslew[x+2])*0.141*0.78)) - (gslew[x+4]*(1.0-(0.141*0.78)));
gslew[x+2] = gslew[x]*(1.0-0.141);
gslew[x] = inputSampleL;
if (((inputSampleR-gslew[x+1])-((gslew[x+1]-gslew[x+3])*0.618033988749894848204586)) > gslew[x+4])
inputSampleR = (gslew[x+1]-((gslew[x+1]-gslew[x+3])*0.141)) + (gslew[x+4]*(1.0-0.141));
if (-((inputSampleR-gslew[x+1])-((gslew[x+1]-gslew[x+3])*0.618033988749894848204586)) > gslew[x+4])
inputSampleR = (gslew[x+1]-((gslew[x+1]-gslew[x+3])*0.141*0.78)) - (gslew[x+4]*(1.0-(0.141*0.78)));
gslew[x+3] = gslew[x+1]*(1.0-0.141);
gslew[x+1] = inputSampleR;
}
temp = inputSampleL;
double clamp = inputSampleL - lastSinewL;
if (lastSinewL > 1.0) lastSinewL = 1.0;
if (lastSinewL < -1.0) lastSinewL = -1.0;
double sinew = threshSinew * cos(lastSinewL);
if (clamp > sinew) temp = lastSinewL + sinew;
if (-clamp > sinew) temp = lastSinewL - sinew;
inputSampleL = lastSinewL = temp;
temp = inputSampleR;
clamp = inputSampleR - lastSinewR;
if (lastSinewR > 1.0) lastSinewR = 1.0;
if (lastSinewR < -1.0) lastSinewR = -1.0;
sinew = threshSinew * cos(lastSinewR);
if (clamp > sinew) temp = lastSinewR + sinew;
if (-clamp > sinew) temp = lastSinewR - sinew;
inputSampleR = lastSinewR = temp;
if (gain < 1.0) {
inputSampleL *= gain;

View file

@ -107,62 +107,10 @@ public:
/*! @method Version */
virtual ComponentResult Version() { return kConsoleMCBussVersion; }
private:
enum {
prevSampL1,
prevSampR1,
invSampL1,
invSampR1,
threshold1,
prevSampL2,
prevSampR2,
invSampL2,
invSampR2,
threshold2,
prevSampL3,
prevSampR3,
invSampL3,
invSampR3,
threshold3,
prevSampL4,
prevSampR4,
invSampL4,
invSampR4,
threshold4,
prevSampL5,
prevSampR5,
invSampL5,
invSampR5,
threshold5,
prevSampL6,
prevSampR6,
invSampL6,
invSampR6,
threshold6,
prevSampL7,
prevSampR7,
invSampL7,
invSampR7,
threshold7,
prevSampL8,
prevSampR8,
invSampL8,
invSampR8,
threshold8,
prevSampL9,
prevSampR9,
invSampL9,
invSampR9,
threshold9,
prevSampL10,
prevSampR10,
invSampL10,
invSampR10,
threshold10,
gslew_total
}; //fixed frequency pear filter for ultrasonics, stereo
double gslew[gslew_total]; //probably worth just using a number here
private:
double lastSinewL;
double lastSinewR;
double subAL;
double subAR;
double subBL;

View file

@ -51,14 +51,12 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 718748917;
PBXWorkspaceStateSaveDate = 718748917;
PBXPerProjectTemplateStateSaveDate = 719180153;
PBXWorkspaceStateSaveDate = 719180153;
};
perUserProjectItems = {
8BB909FD2AD4CEAF005AFA8A /* PBXTextBookmark */ = 8BB909FD2AD4CEAF005AFA8A /* PBXTextBookmark */;
8BC5E9E62AD73ECE0007A2D0 /* PBXTextBookmark */ = 8BC5E9E62AD73ECE0007A2D0 /* PBXTextBookmark */;
8BC5E9E72AD73ECE0007A2D0 /* PBXTextBookmark */ = 8BC5E9E72AD73ECE0007A2D0 /* PBXTextBookmark */;
8BC5E9E82AD73ECE0007A2D0 /* PBXTextBookmark */ = 8BC5E9E82AD73ECE0007A2D0 /* PBXTextBookmark */;
8BDCB21C2ADDE0B700ADE91B /* PBXTextBookmark */ = 8BDCB21C2ADDE0B700ADE91B /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
@ -66,15 +64,15 @@
};
8BA05A660720730100365D66 /* ConsoleMCBuss.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1659, 6228}}";
sepNavSelRange = "{10341, 4034}";
sepNavVisRange = "{13504, 1509}";
sepNavWindowFrame = "{{558, 38}, {859, 840}}";
sepNavIntBoundsRect = "{{0, 0}, {1659, 6012}}";
sepNavSelRange = "{12832, 0}";
sepNavVisRange = "{12149, 1645}";
sepNavWindowFrame = "{{576, 28}, {859, 840}}";
};
};
8BA05A690720730100365D66 /* ConsoleMCBussVersion.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1056, 1062}}";
sepNavIntBoundsRect = "{{0, 0}, {554, 1116}}";
sepNavSelRange = "{2934, 0}";
sepNavVisRange = "{0, 0}";
sepNavWindowFrame = "{{482, 3}, {1086, 835}}";
@ -87,36 +85,6 @@
sepNavVisRange = "{0, 1336}";
};
};
8BB909FD2AD4CEAF005AFA8A /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* ConsoleMCBuss.h */;
name = "ConsoleMCBuss.h: 197";
rLen = 0;
rLoc = 5890;
rType = 0;
vrLen = 0;
vrLoc = 6030;
};
8BC5E9E62AD73ECE0007A2D0 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* ConsoleMCBuss.cpp */;
name = "ConsoleMCBuss.cpp: 223";
rLen = 0;
rLoc = 9628;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8BC5E9E72AD73ECE0007A2D0 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* ConsoleMCBussVersion.h */;
name = "ConsoleMCBussVersion.h: 54";
rLen = 0;
rLoc = 2934;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8BC5E9E82AD73ECE0007A2D0 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* ConsoleMCBussVersion.h */;
@ -129,9 +97,9 @@
};
8BC6025B073B072D006C4272 /* ConsoleMCBuss.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1146, 3330}}";
sepNavSelRange = "{5443, 0}";
sepNavVisRange = "{2694, 1136}";
sepNavIntBoundsRect = "{{0, 0}, {1146, 2988}}";
sepNavSelRange = "{4837, 0}";
sepNavVisRange = "{4157, 1077}";
sepNavWindowFrame = "{{294, 38}, {1146, 835}}";
};
};
@ -149,6 +117,16 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8BDCB21C2ADDE0B700ADE91B /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* ConsoleMCBussVersion.h */;
name = "ConsoleMCBussVersion.h: 54";
rLen = 0;
rLoc = 2934;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8D01CCC60486CAD60068D4B7 /* ConsoleMCBuss */ = {
activeExec = 0;
};

View file

@ -324,7 +324,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
<string>586 364 810 487 0 0 1440 878 </string>
<string>289 361 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -352,12 +352,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>8BC5E9E82AD73ECE0007A2D0</string>
<string>8BDCB21C2ADDE0B700ADE91B</string>
<key>history</key>
<array>
<string>8BB909FD2AD4CEAF005AFA8A</string>
<string>8BC5E9E62AD73ECE0007A2D0</string>
<string>8BC5E9E72AD73ECE0007A2D0</string>
<string>8BC5E9E82AD73ECE0007A2D0</string>
</array>
</dict>
<key>SplitCount</key>
@ -371,18 +369,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {603, 13}}</string>
<string>{{0, 0}, {603, 0}}</string>
<key>RubberWindowFrame</key>
<string>586 364 810 487 0 0 1440 878 </string>
<string>289 361 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>13pt</string>
<string>0pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>428pt</string>
<string>441pt</string>
<key>Tabs</key>
<array>
<dict>
@ -396,9 +394,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 401}}</string>
<key>RubberWindowFrame</key>
<string>586 364 810 487 0 0 1440 878 </string>
<string>{{10, 27}, {603, 414}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -452,7 +448,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 282}}</string>
<string>{{10, 27}, {603, 414}}</string>
<key>RubberWindowFrame</key>
<string>289 361 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -480,11 +478,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>8BC5E9E92AD73ECE0007A2D0</string>
<string>8BDCB21D2ADDE0B700ADE91B</string>
<string>1CA23ED40692098700951B8B</string>
<string>8BC5E9EA2AD73ECE0007A2D0</string>
<string>8BDCB21E2ADDE0B700ADE91B</string>
<string>8B966AE42AC8C55C0063C683</string>
<string>8BC5E9EB2AD73ECE0007A2D0</string>
<string>8BDCB21F2ADDE0B700ADE91B</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -657,7 +655,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
<real>718749390.02774405</real>
<real>719184055.86891198</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@ -674,10 +672,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>8BDCB2202ADDE0B700ADE91B</string>
<string>/Users/christopherjohnson/Desktop/airwindows/plugins/MacAU/ConsoleMCBuss/ConsoleMCBuss.xcodeproj</string>
</array>
<key>WindowString</key>
<string>586 364 810 487 0 0 1440 878 </string>
<string>289 361 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>