diff options
author | Chris Johnson <jinx6568@sover.net> | 2020-06-14 21:15:05 -0400 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2020-06-14 21:15:05 -0400 |
commit | 6e0febe954289baac253c2b432d1dc4dec403c30 (patch) | |
tree | d8780d64a2a3f4abeeacc780014e4ac8f1d132b7 /plugins/MacAU | |
parent | 169631d08c44b5a46391e5ab90284ef07de46853 (diff) | |
download | airwindows-lv2-port-6e0febe954289baac253c2b432d1dc4dec403c30.tar.gz airwindows-lv2-port-6e0febe954289baac253c2b432d1dc4dec403c30.tar.bz2 airwindows-lv2-port-6e0febe954289baac253c2b432d1dc4dec403c30.zip |
Dark Redux
Diffstat (limited to 'plugins/MacAU')
-rwxr-xr-x | plugins/MacAU/Dark/Dark.cpp | 24 | ||||
-rwxr-xr-x | plugins/MacAU/Dark/Dark.h | 7 | ||||
-rwxr-xr-x | plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser | 60 | ||||
-rwxr-xr-x | plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 | 34 |
4 files changed, 70 insertions, 55 deletions
diff --git a/plugins/MacAU/Dark/Dark.cpp b/plugins/MacAU/Dark/Dark.cpp index 11380b4..5f24cd4 100755 --- a/plugins/MacAU/Dark/Dark.cpp +++ b/plugins/MacAU/Dark/Dark.cpp @@ -60,6 +60,7 @@ Dark::Dark(AudioUnit component) CreateElements(); Globals()->UseIndexedParameters(kNumberOfParameters); SetParameter(kParam_One, kDefaultValue_ParamOne ); + SetParameter(kParam_Two, kDefaultValue_ParamTwo ); #if AU_DEBUG_DISPATCHER mDebugDispatcher = new AUDebugDispatcher (this); @@ -118,6 +119,13 @@ ComponentResult Dark::GetParameterInfo(AudioUnitScope inScope, outParameterInfo.maxValue = kHD; outParameterInfo.defaultValue = kDefaultValue_ParamOne; break; + case kParam_Two: + AUBase::FillInParameterName (outParameterInfo, kParameterTwoName, false); + outParameterInfo.unit = kAudioUnitParameterUnit_Generic; + outParameterInfo.minValue = 0.0; + outParameterInfo.maxValue = 1.0; + outParameterInfo.defaultValue = kDefaultValue_ParamTwo; + break; default: result = kAudioUnitErr_InvalidParameter; break; @@ -197,14 +205,19 @@ void Dark::DarkKernel::Process( const Float32 *inSourceP, if (depth > 98) depth = 98; bool highres = false; if (GetParameter( kParam_One ) == 1) highres = true; + Float32 scaleFactor; + if (highres) scaleFactor = 8388608.0; + else scaleFactor = 32768.0; + Float32 derez = GetParameter( kParam_Two ); + if (derez > 0.0) scaleFactor *= pow(1.0-derez,6); + if (scaleFactor < 1.0) scaleFactor = 1.0; while (nSampleFrames-- > 0) { Float32 inputSample = *sourceP; if (fabs(inputSample)<1.18e-37) inputSample = fpd * 1.18e-37; fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; - if (highres) inputSample *= 8388608.0; - else inputSample *= 32768.0; + inputSample *= scaleFactor; //0-1 is now one bit, now we dither int quantA = floor(inputSample); @@ -221,8 +234,8 @@ void Dark::DarkKernel::Process( const Float32 *inSourceP, //we are doing that to voice the thing down into the upper mids a bit //it mustn't just soften the brightest treble, it must smooth high mids too - float testA = fabs((lastSample[0] - quantA) - expectedSlew); - float testB = fabs((lastSample[0] - quantB) - expectedSlew); + Float32 testA = fabs((lastSample[0] - quantA) - expectedSlew); + Float32 testB = fabs((lastSample[0] - quantB) - expectedSlew); if (testA < testB) inputSample = quantA; else inputSample = quantB; @@ -235,8 +248,7 @@ void Dark::DarkKernel::Process( const Float32 *inSourceP, } lastSample[0] = inputSample; - if (highres) inputSample /= 8388608.0; - else inputSample /= 32768.0; + inputSample /= scaleFactor; *destP = inputSample; diff --git a/plugins/MacAU/Dark/Dark.h b/plugins/MacAU/Dark/Dark.h index daef9e0..acb68d9 100755 --- a/plugins/MacAU/Dark/Dark.h +++ b/plugins/MacAU/Dark/Dark.h @@ -58,14 +58,17 @@ static CFStringRef kParameterOneName = CFSTR("Quantizer"); static const int kCD = 0; static const int kHD = 1; static const int kDefaultValue_ParamOne = kHD; - static CFStringRef kMenuItem_CD = CFSTR ("CD 16 bit"); static CFStringRef kMenuItem_HD = CFSTR ("HD 24 bit"); +static CFStringRef kParameterTwoName = CFSTR("DeRez"); +static const float kDefaultValue_ParamTwo = 0.0; + enum { kParam_One = 0, + kParam_Two = 1, //Add your parameters here... - kNumberOfParameters=1 + kNumberOfParameters=2 }; #pragma mark ____Dark diff --git a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser index 60e6725..f8a4499 100755 --- a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser @@ -49,15 +49,15 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 612641477; - PBXWorkspaceStateSaveDate = 612641477; + PBXPerProjectTemplateStateSaveDate = 613790145; + PBXWorkspaceStateSaveDate = 613790145; }; perUserProjectItems = { 8BD14F0224842AB600B025B9 /* PlistBookmark */ = 8BD14F0224842AB600B025B9 /* PlistBookmark */; 8BD14F0324842AB600B025B9 /* PBXTextBookmark */ = 8BD14F0324842AB600B025B9 /* PBXTextBookmark */; - 8BD14F0424842AB600B025B9 /* PBXTextBookmark */ = 8BD14F0424842AB600B025B9 /* PBXTextBookmark */; - 8BD14F3A24843ADE00B025B9 /* PBXTextBookmark */ = 8BD14F3A24843ADE00B025B9 /* PBXTextBookmark */; - 8BD14F3B24843ADE00B025B9 /* PBXTextBookmark */ = 8BD14F3B24843ADE00B025B9 /* PBXTextBookmark */; + 8BD150CD24956DA100B025B9 /* PBXTextBookmark */ = 8BD150CD24956DA100B025B9 /* PBXTextBookmark */; + 8BD1515C2495A6F200B025B9 /* PBXTextBookmark */ = 8BD1515C2495A6F200B025B9 /* PBXTextBookmark */; + 8BD151A22495B1D300B025B9 /* PBXTextBookmark */ = 8BD151A22495B1D300B025B9 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -65,9 +65,9 @@ }; 8BA05A660720730100365D66 /* Dark.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {824, 3146}}"; - sepNavSelRange = "{10085, 0}"; - sepNavVisRange = "{9189, 955}"; + sepNavIntBoundsRect = "{{0, 0}, {656, 3536}}"; + sepNavSelRange = "{10164, 0}"; + sepNavVisRange = "{9020, 1552}"; sepNavWindowFrame = "{{6, 57}, {790, 821}}"; }; }; @@ -81,10 +81,10 @@ }; 8BC6025B073B072D006C4272 /* Dark.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1781}}"; - sepNavSelRange = "{5054, 0}"; - sepNavVisRange = "{2743, 647}"; - sepNavWindowFrame = "{{26, 57}, {790, 821}}"; + sepNavIntBoundsRect = "{{0, 0}, {824, 1716}}"; + sepNavSelRange = "{5175, 0}"; + sepNavVisRange = "{2696, 815}"; + sepNavWindowFrame = "{{28, 47}, {790, 821}}"; }; }; 8BD14F0224842AB600B025B9 /* PlistBookmark */ = { @@ -109,35 +109,35 @@ vrLen = 1283; vrLoc = 1638; }; - 8BD14F0424842AB600B025B9 /* PBXTextBookmark */ = { + 8BD150CD24956DA100B025B9 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* Dark.cpp */; - name = "Dark.cpp: 176"; - rLen = 66; - rLoc = 7490; + fRef = 8BC6025B073B072D006C4272 /* Dark.h */; + name = "Dark.h: 130"; + rLen = 0; + rLoc = 5175; rType = 0; - vrLen = 1240; - vrLoc = 6908; + vrLen = 815; + vrLoc = 2696; }; - 8BD14F3A24843ADE00B025B9 /* PBXTextBookmark */ = { + 8BD1515C2495A6F200B025B9 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BC6025B073B072D006C4272 /* Dark.h */; - name = "Dark.h: 127"; + fRef = 8BA05A660720730100365D66 /* Dark.cpp */; + name = "Dark.cpp: 213"; rLen = 0; - rLoc = 5054; + rLoc = 9186; rType = 0; - vrLen = 647; - vrLoc = 2743; + vrLen = 1424; + vrLoc = 8513; }; - 8BD14F3B24843ADE00B025B9 /* PBXTextBookmark */ = { + 8BD151A22495B1D300B025B9 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Dark.cpp */; - name = "Dark.cpp: 242"; + name = "Dark.cpp: 238"; rLen = 0; - rLoc = 10085; + rLoc = 10164; rType = 0; - vrLen = 955; - vrLoc = 9189; + vrLen = 1552; + vrLoc = 9020; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { isa = PBXSourceControlManager; diff --git a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 index 4caf832..1848996 100755 --- a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 @@ -324,7 +324,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>590 222 841 654 0 0 1440 878 </string> + <string>7 216 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -354,13 +354,13 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BD14F3B24843ADE00B025B9</string> + <string>8BD151A22495B1D300B025B9</string> <key>history</key> <array> <string>8BD14F0224842AB600B025B9</string> <string>8BD14F0324842AB600B025B9</string> - <string>8BD14F3A24843ADE00B025B9</string> - <string>8BD14F0424842AB600B025B9</string> + <string>8BD150CD24956DA100B025B9</string> + <string>8BD1515C2495A6F200B025B9</string> </array> </dict> <key>SplitCount</key> @@ -374,18 +374,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 417}}</string> + <string>{{0, 0}, {531, 514}}</string> <key>RubberWindowFrame</key> - <string>590 222 841 654 0 0 1440 878 </string> + <string>7 216 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>417pt</string> + <string>514pt</string> </dict> <dict> <key>Proportion</key> - <string>191pt</string> + <string>94pt</string> <key>Tabs</key> <array> <dict> @@ -399,9 +399,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 164}}</string> + <string>{{10, 27}, {531, 67}}</string> <key>RubberWindowFrame</key> - <string>590 222 841 654 0 0 1440 878 </string> + <string>7 216 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -455,7 +455,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 339}}</string> + <string>{{10, 27}, {531, 61}}</string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -483,11 +483,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BD14F3C24843ADE00B025B9</string> + <string>8BD151A32495B1D300B025B9</string> <string>1CA23ED40692098700951B8B</string> - <string>8BD14F3D24843ADE00B025B9</string> + <string>8BD151A42495B1D300B025B9</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8BD14F3E24843ADE00B025B9</string> + <string>8BD151A52495B1D300B025B9</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -660,7 +660,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>612645598.50175905</real> + <real>613790163.86573398</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -677,10 +677,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>/Users/christopherjohnson/Desktop/Plugins/MacAU/Dark/Dark.xcodeproj</string> + <string>/Users/christopherjohnson/Desktop/Dithers/MacAU/Dark/Dark.xcodeproj</string> </array> <key>WindowString</key> - <string>590 222 841 654 0 0 1440 878 </string> + <string>7 216 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |