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/BassKit | |
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/BassKit')
3 files changed, 36 insertions, 49 deletions
diff --git a/plugins/MacAU/BassKit/BassKit.cpp b/plugins/MacAU/BassKit/BassKit.cpp index 6663d2c..da7a49f 100755 --- a/plugins/MacAU/BassKit/BassKit.cpp +++ b/plugins/MacAU/BassKit/BassKit.cpp @@ -453,19 +453,15 @@ OSStatus BassKit::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags 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; //direct stereo out @@ -475,12 +471,6 @@ OSStatus BassKit::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags 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/BassKit/BassKit.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/BassKit/BassKit.xcodeproj/christopherjohnson.pbxuser index 44f513a..9b210d0 100755 --- a/plugins/MacAU/BassKit/BassKit.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/BassKit/BassKit.xcodeproj/christopherjohnson.pbxuser @@ -49,43 +49,43 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 561548993; - PBXWorkspaceStateSaveDate = 561548993; + PBXPerProjectTemplateStateSaveDate = 569589289; + PBXWorkspaceStateSaveDate = 569589289; }; perUserProjectItems = { - 8B15DC7821789307007AD769 /* PBXTextBookmark */ = 8B15DC7821789307007AD769 /* PBXTextBookmark */; - 8B15DC7921789307007AD769 /* PBXTextBookmark */ = 8B15DC7921789307007AD769 /* PBXTextBookmark */; + 8B7927F821F33F7A006E9731 /* PBXTextBookmark */ = 8B7927F821F33F7A006E9731 /* PBXTextBookmark */; + 8B7927FD21F33F8B006E9731 /* PBXTextBookmark */ = 8B7927FD21F33F8B006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B15DC7821789307007AD769 /* PBXTextBookmark */ = { + 8B7927F821F33F7A006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* BassKit.cpp */; name = "BassKit.cpp: 325"; rLen = 0; rLoc = 12649; rType = 0; - vrLen = 921; + vrLen = 816; vrLoc = 14920; }; - 8B15DC7921789307007AD769 /* PBXTextBookmark */ = { + 8B7927FD21F33F8B006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* BassKit.cpp */; name = "BassKit.cpp: 325"; rLen = 0; rLoc = 12649; rType = 0; - vrLen = 921; + vrLen = 816; vrLoc = 14920; }; 8BA05A660720730100365D66 /* BassKit.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {901, 5980}}"; + sepNavIntBoundsRect = "{{0, 0}, {761, 5824}}"; sepNavSelRange = "{12649, 0}"; - sepNavVisRange = "{14920, 921}"; - sepNavWindowFrame = "{{548, 68}, {890, 810}}"; + sepNavVisRange = "{14920, 816}"; + sepNavWindowFrame = "{{357, 57}, {890, 810}}"; }; }; 8BA05A690720730100365D66 /* BassKitVersion.h */ = { diff --git a/plugins/MacAU/BassKit/BassKit.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/BassKit/BassKit.xcodeproj/christopherjohnson.perspectivev3 index f21f89d..2a3cdcf 100755 --- a/plugins/MacAU/BassKit/BassKit.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/BassKit/BassKit.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>609 213 752 636 0 0 1440 878 </string> + <string>401 223 752 636 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>8B15DC7921789307007AD769</string> + <string>8B7927FD21F33F8B006E9731</string> <key>history</key> <array> - <string>8B15DC7821789307007AD769</string> + <string>8B7927F821F33F7A006E9731</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +367,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {545, 162}}</string> + <string>{{0, 0}, {545, 131}}</string> <key>RubberWindowFrame</key> - <string>609 213 752 636 0 0 1440 878 </string> + <string>401 223 752 636 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>162pt</string> + <string>131pt</string> </dict> <dict> <key>Proportion</key> - <string>428pt</string> + <string>459pt</string> <key>Tabs</key> <array> <dict> @@ -394,9 +392,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {545, 401}}</string> - <key>RubberWindowFrame</key> - <string>609 213 752 636 0 0 1440 878 </string> + <string>{{10, 27}, {545, 432}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -450,7 +446,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {545, 386}}</string> + <string>{{10, 27}, {545, 432}}</string> + <key>RubberWindowFrame</key> + <string>401 223 752 636 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -478,11 +476,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B15DC7A21789307007AD769</string> + <string>8B7927FE21F33F8B006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B15DC7B21789307007AD769</string> + <string>8B7927FF21F33F8B006E9731</string> <string>8B2720742173B3CC00396442</string> - <string>8B15DC7C21789307007AD769</string> + <string>8B79280021F33F8B006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +633,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>561550087.85150504</real> + <real>569589643.413149</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,11 +650,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B15DC7D21789307007AD769</string> <string>/Users/christopherjohnson/Desktop/MacAU/BassKit/BassKit.xcodeproj</string> </array> <key>WindowString</key> - <string>609 213 752 636 0 0 1440 878 </string> + <string>401 223 752 636 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |