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/DeRez | |
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/DeRez')
-rwxr-xr-x | plugins/MacAU/DeRez/DeRez.cpp | 26 | ||||
-rwxr-xr-x | plugins/MacAU/DeRez/DeRez.h | 4 | ||||
-rwxr-xr-x | plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser | 62 | ||||
-rwxr-xr-x | plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3 | 35 |
4 files changed, 55 insertions, 72 deletions
diff --git a/plugins/MacAU/DeRez/DeRez.cpp b/plugins/MacAU/DeRez/DeRez.cpp index 4bc3ee4..e2f3829 100755 --- a/plugins/MacAU/DeRez/DeRez.cpp +++ b/plugins/MacAU/DeRez/DeRez.cpp @@ -171,9 +171,7 @@ void DeRez::DeRezKernel::Reset() position = 0.0; incrementA = 0.0; incrementB = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -200,10 +198,7 @@ void DeRez::DeRezKernel::Process( const Float32 *inSourceP, Float64 overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - targetA /= overallscale; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + targetA /= overallscale; while (nSampleFrames-- > 0) { long double inputSample = *sourceP; @@ -265,18 +260,11 @@ void DeRez::DeRezKernel::Process( const Float32 *inSourceP, inputSample *= (1.0 - incrementB); } - //noise shaping to 32-bit floating point - Float32 fpTemp = inputSample; - if (fpFlip) { - fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeA; - } - else { - 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; lastSample = drySample; diff --git a/plugins/MacAU/DeRez/DeRez.h b/plugins/MacAU/DeRez/DeRez.h index 55cc562..e592bcb 100755 --- a/plugins/MacAU/DeRez/DeRez.h +++ b/plugins/MacAU/DeRez/DeRez.h @@ -133,9 +133,7 @@ public: Float64 position; Float64 incrementA; Float64 incrementB; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser index 78a1751..359639f 100755 --- a/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,38 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 553899071; - PBXWorkspaceStateSaveDate = 553899071; + PBXPerProjectTemplateStateSaveDate = 569597675; + PBXWorkspaceStateSaveDate = 569597675; }; perUserProjectItems = { + 8B792A7321F35F66006E9731 /* PBXTextBookmark */ = 8B792A7321F35F66006E9731 /* PBXTextBookmark */; + 8B792A7821F35F77006E9731 /* PBXTextBookmark */ = 8B792A7821F35F77006E9731 /* PBXTextBookmark */; 8B7E3E4320A68C5B00482CB5 /* PBXTextBookmark */ = 8B7E3E4320A68C5B00482CB5 /* PBXTextBookmark */; - 8B9754332103D44500A4FFA3 /* PBXTextBookmark */ = 8B9754332103D44500A4FFA3 /* PBXTextBookmark */; - 8BB8B6DD21039A3300751000 /* PBXTextBookmark */ = 8BB8B6DD21039A3300751000 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; + 8B792A7321F35F66006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* DeRez.cpp */; + name = "DeRez.cpp: 199"; + rLen = 0; + rLoc = 8817; + rType = 0; + vrLen = 87; + vrLoc = 8817; + }; + 8B792A7821F35F77006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* DeRez.cpp */; + name = "DeRez.cpp: 199"; + rLen = 0; + rLoc = 8817; + rType = 0; + vrLen = 87; + vrLoc = 8817; + }; 8B7E3E4320A68C5B00482CB5 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* DeRezVersion.h */; @@ -71,22 +91,12 @@ vrLen = 166; vrLoc = 3288; }; - 8B9754332103D44500A4FFA3 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* DeRez.cpp */; - name = "DeRez.cpp: 201"; - rLen = 0; - rLoc = 8852; - rType = 0; - vrLen = 177; - vrLoc = 8761; - }; 8BA05A660720730100365D66 /* DeRez.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 3861}}"; - sepNavSelRange = "{8852, 0}"; - sepNavVisRange = "{8761, 177}"; - sepNavWindowFrame = "{{433, 59}, {1007, 819}}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 3783}}"; + sepNavSelRange = "{8817, 0}"; + sepNavVisRange = "{8817, 87}"; + sepNavWindowFrame = "{{303, 48}, {1007, 819}}"; }; }; 8BA05A670720730100365D66 /* DeRez.exp */ = { @@ -104,21 +114,11 @@ sepNavVisRange = "{3288, 166}"; }; }; - 8BB8B6DD21039A3300751000 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* DeRez.cpp */; - name = "DeRez.cpp: 201"; - rLen = 0; - rLoc = 8852; - rType = 0; - vrLen = 277; - vrLoc = 8761; - }; 8BC6025B073B072D006C4272 /* DeRez.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1062, 1677}}"; - sepNavSelRange = "{3000, 0}"; - sepNavVisRange = "{1247, 2041}"; + sepNavIntBoundsRect = "{{0, 0}, {1062, 1807}}"; + sepNavSelRange = "{5245, 0}"; + sepNavVisRange = "{3769, 1578}"; sepNavWindowFrame = "{{433, 48}, {1007, 819}}"; }; }; diff --git a/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3 index 78a77d9..a77fdf8 100755 --- a/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -324,7 +322,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>614 318 810 487 0 0 1440 878 </string> + <string>516 329 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,11 +350,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9754332103D44500A4FFA3</string> + <string>8B792A7821F35F77006E9731</string> <key>history</key> <array> <string>8B7E3E4320A68C5B00482CB5</string> - <string>8BB8B6DD21039A3300751000</string> + <string>8B792A7321F35F66006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 86}}</string> + <string>{{0, 0}, {603, 69}}</string> <key>RubberWindowFrame</key> - <string>614 318 810 487 0 0 1440 878 </string> + <string>516 329 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>86pt</string> + <string>69pt</string> </dict> <dict> <key>Proportion</key> - <string>355pt</string> + <string>372pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +393,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 328}}</string> - <key>RubberWindowFrame</key> - <string>614 318 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 345}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 312}}</string> + <string>{{10, 27}, {603, 345}}</string> + <key>RubberWindowFrame</key> + <string>516 329 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9754342103D44500A4FFA3</string> + <string>8B792A7921F35F77006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9754352103D44500A4FFA3</string> + <string>8B792A7A21F35F77006E9731</string> <string>8B8D69E4207ABD0F0029B7B0</string> - <string>8B9754362103D44500A4FFA3</string> + <string>8B792A7B21F35F77006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>553899077.362046</real> + <real>569597815.38705599</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,11 +651,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9754372103D44500A4FFA3</string> <string>/Users/christopherjohnson/Desktop/MacAU/DeRez/DeRez.xcodeproj</string> </array> <key>WindowString</key> - <string>614 318 810 487 0 0 1440 878 </string> + <string>516 329 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |