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/PurestEcho | |
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/PurestEcho')
4 files changed, 48 insertions, 66 deletions
diff --git a/plugins/MacAU/PurestEcho/PurestEcho.cpp b/plugins/MacAU/PurestEcho/PurestEcho.cpp index 86ef0f6..cfbb9fd 100755 --- a/plugins/MacAU/PurestEcho/PurestEcho.cpp +++ b/plugins/MacAU/PurestEcho/PurestEcho.cpp @@ -197,9 +197,7 @@ void PurestEcho::PurestEchoKernel::Reset() for(int count = 0; count < totalsamples-1; count++) {d[count] = 0;} gcount = 0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -275,11 +273,7 @@ void PurestEcho::PurestEchoKernel::Process( const Float32 *inSourceP, //you zero attenuation at 22 kilohertz: forget this at your peril ;) Float64 delaysBuffer; - - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double inputSample; while (nSampleFrames-- > 0) { @@ -344,19 +338,11 @@ void PurestEcho::PurestEchoKernel::Process( const Float32 *inSourceP, gcount--; - //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/PurestEcho/PurestEcho.h b/plugins/MacAU/PurestEcho/PurestEcho.h index 7ec5461..7ed818b 100755 --- a/plugins/MacAU/PurestEcho/PurestEcho.h +++ b/plugins/MacAU/PurestEcho/PurestEcho.h @@ -140,9 +140,7 @@ public: const static int totalsamples = 65535; Float32 d[totalsamples]; int gcount; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.pbxuser index bd4e607..4a50060 100755 --- a/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.pbxuser @@ -49,13 +49,13 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528457655; - PBXWorkspaceStateSaveDate = 528457655; + PBXPerProjectTemplateStateSaveDate = 569586044; + PBXWorkspaceStateSaveDate = 569586044; }; perUserProjectItems = { 8B18E4181EE3577D005C6C5A /* PlistBookmark */ = 8B18E4181EE3577D005C6C5A /* PlistBookmark */; - 8B9D66831F7C8CE1007AB60F /* PBXTextBookmark */ = 8B9D66831F7C8CE1007AB60F /* PBXTextBookmark */; - 8B9D75A21F7F9FC4007AB60F /* PBXTextBookmark */ = 8B9D75A21F7F9FC4007AB60F /* PBXTextBookmark */; + 8B7926A321F33202006E9731 /* PBXTextBookmark */ = 8B7926A321F33202006E9731 /* PBXTextBookmark */; + 8B7926A821F3322B006E9731 /* PBXTextBookmark */ = 8B7926A821F3322B006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -73,32 +73,32 @@ rLen = 0; rLoc = 9223372036854775808; }; - 8B9D66831F7C8CE1007AB60F /* PBXTextBookmark */ = { + 8B7926A321F33202006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* PurestEcho.cpp */; - name = "PurestEcho.cpp: 325"; + name = "PurestEcho.cpp: 323"; rLen = 0; - rLoc = 15603; + rLoc = 15450; rType = 0; - vrLen = 282; - vrLoc = 13171; + vrLen = 271; + vrLoc = 13178; }; - 8B9D75A21F7F9FC4007AB60F /* PBXTextBookmark */ = { + 8B7926A821F3322B006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* PurestEcho.cpp */; - name = "PurestEcho.cpp: 325"; + name = "PurestEcho.cpp: 319"; rLen = 0; - rLoc = 15603; + rLoc = 15450; rType = 0; - vrLen = 259; - vrLoc = 13194; + vrLen = 494; + vrLoc = 13188; }; 8BA05A660720730100365D66 /* PurestEcho.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {845, 4758}}"; - sepNavSelRange = "{15603, 0}"; - sepNavVisRange = "{13194, 259}"; - sepNavWindowFrame = "{{488, 39}, {952, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 4745}}"; + sepNavSelRange = "{15450, 0}"; + sepNavVisRange = "{13188, 494}"; + sepNavWindowFrame = "{{351, 39}, {952, 839}}"; }; }; 8BA05A690720730100365D66 /* PurestEchoVersion.h */ = { @@ -111,9 +111,9 @@ }; 8BC6025B073B072D006C4272 /* PurestEcho.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {905, 1963}}"; - sepNavSelRange = "{5651, 65}"; - sepNavVisRange = "{4192, 1633}"; + sepNavIntBoundsRect = "{{0, 0}, {905, 1937}}"; + sepNavSelRange = "{5673, 0}"; + sepNavVisRange = "{4087, 1697}"; sepNavWindowFrame = "{{488, 39}, {952, 839}}"; }; }; diff --git a/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.perspectivev3 index 07a9d55..7fbebe1 100755 --- a/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/PurestEcho/PurestEcho.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>810</integer> - <integer>810</integer> + <integer>841</integer> + <integer>841</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> @@ -325,7 +323,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>591 207 841 654 0 0 1440 878 </string> + <string>484 210 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -353,11 +351,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D75A21F7F9FC4007AB60F</string> + <string>8B7926A821F3322B006E9731</string> <key>history</key> <array> <string>8B18E4181EE3577D005C6C5A</string> - <string>8B9D66831F7C8CE1007AB60F</string> + <string>8B7926A321F33202006E9731</string> </array> </dict> <key>SplitCount</key> @@ -371,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 158}}</string> + <string>{{0, 0}, {531, 142}}</string> <key>RubberWindowFrame</key> - <string>591 207 841 654 0 0 1440 878 </string> + <string>484 210 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>158pt</string> + <string>142pt</string> </dict> <dict> <key>Proportion</key> - <string>450pt</string> + <string>466pt</string> <key>Tabs</key> <array> <dict> @@ -396,9 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 423}}</string> - <key>RubberWindowFrame</key> - <string>591 207 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {531, 439}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -452,7 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 31}, {603, 297}}</string> + <string>{{10, 27}, {531, 439}}</string> + <key>RubberWindowFrame</key> + <string>484 210 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -480,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D75A31F7F9FC4007AB60F</string> + <string>8B7926A921F3322B006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D75A41F7F9FC4007AB60F</string> + <string>8B7926AA21F3322B006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D75A51F7F9FC4007AB60F</string> + <string>8B7926AB21F3322B006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -657,7 +655,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528457668.15951699</real> + <real>569586219.97907698</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -674,11 +672,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D75A61F7F9FC4007AB60F</string> + <string>8B7926AC21F3322B006E9731</string> <string>/Users/christopherjohnson/Desktop/MacAU/PurestEcho/PurestEcho.xcodeproj</string> </array> <key>WindowString</key> - <string>591 207 841 654 0 0 1440 878 </string> + <string>484 210 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |