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/Desk4 | |
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/Desk4')
-rwxr-xr-x | plugins/MacAU/Desk4/Desk4.cpp | 26 | ||||
-rwxr-xr-x | plugins/MacAU/Desk4/Desk4.h | 4 | ||||
-rwxr-xr-x | plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.pbxuser | 32 | ||||
-rwxr-xr-x | plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.perspectivev3 | 35 |
4 files changed, 39 insertions, 58 deletions
diff --git a/plugins/MacAU/Desk4/Desk4.cpp b/plugins/MacAU/Desk4/Desk4.cpp index 58dc36f..1fbdca1 100755 --- a/plugins/MacAU/Desk4/Desk4.cpp +++ b/plugins/MacAU/Desk4/Desk4.cpp @@ -204,9 +204,7 @@ void Desk4::Desk4Kernel::Reset() lastSample = 0.0; lastOutSample = 0.0; lastSlew = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -224,9 +222,6 @@ void Desk4::Desk4Kernel::Process( const Float32 *inSourceP, long double overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; Float64 gain = (pow(GetParameter( kParam_One ),2)*10)+0.0001; Float64 gaintrim = (pow(GetParameter( kParam_One ),2)*2)+1.0; @@ -354,20 +349,11 @@ void Desk4::Desk4Kernel::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; diff --git a/plugins/MacAU/Desk4/Desk4.h b/plugins/MacAU/Desk4/Desk4.h index a9cc924..8cd0193 100755 --- a/plugins/MacAU/Desk4/Desk4.h +++ b/plugins/MacAU/Desk4/Desk4.h @@ -146,9 +146,7 @@ public: Float64 lastSample; Float64 lastOutSample; Float64 lastSlew; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.pbxuser index 298344e..6ee8f8f 100755 --- a/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,18 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528455766; - PBXWorkspaceStateSaveDate = 528455766; + PBXPerProjectTemplateStateSaveDate = 569597965; + PBXWorkspaceStateSaveDate = 569597965; }; perUserProjectItems = { - 8B9D64451F7C84BA007AB60F /* PlistBookmark */ = 8B9D64451F7C84BA007AB60F /* PlistBookmark */; - 8B9D73B91F7F9867007AB60F /* PlistBookmark */ = 8B9D73B91F7F9867007AB60F /* PlistBookmark */; + 8B792A9F21F36063006E9731 /* PlistBookmark */ = 8B792A9F21F36063006E9731 /* PlistBookmark */; + 8B792AA421F36073006E9731 /* PlistBookmark */ = 8B792AA421F36073006E9731 /* PlistBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D64451F7C84BA007AB60F /* PlistBookmark */ = { + 8B792A9F21F36063006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -70,9 +70,9 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/Desk4/Info.plist; rLen = 0; - rLoc = 9223372036854775808; + rLoc = 9223372036854775807; }; - 8B9D73B91F7F9867007AB60F /* PlistBookmark */ = { + 8B792AA421F36073006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -81,15 +81,15 @@ CFBundleName, ); name = /Users/christopherjohnson/Desktop/MacAU/Desk4/Info.plist; - rLen = 0; - rLoc = 9223372036854775807; + rLen = 26; + rLoc = 0; }; 8BA05A660720730100365D66 /* Desk4.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {958, 5005}}"; - sepNavSelRange = "{11418, 0}"; - sepNavVisRange = "{11164, 2245}"; - sepNavWindowFrame = "{{435, 39}, {1005, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {958, 5057}}"; + sepNavSelRange = "{14871, 0}"; + sepNavVisRange = "{13633, 1574}"; + sepNavWindowFrame = "{{330, 39}, {1005, 839}}"; }; }; 8BA05A690720730100365D66 /* Desk4Version.h */ = { @@ -103,9 +103,9 @@ 8BC6025B073B072D006C4272 /* Desk4.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {958, 2054}}"; - sepNavSelRange = "{5655, 120}"; - sepNavVisRange = "{1885, 1865}"; - sepNavWindowFrame = "{{725, 39}, {1005, 839}}"; + sepNavSelRange = "{5798, 0}"; + sepNavVisRange = "{4297, 1611}"; + sepNavWindowFrame = "{{435, 39}, {1005, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.perspectivev3 index e8d84b4..b050245 100755 --- a/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Desk4/Desk4.xcodeproj/christopherjohnson.perspectivev3 @@ -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>599 190 841 654 0 0 1440 878 </string> + <string>487 206 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -353,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D73B91F7F9867007AB60F</string> + <string>8B792AA421F36073006E9731</string> <key>history</key> <array> - <string>8B9D64451F7C84BA007AB60F</string> + <string>8B792A9F21F36063006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 188}}</string> + <string>{{0, 0}, {531, 173}}</string> <key>RubberWindowFrame</key> - <string>599 190 841 654 0 0 1440 878 </string> + <string>487 206 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>188pt</string> + <string>173pt</string> </dict> <dict> <key>Proportion</key> - <string>420pt</string> + <string>435pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +393,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 393}}</string> - <key>RubberWindowFrame</key> - <string>599 190 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {531, 408}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {531, 408}}</string> + <key>RubberWindowFrame</key> + <string>487 206 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D73BA1F7F9867007AB60F</string> + <string>8B792AA521F36073006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D73BB1F7F9867007AB60F</string> + <string>8B792AA621F36073006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D73BC1F7F9867007AB60F</string> + <string>8B792AA721F36073006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -656,7 +654,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528455783.26185501</real> + <real>569598067.29641104</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -673,11 +671,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D73BD1F7F9867007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/Desk4/Desk4.xcodeproj</string> </array> <key>WindowString</key> - <string>599 190 841 654 0 0 1440 878 </string> + <string>487 206 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |