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/StereoFX | |
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/StereoFX')
4 files changed, 89 insertions, 65 deletions
diff --git a/plugins/MacAU/StereoFX/StereoFX.cpp b/plugins/MacAU/StereoFX/StereoFX.cpp index 3c28466..0c32089 100755 --- a/plugins/MacAU/StereoFX/StereoFX.cpp +++ b/plugins/MacAU/StereoFX/StereoFX.cpp @@ -190,10 +190,8 @@ ComponentResult StereoFX::Reset(AudioUnitScope inScope, AudioUnitElement inElem iirSampleA = 0.0; iirSampleB = 0.0; flip = false; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; return noErr; } @@ -215,9 +213,6 @@ OSStatus StereoFX::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag Float64 overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double mid; @@ -334,28 +329,16 @@ OSStatus StereoFX::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - - //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/StereoFX/StereoFX.h b/plugins/MacAU/StereoFX/StereoFX.h index 11c97f6..a52f713 100755 --- a/plugins/MacAU/StereoFX/StereoFX.h +++ b/plugins/MacAU/StereoFX/StereoFX.h @@ -119,10 +119,8 @@ public: private: Float64 iirSampleA; Float64 iirSampleB; - 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/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser index 626bcdf..ad53de0 100755 --- a/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 364, + 462, 20, 48, 43, @@ -49,18 +49,53 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 546569486; - PBXWorkspaceStateSaveDate = 546569486; + PBXPerProjectTemplateStateSaveDate = 569681258; + PBXWorkspaceStateSaveDate = 569681258; + }; + perUserProjectItems = { + 8B79308D21F4A5EC006E9731 /* PBXTextBookmark */ = 8B79308D21F4A5EC006E9731 /* PBXTextBookmark */; + 8B79308F21F4A5EC006E9731 /* PBXTextBookmark */ = 8B79308F21F4A5EC006E9731 /* PBXTextBookmark */; + 8B79309421F4A60C006E9731 /* PBXTextBookmark */ = 8B79309421F4A60C006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; + 8B79308D21F4A5EC006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BC6025B073B072D006C4272 /* StereoFX.h */; + name = "StereoFX.h: 123"; + rLen = 0; + rLoc = 5154; + rType = 0; + vrLen = 1108; + vrLoc = 4168; + }; + 8B79308F21F4A5EC006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* StereoFX.cpp */; + name = "StereoFX.cpp: 345"; + rLen = 0; + rLoc = 14822; + rType = 0; + vrLen = 1556; + vrLoc = 12814; + }; + 8B79309421F4A60C006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* StereoFX.cpp */; + name = "StereoFX.cpp: 216"; + rLen = 0; + rLoc = 9502; + rType = 0; + vrLen = 1621; + vrLoc = 8612; + }; 8BA05A660720730100365D66 /* StereoFX.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1098, 5096}}"; - sepNavSelRange = "{12356, 2168}"; - sepNavVisRange = "{13918, 1439}"; + sepNavIntBoundsRect = "{{0, 0}, {670, 4888}}"; + sepNavSelRange = "{9502, 0}"; + sepNavVisRange = "{8612, 1621}"; sepNavWindowFrame = "{{763, 66}, {1145, 812}}"; }; }; @@ -89,9 +124,9 @@ }; 8BC6025B073B072D006C4272 /* StereoFX.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {974, 1729}}"; - sepNavSelRange = "{4892, 0}"; - sepNavVisRange = "{1992, 1673}"; + sepNavIntBoundsRect = "{{0, 0}, {922, 1911}}"; + sepNavSelRange = "{5154, 0}"; + sepNavVisRange = "{4168, 1108}"; sepNavWindowFrame = "{{726, 78}, {1021, 800}}"; }; }; diff --git a/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3 index 600e693..6d5fb55 100755 --- a/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/StereoFX/StereoFX.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>-1</integer> - <integer>-1</integer> + <integer>908</integer> + <integer>908</integer> </array> <key>Perspectives</key> <array> @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -307,7 +305,7 @@ </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {185, 428}}</string> + <string>{{0, 0}, {185, 649}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -317,14 +315,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {202, 446}}</string> + <string>{{0, 0}, {202, 667}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> <real>185</real> </array> <key>RubberWindowFrame</key> - <string>622 347 810 487 0 0 1440 878 </string> + <string>377 128 908 708 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -335,12 +333,14 @@ <key>Dock</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> <string>8B050BD820648DF500700365</string> <key>PBXProjectModuleLabel</key> - <string></string> + <string>StereoFX.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -348,7 +348,16 @@ <key>PBXProjectModuleGUID</key> <string>8B050BD920648DF500700365</string> <key>PBXProjectModuleLabel</key> - <string></string> + <string>StereoFX.cpp</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>8B79309421F4A60C006E9731</string> + <key>history</key> + <array> + <string>8B79308D21F4A5EC006E9731</string> + <string>8B79308F21F4A5EC006E9731</string> + </array> </dict> <key>SplitCount</key> <string>1</string> @@ -361,18 +370,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 0}}</string> + <string>{{0, 0}, {701, 497}}</string> <key>RubberWindowFrame</key> - <string>622 347 810 487 0 0 1440 878 </string> + <string>377 128 908 708 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>0pt</string> + <string>497pt</string> </dict> <dict> <key>Proportion</key> - <string>441pt</string> + <string>165pt</string> <key>Tabs</key> <array> <dict> @@ -386,9 +395,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>622 347 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {701, 138}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -442,7 +449,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {701, 138}}</string> + <key>RubberWindowFrame</key> + <string>377 128 908 708 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -451,7 +460,7 @@ </dict> </array> <key>Proportion</key> - <string>603pt</string> + <string>701pt</string> </dict> </array> <key>Name</key> @@ -470,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BC5CFD0209404910058B257</string> + <string>8B79309521F4A60C006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BC5CFD1209404910058B257</string> + <string>8B79309621F4A60C006E9731</string> <string>8B050BD820648DF500700365</string> - <string>8BC5CFD2209404910058B257</string> + <string>8B79309721F4A60C006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -627,7 +636,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>546571409.14249599</real> + <real>569681420.22861803</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -644,11 +653,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8BC5CFD3209404910058B257</string> <string>/Users/christopherjohnson/Desktop/MacAU/StereoFX/StereoFX.xcodeproj</string> </array> <key>WindowString</key> - <string>622 347 810 487 0 0 1440 878 </string> + <string>377 128 908 708 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |