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/HardVacuum | |
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/HardVacuum')
4 files changed, 39 insertions, 54 deletions
diff --git a/plugins/MacAU/HardVacuum/HardVacuum.cpp b/plugins/MacAU/HardVacuum/HardVacuum.cpp index 15bb5ec..d652431 100755 --- a/plugins/MacAU/HardVacuum/HardVacuum.cpp +++ b/plugins/MacAU/HardVacuum/HardVacuum.cpp @@ -191,9 +191,7 @@ ComponentResult HardVacuum::Initialize() void HardVacuum::HardVacuumKernel::Reset() { lastSample = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -226,9 +224,6 @@ void HardVacuum::HardVacuumKernel::Process( const Float32 *inSourceP, Float64 skew; long double inputSample; Float64 drySample; - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; while (nSampleFrames-- > 0) { inputSample = *sourceP; @@ -319,19 +314,11 @@ void HardVacuum::HardVacuumKernel::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/HardVacuum/HardVacuum.h b/plugins/MacAU/HardVacuum/HardVacuum.h index ad9518d..b5b4116 100755 --- a/plugins/MacAU/HardVacuum/HardVacuum.h +++ b/plugins/MacAU/HardVacuum/HardVacuum.h @@ -139,9 +139,7 @@ public: private: Float64 lastSample; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.pbxuser index a26a4bf..35ae242 100755 --- a/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.pbxuser @@ -49,43 +49,43 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 541823423; - PBXWorkspaceStateSaveDate = 541823423; + PBXPerProjectTemplateStateSaveDate = 569648475; + PBXWorkspaceStateSaveDate = 569648475; }; perUserProjectItems = { - 8B1819FB204B936300516BEE /* PBXTextBookmark */ = 8B1819FB204B936300516BEE /* PBXTextBookmark */; - 8B181A0D204B961F00516BEE /* PBXTextBookmark */ = 8B181A0D204B961F00516BEE /* PBXTextBookmark */; + 8B792CEB21F425BC006E9731 /* PBXTextBookmark */ = 8B792CEB21F425BC006E9731 /* PBXTextBookmark */; + 8B792CF121F425DC006E9731 /* PBXTextBookmark */ = 8B792CF121F425DC006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B1819FB204B936300516BEE /* PBXTextBookmark */ = { + 8B792CEB21F425BC006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BC6025B073B072D006C4272 /* HardVacuum.h */; name = "HardVacuum.h: 61"; rLen = 0; rLoc = 3064; rType = 0; - vrLen = 334; + vrLen = 296; vrLoc = 4037; }; - 8B181A0D204B961F00516BEE /* PBXTextBookmark */ = { + 8B792CF121F425DC006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BC6025B073B072D006C4272 /* HardVacuum.h */; name = "HardVacuum.h: 61"; rLen = 0; rLoc = 3064; rType = 0; - vrLen = 334; + vrLen = 296; vrLoc = 4037; }; 8BA05A660720730100365D66 /* HardVacuum.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1098, 4758}}"; - sepNavSelRange = "{13965, 0}"; - sepNavVisRange = "{12718, 1710}"; - sepNavWindowFrame = "{{639, 60}, {1145, 812}}"; + sepNavIntBoundsRect = "{{0, 0}, {1098, 4303}}"; + sepNavSelRange = "{10378, 0}"; + sepNavVisRange = "{9068, 2247}"; + sepNavWindowFrame = "{{157, 66}, {1145, 812}}"; }; }; 8BA05A670720730100365D66 /* HardVacuum.exp */ = { @@ -106,10 +106,10 @@ }; 8BC6025B073B072D006C4272 /* HardVacuum.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {803, 2288}}"; + sepNavIntBoundsRect = "{{0, 0}, {698, 1989}}"; sepNavSelRange = "{3064, 0}"; - sepNavVisRange = "{4037, 334}"; - sepNavWindowFrame = "{{798, 44}, {816, 832}}"; + sepNavVisRange = "{4037, 296}"; + sepNavWindowFrame = "{{624, 44}, {816, 832}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.perspectivev3 index ee4a326..447f391 100755 --- a/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/HardVacuum/HardVacuum.xcodeproj/christopherjohnson.perspectivev3 @@ -300,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>5</integer> + <integer>4</integer> <integer>2</integer> <integer>1</integer> <integer>0</integer> @@ -324,7 +324,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>627 370 810 487 0 0 1440 878 </string> + <string>501 353 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,10 +352,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B181A0D204B961F00516BEE</string> + <string>8B792CF121F425DC006E9731</string> <key>history</key> <array> - <string>8B1819FB204B936300516BEE</string> + <string>8B792CEB21F425BC006E9731</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 132}}</string> + <string>{{0, 0}, {603, 117}}</string> <key>RubberWindowFrame</key> - <string>627 370 810 487 0 0 1440 878 </string> + <string>501 353 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>132pt</string> + <string>117pt</string> </dict> <dict> <key>Proportion</key> - <string>309pt</string> + <string>324pt</string> <key>Tabs</key> <array> <dict> @@ -394,7 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 282}}</string> + <string>{{10, 27}, {603, 297}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -448,9 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 282}}</string> + <string>{{10, 27}, {603, 297}}</string> <key>RubberWindowFrame</key> - <string>627 370 810 487 0 0 1440 878 </string> + <string>501 353 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -478,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B181A0E204B961F00516BEE</string> + <string>8B792CF221F425DC006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B181A0F204B961F00516BEE</string> + <string>8B792CF321F425DC006E9731</string> <string>8BCA6FBD2027E68400D92BAD</string> - <string>8B181A10204B961F00516BEE</string> + <string>8B792CF421F425DC006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>541824543.72034597</real> + <real>569648604.79217398</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,11 +652,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B181A11204B961F00516BEE</string> + <string>8B792CF521F425DC006E9731</string> <string>/Users/christopherjohnson/Desktop/MacAU/HardVacuum/HardVacuum.xcodeproj</string> </array> <key>WindowString</key> - <string>627 370 810 487 0 0 1440 878 </string> + <string>501 353 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |