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/Thunder | |
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/Thunder')
4 files changed, 83 insertions, 93 deletions
diff --git a/plugins/MacAU/Thunder/Thunder.cpp b/plugins/MacAU/Thunder/Thunder.cpp index 64bdf0c..f9dc657 100755 --- a/plugins/MacAU/Thunder/Thunder.cpp +++ b/plugins/MacAU/Thunder/Thunder.cpp @@ -179,10 +179,8 @@ ComponentResult Thunder::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ComponentResult Thunder::Reset(AudioUnitScope inScope, AudioUnitElement inElement) { - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; muSpeedA = 10000; muSpeedB = 10000; muCoefficientA = 1; @@ -240,9 +238,6 @@ OSStatus Thunder::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags Float64 resultML; Float64 resultMR; - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -423,28 +418,16 @@ OSStatus Thunder::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags inputSampleL *= outputGain; inputSampleR *= outputGain; } - - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } flip = !flip; - //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; diff --git a/plugins/MacAU/Thunder/Thunder.h b/plugins/MacAU/Thunder/Thunder.h index 4c01ac4..233c3db 100755 --- a/plugins/MacAU/Thunder/Thunder.h +++ b/plugins/MacAU/Thunder/Thunder.h @@ -129,10 +129,8 @@ private: Float64 iirSampleAM; Float64 iirSampleBM; Float64 iirSampleCM; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; bool flip; }; diff --git a/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.pbxuser index 908569c..32120c0 100755 --- a/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 292, + 383, 20, 48, 43, @@ -49,38 +49,59 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528458521; - PBXWorkspaceStateSaveDate = 528458521; + PBXPerProjectTemplateStateSaveDate = 569684635; + PBXWorkspaceStateSaveDate = 569684635; }; perUserProjectItems = { - 8B9D67CF1F7C90C4007AB60F /* PBXTextBookmark */ = 8B9D67CF1F7C90C4007AB60F /* PBXTextBookmark */; - 8B9D76B11F7FA32E007AB60F /* PBXTextBookmark */ = 8B9D76B11F7FA32E007AB60F /* PBXTextBookmark */; + 8B79317B21F4B33A006E9731 /* PBXTextBookmark */ = 8B79317B21F4B33A006E9731 /* PBXTextBookmark */; + 8B79317C21F4B33A006E9731 /* PBXTextBookmark */ = 8B79317C21F4B33A006E9731 /* PBXTextBookmark */; + 8B79317E21F4B33A006E9731 /* PBXTextBookmark */ = 8B79317E21F4B33A006E9731 /* PBXTextBookmark */; + 8B79318321F4B354006E9731 /* PBXTextBookmark */ = 8B79318321F4B354006E9731 /* PBXTextBookmark */; 8B9EC58B1D90BE2400BD1DCA /* PlistBookmark */ = 8B9EC58B1D90BE2400BD1DCA /* PlistBookmark */; - 8BFE4BDA1D92E59A00BBC6AC /* PBXTextBookmark */ = 8BFE4BDA1D92E59A00BBC6AC /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D67CF1F7C90C4007AB60F /* PBXTextBookmark */ = { + 8B79317B21F4B33A006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* ThunderVersion.h */; name = "ThunderVersion.h: 51"; rLen = 0; rLoc = 2757; rType = 0; - vrLen = 344; - vrLoc = 2598; + vrLen = 286; + vrLoc = 2656; }; - 8B9D76B11F7FA32E007AB60F /* PBXTextBookmark */ = { + 8B79317C21F4B33A006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BA05A690720730100365D66 /* ThunderVersion.h */; - name = "ThunderVersion.h: 51"; + fRef = 8BC6025B073B072D006C4272 /* Thunder.h */; + name = "Thunder.h: 134"; rLen = 0; - rLoc = 2757; + rLoc = 5285; + rType = 0; + vrLen = 598; + vrLoc = 4806; + }; + 8B79317E21F4B33A006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* Thunder.cpp */; + name = "Thunder.cpp: 431"; + rLen = 0; + rLoc = 16556; + rType = 0; + vrLen = 1132; + vrLoc = 15627; + }; + 8B79318321F4B354006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* Thunder.cpp */; + name = "Thunder.cpp: 431"; + rLen = 0; + rLoc = 16556; rType = 0; - vrLen = 315; - vrLoc = 2627; + vrLen = 1172; + vrLoc = 15587; }; 8B9EC58B1D90BE2400BD1DCA /* PlistBookmark */ = { isa = PlistBookmark; @@ -96,25 +117,25 @@ }; 8BA05A660720730100365D66 /* Thunder.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 6071}}"; - sepNavSelRange = "{10065, 0}"; - sepNavVisRange = "{9779, 2277}"; + sepNavIntBoundsRect = "{{0, 0}, {754, 6227}}"; + sepNavSelRange = "{16556, 0}"; + sepNavVisRange = "{15587, 1172}"; sepNavWindowFrame = "{{258, 39}, {895, 819}}"; }; }; 8BA05A690720730100365D66 /* ThunderVersion.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {824, 806}}"; + sepNavIntBoundsRect = "{{0, 0}, {824, 832}}"; sepNavSelRange = "{2757, 0}"; - sepNavVisRange = "{2627, 315}"; + sepNavVisRange = "{2656, 286}"; sepNavWindowFrame = "{{15, 54}, {895, 819}}"; }; }; 8BC6025B073B072D006C4272 /* Thunder.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1807}}"; - sepNavSelRange = "{5082, 0}"; - sepNavVisRange = "{3802, 1647}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2197}}"; + sepNavSelRange = "{5285, 0}"; + sepNavVisRange = "{4806, 598}"; sepNavWindowFrame = "{{7, 42}, {895, 819}}"; }; }; @@ -132,16 +153,6 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8BFE4BDA1D92E59A00BBC6AC /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* Thunder.cpp */; - name = "Thunder.cpp: 227"; - rLen = 0; - rLoc = 9525; - rType = 0; - vrLen = 508; - vrLoc = 12277; - }; 8D01CCC60486CAD60068D4B7 /* Thunder */ = { activeExec = 0; }; diff --git a/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.perspectivev3 index 25a2588..5586ae7 100755 --- a/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Thunder/Thunder.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -282,7 +280,7 @@ <dict> <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> <array> - <real>288</real> + <real>197</real> </array> <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> <array> @@ -308,7 +306,7 @@ </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {288, 595}}</string> + <string>{{0, 0}, {197, 595}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -318,19 +316,19 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {305, 613}}</string> + <string>{{0, 0}, {214, 613}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> - <real>288</real> + <real>197</real> </array> <key>RubberWindowFrame</key> - <string>566 213 841 654 0 0 1440 878 </string> + <string>473 199 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> <key>Proportion</key> - <string>305pt</string> + <string>214pt</string> </dict> <dict> <key>Dock</key> @@ -341,7 +339,7 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274A1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>ThunderVersion.h</string> + <string>Thunder.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -349,16 +347,17 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274B1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>ThunderVersion.h</string> + <string>Thunder.cpp</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D76B11F7FA32E007AB60F</string> + <string>8B79318321F4B354006E9731</string> <key>history</key> <array> <string>8B9EC58B1D90BE2400BD1DCA</string> - <string>8BFE4BDA1D92E59A00BBC6AC</string> - <string>8B9D67CF1F7C90C4007AB60F</string> + <string>8B79317B21F4B33A006E9731</string> + <string>8B79317C21F4B33A006E9731</string> + <string>8B79317E21F4B33A006E9731</string> </array> </dict> <key>SplitCount</key> @@ -372,18 +371,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 216}}</string> + <string>{{0, 0}, {622, 493}}</string> <key>RubberWindowFrame</key> - <string>566 213 841 654 0 0 1440 878 </string> + <string>473 199 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>216pt</string> + <string>493pt</string> </dict> <dict> <key>Proportion</key> - <string>392pt</string> + <string>115pt</string> <key>Tabs</key> <array> <dict> @@ -397,9 +396,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 365}}</string> - <key>RubberWindowFrame</key> - <string>566 213 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {622, 88}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -453,7 +450,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {622, 88}}</string> + <key>RubberWindowFrame</key> + <string>473 199 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -462,7 +461,7 @@ </dict> </array> <key>Proportion</key> - <string>531pt</string> + <string>622pt</string> </dict> </array> <key>Name</key> @@ -481,11 +480,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D76B21F7FA32E007AB60F</string> + <string>8B79318421F4B354006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D76B31F7FA32E007AB60F</string> + <string>8B79318521F4B354006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D76B41F7FA32E007AB60F</string> + <string>8B79318621F4B354006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -658,7 +657,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528458542.19629401</real> + <real>569684820.36503005</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -675,11 +674,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D76B51F7FA32E007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/Thunder/Thunder.xcodeproj</string> </array> <key>WindowString</key> - <string>566 213 841 654 0 0 1440 878 </string> + <string>473 199 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |