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/ElectroHat | |
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/ElectroHat')
4 files changed, 50 insertions, 67 deletions
diff --git a/plugins/MacAU/ElectroHat/ElectroHat.cpp b/plugins/MacAU/ElectroHat/ElectroHat.cpp index 6fd2b29..cfdf411 100755 --- a/plugins/MacAU/ElectroHat/ElectroHat.cpp +++ b/plugins/MacAU/ElectroHat/ElectroHat.cpp @@ -214,9 +214,7 @@ void ElectroHat::ElectroHatKernel::Reset() tik = 3746926; lok = 0; flip = true; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -270,9 +268,6 @@ void ElectroHat::ElectroHatKernel::Process( const Float32 *inSourceP, int posE = fosE; int posF = fosF; int posG = posF*posE*posD*posC*posB; //factorial - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; while (nSampleFrames-- > 0) { @@ -317,19 +312,11 @@ void ElectroHat::ElectroHatKernel::Process( const Float32 *inSourceP, 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; //moving average combats that near-Nyquist stuff diff --git a/plugins/MacAU/ElectroHat/ElectroHat.h b/plugins/MacAU/ElectroHat/ElectroHat.h index 7592a4c..6d3525e 100755 --- a/plugins/MacAU/ElectroHat/ElectroHat.h +++ b/plugins/MacAU/ElectroHat/ElectroHat.h @@ -156,9 +156,7 @@ public: int tik; int lok; bool flip; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; + Float64 fpNShape; }; }; diff --git a/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.pbxuser index 9605e3d..6e8da0d 100755 --- a/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 541288564; - PBXWorkspaceStateSaveDate = 541288564; + PBXPerProjectTemplateStateSaveDate = 569602542; + PBXWorkspaceStateSaveDate = 569602542; }; perUserProjectItems = { - 8BC009F220436BB300304BC7 /* PBXTextBookmark */ = 8BC009F220436BB300304BC7 /* PBXTextBookmark */; - 8BC009F320436BB300304BC7 /* PBXTextBookmark */ = 8BC009F320436BB300304BC7 /* PBXTextBookmark */; + 8B792BB621F37247006E9731 /* PBXTextBookmark */ = 8B792BB621F37247006E9731 /* PBXTextBookmark */; + 8B792BBB21F37261006E9731 /* PBXTextBookmark */ = 8B792BBB21F37261006E9731 /* PBXTextBookmark */; 8BCEFB832042DD54002E8187 /* PBXTextBookmark */ = 8BCEFB832042DD54002E8187 /* PBXTextBookmark */; 8BCEFBA32043656D002E8187 /* PBXTextBookmark */ = 8BCEFBA32043656D002E8187 /* PBXTextBookmark */; }; @@ -62,11 +62,31 @@ userBuildSettings = { }; }; + 8B792BB621F37247006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* ElectroHat.cpp */; + name = "ElectroHat.cpp: 303"; + rLen = 31; + rLoc = 12605; + rType = 0; + vrLen = 524; + vrLoc = 12283; + }; + 8B792BBB21F37261006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* ElectroHat.cpp */; + name = "ElectroHat.cpp: 303"; + rLen = 31; + rLoc = 12605; + rType = 0; + vrLen = 226; + vrLoc = 12283; + }; 8BA05A660720730100365D66 /* ElectroHat.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {712, 4667}}"; - sepNavSelRange = "{12748, 31}"; - sepNavVisRange = "{12105, 736}"; + sepNavIntBoundsRect = "{{0, 0}, {712, 4472}}"; + sepNavSelRange = "{12605, 31}"; + sepNavVisRange = "{12283, 226}"; sepNavWindowFrame = "{{252, 40}, {997, 838}}"; }; }; @@ -78,31 +98,11 @@ sepNavWindowFrame = "{{15, 40}, {909, 838}}"; }; }; - 8BC009F220436BB300304BC7 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* ElectroHat.cpp */; - name = "ElectroHat.cpp: 145"; - rLen = 0; - rLoc = 6799; - rType = 0; - vrLen = 926; - vrLoc = 9949; - }; - 8BC009F320436BB300304BC7 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* ElectroHat.cpp */; - name = "ElectroHat.cpp: 308"; - rLen = 31; - rLoc = 12748; - rType = 0; - vrLen = 736; - vrLoc = 12105; - }; 8BC6025B073B072D006C4272 /* ElectroHat.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {824, 2002}}"; - sepNavSelRange = "{3208, 0}"; - sepNavVisRange = "{2134, 1985}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2301}}"; + sepNavSelRange = "{6281, 0}"; + sepNavVisRange = "{4808, 1583}"; sepNavWindowFrame = "{{630, 50}, {810, 826}}"; }; }; diff --git a/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.perspectivev3 index f67a203..2f7bc15 100755 --- a/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/ElectroHat/ElectroHat.xcodeproj/christopherjohnson.perspectivev3 @@ -333,8 +333,6 @@ <key>Dock</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> @@ -352,12 +350,12 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BC009F320436BB300304BC7</string> + <string>8B792BBB21F37261006E9731</string> <key>history</key> <array> <string>8BCEFB832042DD54002E8187</string> <string>8BCEFBA32043656D002E8187</string> - <string>8BC009F220436BB300304BC7</string> + <string>8B792BB621F37247006E9731</string> </array> </dict> <key>SplitCount</key> @@ -371,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 306}}</string> + <string>{{0, 0}, {603, 94}}</string> <key>RubberWindowFrame</key> <string>442 380 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>306pt</string> + <string>94pt</string> </dict> <dict> <key>Proportion</key> - <string>135pt</string> + <string>347pt</string> <key>Tabs</key> <array> <dict> @@ -396,9 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 108}}</string> - <key>RubberWindowFrame</key> - <string>442 380 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 114}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -452,7 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 320}}</string> + <key>RubberWindowFrame</key> + <string>442 380 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -480,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BC009F420436BB300304BC7</string> + <string>8B792BBC21F37261006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BC009F520436BB300304BC7</string> + <string>8B792BBD21F37261006E9731</string> <string>8BCA6F152027DB6B00D92BAD</string> - <string>8BC009F620436BB300304BC7</string> + <string>8B792BBE21F37261006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -637,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>541289395.77599096</real> + <real>569602657.83772898</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> |