diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
commit | 966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch) | |
tree | b0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/MacAU/Gatelinked | |
parent | 0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff) | |
download | airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2 airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip |
Floating Point Dither For All
Diffstat (limited to 'plugins/MacAU/Gatelinked')
3 files changed, 43 insertions, 50 deletions
diff --git a/plugins/MacAU/Gatelinked/Gatelinked.cpp b/plugins/MacAU/Gatelinked/Gatelinked.cpp index 9c0c484..641b64d 100755 --- a/plugins/MacAU/Gatelinked/Gatelinked.cpp +++ b/plugins/MacAU/Gatelinked/Gatelinked.cpp @@ -310,7 +310,7 @@ OSStatus Gatelinked::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFl if (highestSample > threshold) { treblefreq += attackSpeed; - if (treblefreq > 1.0) treblefreq = 1.0; + if (treblefreq > 2.0) treblefreq = 2.0; bassfreq -= attackSpeed; bassfreq -= attackSpeed; if (bassfreq < 0.0) bassfreq = 0.0; @@ -337,6 +337,8 @@ OSStatus Gatelinked::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFl iirLowpassAR = (iirLowpassAR * (1.0 - treblefreq)) + (inputSampleR * treblefreq); } + if (bassfreq > 1.0) bassfreq = 1.0; + if (bassfreq > 0.0) { iirHighpassAL = (iirHighpassAL * (1.0 - bassfreq)) + (inputSampleL * bassfreq); iirHighpassAR = (iirHighpassAR * (1.0 - bassfreq)) + (inputSampleR * bassfreq); @@ -358,7 +360,7 @@ OSStatus Gatelinked::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFl if (highestSample > threshold) { treblefreq += attackSpeed; - if (treblefreq > 1.0) treblefreq = 1.0; + if (treblefreq > 2.0) treblefreq = 2.0; bassfreq -= attackSpeed; bassfreq -= attackSpeed; if (bassfreq < 0.0) bassfreq = 0.0; @@ -385,6 +387,8 @@ OSStatus Gatelinked::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFl iirLowpassBR = (iirLowpassBR * (1.0 - treblefreq)) + (inputSampleR * treblefreq); } + if (bassfreq > 1.0) bassfreq = 1.0; + if (bassfreq > 0.0) { iirHighpassBL = (iirHighpassBL * (1.0 - bassfreq)) + (inputSampleL * bassfreq); iirHighpassBR = (iirHighpassBR * (1.0 - bassfreq)) + (inputSampleR * bassfreq); @@ -408,18 +412,14 @@ OSStatus Gatelinked::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFl flip = !flip; - //noise shaping to 32-bit floating point - Float32 fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((Float32)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((Float32)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *outputL = inputSampleL; *outputR = inputSampleR; @@ -430,12 +430,6 @@ OSStatus Gatelinked::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFl outputL += 1; outputR += 1; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. return noErr; } diff --git a/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.pbxuser index 21b7e89..9dd8e83 100755 --- a/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.pbxuser @@ -49,13 +49,13 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 565400646; - PBXWorkspaceStateSaveDate = 565400646; + PBXPerProjectTemplateStateSaveDate = 569646892; + PBXWorkspaceStateSaveDate = 569646892; }; perUserProjectItems = { 8B0209B221B3258000952287 /* PBXTextBookmark */ = 8B0209B221B3258000952287 /* PBXTextBookmark */; - 8B0209B421B3258000952287 /* PBXTextBookmark */ = 8B0209B421B3258000952287 /* PBXTextBookmark */; - 8B020A3621B354DE00952287 /* PBXTextBookmark */ = 8B020A3621B354DE00952287 /* PBXTextBookmark */; + 8B416D4621B5FDC600DD5013 /* PBXTextBookmark */ = 8B416D4621B5FDC600DD5013 /* PBXTextBookmark */; + 8B792C8121F41F65006E9731 /* PBXTextBookmark */ = 8B792C8121F41F65006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -71,39 +71,39 @@ vrLen = 140; vrLoc = 5351; }; - 8B0209B421B3258000952287 /* PBXTextBookmark */ = { + 8B416D4621B5FDC600DD5013 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* GatelinkedVersion.h */; name = "GatelinkedVersion.h: 54"; rLen = 0; rLoc = 2902; rType = 0; - vrLen = 139; + vrLen = 130; vrLoc = 2826; }; - 8B020A3621B354DE00952287 /* PBXTextBookmark */ = { + 8B792C8121F41F65006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* GatelinkedVersion.h */; name = "GatelinkedVersion.h: 54"; rLen = 0; rLoc = 2902; rType = 0; - vrLen = 131; + vrLen = 130; vrLoc = 2826; }; 8BA05A660720730100365D66 /* Gatelinked.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1105, 6136}}"; - sepNavSelRange = "{15096, 0}"; - sepNavVisRange = "{14897, 1807}"; + sepNavIntBoundsRect = "{{0, 0}, {1105, 6071}}"; + sepNavSelRange = "{16752, 0}"; + sepNavVisRange = "{15147, 1623}"; sepNavWindowFrame = "{{177, 58}, {1152, 820}}"; }; }; 8BA05A690720730100365D66 /* GatelinkedVersion.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {761, 936}}"; + sepNavIntBoundsRect = "{{0, 0}, {456, 871}}"; sepNavSelRange = "{2902, 0}"; - sepNavVisRange = "{2826, 131}"; + sepNavVisRange = "{2826, 130}"; sepNavWindowFrame = "{{15, 43}, {705, 830}}"; }; }; @@ -118,7 +118,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {894, 1833}}"; sepNavSelRange = "{5276, 0}"; - sepNavVisRange = "{2524, 1545}"; + sepNavVisRange = "{3729, 1930}"; sepNavWindowFrame = "{{735, 48}, {705, 830}}"; }; }; diff --git a/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.perspectivev3 index caae9ee..acd4314 100755 --- a/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Gatelinked/Gatelinked.xcodeproj/christopherjohnson.perspectivev3 @@ -324,7 +324,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>622 458 815 376 0 0 1440 878 </string> + <string>491 452 815 376 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,11 +352,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B020A3621B354DE00952287</string> + <string>8B792C8121F41F65006E9731</string> <key>history</key> <array> <string>8B0209B221B3258000952287</string> - <string>8B0209B421B3258000952287</string> + <string>8B416D4621B5FDC600DD5013</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +370,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {505, 84}}</string> + <string>{{0, 0}, {505, 51}}</string> <key>RubberWindowFrame</key> - <string>622 458 815 376 0 0 1440 878 </string> + <string>491 452 815 376 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>84pt</string> + <string>51pt</string> </dict> <dict> <key>Proportion</key> - <string>246pt</string> + <string>279pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +395,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {505, 219}}</string> + <string>{{10, 27}, {505, 252}}</string> <key>RubberWindowFrame</key> - <string>622 458 815 376 0 0 1440 878 </string> + <string>491 452 815 376 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +451,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {505, 303}}</string> + <string>{{10, 27}, {505, 235}}</string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B020A3721B354DE00952287</string> + <string>8B792C8221F41F65006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B020A3821B354DE00952287</string> + <string>8B792C8321F41F65006E9731</string> <string>8BCAE2B921B0AD04005A3737</string> - <string>8B020A3921B354DE00952287</string> + <string>8B792C8421F41F65006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +636,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>565400798.62677002</real> + <real>569646949.70571005</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,11 +653,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B020A3A21B354DE00952287</string> <string>/Users/christopherjohnson/Desktop/MacAU/Gatelinked/Gatelinked.xcodeproj</string> </array> <key>WindowString</key> - <string>622 458 815 376 0 0 1440 878 </string> + <string>491 452 815 376 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |