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/PyewacketMono | |
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/PyewacketMono')
4 files changed, 57 insertions, 73 deletions
diff --git a/plugins/MacAU/PyewacketMono/PyewacketMono.cpp b/plugins/MacAU/PyewacketMono/PyewacketMono.cpp index 0bc0096..8ea6ab2 100755 --- a/plugins/MacAU/PyewacketMono/PyewacketMono.cpp +++ b/plugins/MacAU/PyewacketMono/PyewacketMono.cpp @@ -174,9 +174,7 @@ ComponentResult PyewacketMono::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void PyewacketMono::PyewacketMonoKernel::Reset() { - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; chase = 1.0; lastrectifier = 0.0; } @@ -198,7 +196,6 @@ void PyewacketMono::PyewacketMonoKernel::Process( const Float32 *inSourceP, overallscale *= GetSampleRate(); if (overallscale < 0.1) overallscale = 1.0; //insanity check - Float32 fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! long double fpNew = 1.0 - fpOld; long double inputSample; @@ -283,19 +280,11 @@ void PyewacketMono::PyewacketMonoKernel::Process( const Float32 *inSourceP, inputSample *= outputGain; } - //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/PyewacketMono/PyewacketMono.h b/plugins/MacAU/PyewacketMono/PyewacketMono.h index f3c89ae..469c9f0 100755 --- a/plugins/MacAU/PyewacketMono/PyewacketMono.h +++ b/plugins/MacAU/PyewacketMono/PyewacketMono.h @@ -130,9 +130,7 @@ public: virtual void Reset(); private: - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; Float64 chase; Float64 lastrectifier; }; diff --git a/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.pbxuser index 59685c5..dda132c 100755 --- a/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 292, + 383, 20, 48, 43, @@ -49,14 +49,14 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528457773; - PBXWorkspaceStateSaveDate = 528457773; + PBXPerProjectTemplateStateSaveDate = 569678053; + PBXWorkspaceStateSaveDate = 569678053; }; perUserProjectItems = { 8B3839AE1DB941F200AB1616 /* PlistBookmark */ = 8B3839AE1DB941F200AB1616 /* PlistBookmark */; - 8B383A0D1DB9520500AB1616 /* PBXTextBookmark */ = 8B383A0D1DB9520500AB1616 /* PBXTextBookmark */; - 8B9D66C51F7C8D8D007AB60F /* PBXTextBookmark */ = 8B9D66C51F7C8D8D007AB60F /* PBXTextBookmark */; - 8B9D75CD1F7FA05E007AB60F /* PBXTextBookmark */ = 8B9D75CD1F7FA05E007AB60F /* PBXTextBookmark */; + 8B792F8C21F4992B006E9731 /* PBXTextBookmark */ = 8B792F8C21F4992B006E9731 /* PBXTextBookmark */; + 8B792F8E21F4992B006E9731 /* PBXTextBookmark */ = 8B792F8E21F4992B006E9731 /* PBXTextBookmark */; + 8B792F9321F4993E006E9731 /* PBXTextBookmark */ = 8B792F9321F4993E006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -74,41 +74,41 @@ rLen = 0; rLoc = 9223372036854775808; }; - 8B383A0D1DB9520500AB1616 /* PBXTextBookmark */ = { + 8B792F8C21F4992B006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BC6025B073B072D006C4272 /* PyewacketMono.h */; - name = "PyewacketMono.h: 159"; + name = "PyewacketMono.h: 133"; rLen = 0; - rLoc = 5419; + rLoc = 5336; rType = 0; - vrLen = 0; - vrLoc = 5529; + vrLen = 254; + vrLoc = 5234; }; - 8B9D66C51F7C8D8D007AB60F /* PBXTextBookmark */ = { + 8B792F8E21F4992B006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* PyewacketMono.cpp */; - name = "PyewacketMono.cpp: 210"; + name = "PyewacketMono.cpp: 288"; rLen = 0; - rLoc = 9389; + rLoc = 12575; rType = 0; - vrLen = 572; - vrLoc = 10834; + vrLen = 970; + vrLoc = 11693; }; - 8B9D75CD1F7FA05E007AB60F /* PBXTextBookmark */ = { + 8B792F9321F4993E006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* PyewacketMono.cpp */; - name = "PyewacketMono.cpp: 210"; + name = "PyewacketMono.cpp: 288"; rLen = 0; - rLoc = 9389; + rLoc = 12575; rType = 0; - vrLen = 530; - vrLoc = 10834; + vrLen = 989; + vrLoc = 11674; }; 8BA05A660720730100365D66 /* PyewacketMono.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {691, 4056}}"; - sepNavSelRange = "{9389, 0}"; - sepNavVisRange = "{10834, 530}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 4030}}"; + sepNavSelRange = "{12575, 0}"; + sepNavVisRange = "{11674, 989}"; sepNavWindowFrame = "{{761, 39}, {679, 835}}"; }; }; @@ -122,9 +122,9 @@ }; 8BC6025B073B072D006C4272 /* PyewacketMono.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1872}}"; - sepNavSelRange = "{5378, 17}"; - sepNavVisRange = "{3870, 1659}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2041}}"; + sepNavSelRange = "{5336, 0}"; + sepNavVisRange = "{5234, 254}"; sepNavWindowFrame = "{{657, 41}, {731, 835}}"; }; }; diff --git a/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.perspectivev3 index 60a47c2..3572251 100755 --- a/plugins/MacAU/PyewacketMono/PyewacketMono.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/PyewacketMono/PyewacketMono.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>579 196 841 654 0 0 1440 878 </string> + <string>446 198 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> @@ -353,12 +351,12 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D75CD1F7FA05E007AB60F</string> + <string>8B792F9321F4993E006E9731</string> <key>history</key> <array> <string>8B3839AE1DB941F200AB1616</string> - <string>8B383A0D1DB9520500AB1616</string> - <string>8B9D66C51F7C8D8D007AB60F</string> + <string>8B792F8C21F4992B006E9731</string> + <string>8B792F8E21F4992B006E9731</string> </array> </dict> <key>SplitCount</key> @@ -372,18 +370,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 229}}</string> + <string>{{0, 0}, {622, 417}}</string> <key>RubberWindowFrame</key> - <string>579 196 841 654 0 0 1440 878 </string> + <string>446 198 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>229pt</string> + <string>417pt</string> </dict> <dict> <key>Proportion</key> - <string>379pt</string> + <string>191pt</string> <key>Tabs</key> <array> <dict> @@ -397,9 +395,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 352}}</string> - <key>RubberWindowFrame</key> - <string>579 196 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {622, 164}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -453,7 +449,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 339}}</string> + <string>{{10, 27}, {622, 164}}</string> + <key>RubberWindowFrame</key> + <string>446 198 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -462,7 +460,7 @@ </dict> </array> <key>Proportion</key> - <string>531pt</string> + <string>622pt</string> </dict> </array> <key>Name</key> @@ -481,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D75CE1F7FA05E007AB60F</string> + <string>8B792F9421F4993E006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D75CF1F7FA05E007AB60F</string> + <string>8B792F9521F4993E006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D75D01F7FA05E007AB60F</string> + <string>8B792F9621F4993E006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -658,7 +656,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528457822.27237201</real> + <real>569678142.79066706</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -675,11 +673,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D75D11F7FA05E007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/PyewacketMono/PyewacketMono.xcodeproj</string> </array> <key>WindowString</key> - <string>579 196 841 654 0 0 1440 878 </string> + <string>446 198 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |