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/TapeDust | |
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/TapeDust')
4 files changed, 82 insertions, 73 deletions
diff --git a/plugins/MacAU/TapeDust/TapeDust.cpp b/plugins/MacAU/TapeDust/TapeDust.cpp index 1f87d66..c586339 100755 --- a/plugins/MacAU/TapeDust/TapeDust.cpp +++ b/plugins/MacAU/TapeDust/TapeDust.cpp @@ -167,9 +167,8 @@ ComponentResult TapeDust::Initialize() void TapeDust::TapeDustKernel::Reset() { for(int count = 0; count < 11; count++) {b[count] = 0.0; f[count] = 0.0;} - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; + fpFlip = false; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -184,9 +183,6 @@ void TapeDust::TapeDustKernel::Process( const Float32 *inSourceP, UInt32 nSampleFrames = inFramesToProcess; const Float32 *sourceP = inSourceP; Float32 *destP = inDestP; - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSample; Float64 drySample; Float64 rRange = pow(GetParameter( kParam_One ),2)*5.0; @@ -250,20 +246,13 @@ void TapeDust::TapeDustKernel::Process( const Float32 *inSourceP, if (wet < 1.0) { inputSample = (inputSample * wet) + (drySample * dry); } - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSample; - fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeA; - } - else { - fpTemp = inputSample; - fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeB; - } fpFlip = !fpFlip; - //end noise shaping on 32 bit output + + //32 bit dither, made small and tidy. + int expon; frexpf((Float32)inputSample, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSample += (dither-fpNShape); fpNShape = dither; + //end 32 bit dither *destP = inputSample; diff --git a/plugins/MacAU/TapeDust/TapeDust.h b/plugins/MacAU/TapeDust/TapeDust.h index 55255f3..6898d7e 100755 --- a/plugins/MacAU/TapeDust/TapeDust.h +++ b/plugins/MacAU/TapeDust/TapeDust.h @@ -130,8 +130,7 @@ public: private: Float64 b[11]; Float64 f[11]; - long double fpNShapeA; - long double fpNShapeB; + long double fpNShape; bool fpFlip; }; }; diff --git a/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser index 910a299..7e3a474 100755 --- a/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 292, + 499, 20, 48, 43, @@ -49,18 +49,20 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528458482; - PBXWorkspaceStateSaveDate = 528458482; + PBXPerProjectTemplateStateSaveDate = 569683382; + PBXWorkspaceStateSaveDate = 569683382; }; perUserProjectItems = { - 8B9D67BE1F7C9098007AB60F /* PlistBookmark */ = 8B9D67BE1F7C9098007AB60F /* PlistBookmark */; - 8B9D76A21F7FA30E007AB60F /* PlistBookmark */ = 8B9D76A21F7FA30E007AB60F /* PlistBookmark */; + 8B79314C21F4AE33006E9731 /* PlistBookmark */ = 8B79314C21F4AE33006E9731 /* PlistBookmark */; + 8B79315421F4AE7A006E9731 /* PBXTextBookmark */ = 8B79315421F4AE7A006E9731 /* PBXTextBookmark */; + 8B79315521F4AE7A006E9731 /* PBXTextBookmark */ = 8B79315521F4AE7A006E9731 /* PBXTextBookmark */; + 8B79315621F4AE7A006E9731 /* PBXTextBookmark */ = 8B79315621F4AE7A006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D67BE1F7C9098007AB60F /* PlistBookmark */ = { + 8B79314C21F4AE33006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -70,25 +72,43 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/TapeDust/Info.plist; rLen = 0; - rLoc = 9223372036854775808; + rLoc = 9223372036854775807; }; - 8B9D76A21F7FA30E007AB60F /* PlistBookmark */ = { - isa = PlistBookmark; - fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; - fallbackIsa = PBXBookmark; - isK = 0; - kPath = ( - CFBundleName, - ); - name = /Users/christopherjohnson/Desktop/MacAU/TapeDust/Info.plist; + 8B79315421F4AE7A006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BC6025B073B072D006C4272 /* TapeDust.h */; + name = "TapeDust.h: 134"; rLen = 0; - rLoc = 9223372036854775807; + rLoc = 5248; + rType = 0; + vrLen = 1104; + vrLoc = 4248; + }; + 8B79315521F4AE7A006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* TapeDust.cpp */; + name = "TapeDust.cpp: 171"; + rLen = 0; + rLoc = 7722; + rType = 0; + vrLen = 1529; + vrLoc = 7003; + }; + 8B79315621F4AE7A006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* TapeDust.cpp */; + name = "TapeDust.cpp: 249"; + rLen = 0; + rLoc = 10792; + rType = 0; + vrLen = 959; + vrLoc = 10175; }; 8BA05A660720730100365D66 /* TapeDust.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {958, 3679}}"; - sepNavSelRange = "{9254, 0}"; - sepNavVisRange = "{8609, 2167}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 3666}}"; + sepNavSelRange = "{10792, 0}"; + sepNavVisRange = "{10175, 959}"; sepNavWindowFrame = "{{415, 39}, {1005, 839}}"; }; }; @@ -102,9 +122,9 @@ }; 8BC6025B073B072D006C4272 /* TapeDust.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {958, 1846}}"; - sepNavSelRange = "{5174, 36}"; - sepNavVisRange = "{3746, 1638}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2054}}"; + sepNavSelRange = "{5248, 0}"; + sepNavVisRange = "{4248, 1110}"; sepNavWindowFrame = "{{4, 39}, {1005, 839}}"; }; }; diff --git a/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3 index f7b0fff..c956cc8 100755 --- a/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/TapeDust/TapeDust.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>841</integer> - <integer>841</integer> + <integer>927</integer> + <integer>927</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> @@ -282,7 +280,7 @@ <dict> <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> <array> - <real>288</real> + <real>167</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}, {167, 689}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -318,30 +316,32 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {305, 613}}</string> + <string>{{0, 0}, {184, 707}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> - <real>288</real> + <real>167</real> </array> <key>RubberWindowFrame</key> - <string>432 155 841 654 0 0 1440 878 </string> + <string>372 100 927 748 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> <key>Proportion</key> - <string>305pt</string> + <string>184pt</string> </dict> <dict> <key>Dock</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> <string>8BD7274A1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>Info.plist</string> + <string>TapeDust.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -349,14 +349,16 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274B1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>Info.plist</string> + <string>TapeDust.cpp</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D76A21F7FA30E007AB60F</string> + <string>8B79315621F4AE7A006E9731</string> <key>history</key> <array> - <string>8B9D67BE1F7C9098007AB60F</string> + <string>8B79314C21F4AE33006E9731</string> + <string>8B79315421F4AE7A006E9731</string> + <string>8B79315521F4AE7A006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +372,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 229}}</string> + <string>{{0, 0}, {738, 552}}</string> <key>RubberWindowFrame</key> - <string>432 155 841 654 0 0 1440 878 </string> + <string>372 100 927 748 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>229pt</string> + <string>552pt</string> </dict> <dict> <key>Proportion</key> - <string>379pt</string> + <string>150pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +397,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 352}}</string> - <key>RubberWindowFrame</key> - <string>432 155 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {738, 123}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +451,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {738, 123}}</string> + <key>RubberWindowFrame</key> + <string>372 100 927 748 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -460,7 +462,7 @@ </dict> </array> <key>Proportion</key> - <string>531pt</string> + <string>738pt</string> </dict> </array> <key>Name</key> @@ -479,11 +481,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D76A31F7FA30E007AB60F</string> + <string>8B79315721F4AE7A006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D76A41F7FA30E007AB60F</string> + <string>8B79315821F4AE7A006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D76A51F7FA30E007AB60F</string> + <string>8B79315921F4AE7A006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -656,7 +658,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528458510.42729199</real> + <real>569683578.38407302</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -673,11 +675,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D76A61F7FA30E007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/TapeDust/TapeDust.xcodeproj</string> </array> <key>WindowString</key> - <string>432 155 841 654 0 0 1440 878 </string> + <string>372 100 927 748 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |