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/DubCenter | |
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/DubCenter')
3 files changed, 40 insertions, 52 deletions
diff --git a/plugins/MacAU/DubCenter/DubCenter.cpp b/plugins/MacAU/DubCenter/DubCenter.cpp index e0bfcae..397d118 100755 --- a/plugins/MacAU/DubCenter/DubCenter.cpp +++ b/plugins/MacAU/DubCenter/DubCenter.cpp @@ -608,18 +608,14 @@ OSStatus DubCenter::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla bflip++; if (bflip < 1 || bflip > 3) bflip = 1; - //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; @@ -630,12 +626,6 @@ OSStatus DubCenter::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFla 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/DubCenter/DubCenter.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.pbxuser index 7ca3e9a..92a76a9 100755 --- a/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.pbxuser @@ -49,50 +49,50 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 561682686; - PBXWorkspaceStateSaveDate = 561682686; + PBXPerProjectTemplateStateSaveDate = 569601995; + PBXWorkspaceStateSaveDate = 569601995; }; perUserProjectItems = { - 8B15DBE021788E16007AD769 /* PBXTextBookmark */ = 8B15DBE021788E16007AD769 /* PBXTextBookmark */; - 8B15DC9D217A9A34007AD769 /* PBXTextBookmark */ = 8B15DC9D217A9A34007AD769 /* PBXTextBookmark */; + 8B792B6021F37032006E9731 /* PBXTextBookmark */ = 8B792B6021F37032006E9731 /* PBXTextBookmark */; + 8B792B6521F37044006E9731 /* PBXTextBookmark */ = 8B792B6521F37044006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B15DBE021788E16007AD769 /* PBXTextBookmark */ = { + 8B792B6021F37032006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* DubCenterVersion.h */; name = "DubCenterVersion.h: 1"; rLen = 0; rLoc = 0; rType = 0; - vrLen = 138; + vrLen = 72; vrLoc = 0; }; - 8B15DC9D217A9A34007AD769 /* PBXTextBookmark */ = { + 8B792B6521F37044006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* DubCenterVersion.h */; name = "DubCenterVersion.h: 1"; rLen = 0; rLoc = 0; rType = 0; - vrLen = 75; + vrLen = 72; vrLoc = 0; }; 8BA05A660720730100365D66 /* DubCenter.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {843, 8515}}"; - sepNavSelRange = "{21662, 0}"; - sepNavVisRange = "{18060, 2145}"; - sepNavWindowFrame = "{{524, 68}, {890, 810}}"; + sepNavIntBoundsRect = "{{0, 0}, {843, 8710}}"; + sepNavSelRange = "{25766, 0}"; + sepNavVisRange = "{12612, 2162}"; + sepNavWindowFrame = "{{418, 60}, {890, 810}}"; }; }; 8BA05A690720730100365D66 /* DubCenterVersion.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {803, 845}}"; sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{0, 75}"; + sepNavVisRange = "{0, 72}"; sepNavWindowFrame = "{{15, 63}, {890, 810}}"; }; }; @@ -106,9 +106,9 @@ 8BC6025B073B072D006C4272 /* DubCenter.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {894, 2626}}"; - sepNavSelRange = "{6309, 802}"; - sepNavVisRange = "{1890, 2172}"; - sepNavWindowFrame = "{{743, 68}, {890, 810}}"; + sepNavSelRange = "{6647, 0}"; + sepNavVisRange = "{6253, 1011}"; + sepNavWindowFrame = "{{550, 68}, {890, 810}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.perspectivev3 index 9e4deb2..db80a2d 100755 --- a/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/DubCenter/DubCenter.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -324,7 +322,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>824 324 573 517 0 0 1440 878 </string> + <string>506 318 573 517 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,10 +350,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B15DC9D217A9A34007AD769</string> + <string>8B792B6521F37044006E9731</string> <key>history</key> <array> - <string>8B15DBE021788E16007AD769</string> + <string>8B792B6021F37032006E9731</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +367,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {366, 119}}</string> + <string>{{0, 0}, {366, 103}}</string> <key>RubberWindowFrame</key> - <string>824 324 573 517 0 0 1440 878 </string> + <string>506 318 573 517 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>119pt</string> + <string>103pt</string> </dict> <dict> <key>Proportion</key> - <string>352pt</string> + <string>368pt</string> <key>Tabs</key> <array> <dict> @@ -394,9 +392,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {366, 325}}</string> - <key>RubberWindowFrame</key> - <string>824 324 573 517 0 0 1440 878 </string> + <string>{{10, 27}, {366, 341}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -450,7 +446,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {366, 282}}</string> + <string>{{10, 27}, {366, 341}}</string> + <key>RubberWindowFrame</key> + <string>506 318 573 517 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -478,11 +476,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B15DC9E217A9A34007AD769</string> + <string>8B792B6621F37044006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B15DC9F217A9A34007AD769</string> + <string>8B792B6721F37044006E9731</string> <string>8B27205C2173B3A600396442</string> - <string>8B15DCA0217A9A34007AD769</string> + <string>8B792B6821F37044006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +633,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>561682996.86381996</real> + <real>569602116.17734897</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -655,7 +653,7 @@ <string>/Users/christopherjohnson/Desktop/MacAU/DubCenter/DubCenter.xcodeproj</string> </array> <key>WindowString</key> - <string>824 324 573 517 0 0 1440 878 </string> + <string>506 318 573 517 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |