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/Pressure4Mono | |
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/Pressure4Mono')
4 files changed, 64 insertions, 78 deletions
diff --git a/plugins/MacAU/Pressure4Mono/Pressure4Mono.cpp b/plugins/MacAU/Pressure4Mono/Pressure4Mono.cpp index c46cdcb..90991bc 100755 --- a/plugins/MacAU/Pressure4Mono/Pressure4Mono.cpp +++ b/plugins/MacAU/Pressure4Mono/Pressure4Mono.cpp @@ -182,8 +182,7 @@ ComponentResult Pressure4Mono::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void Pressure4Mono::Pressure4MonoKernel::Reset() { - fpNShapeA = 0.0; - fpNShapeB = 0.0; + fpNShape = 0.0; muSpeedA = 10000; muSpeedB = 10000; muCoefficientA = 1; @@ -232,9 +231,6 @@ void Pressure4Mono::Pressure4MonoKernel::Process( const Float32 *inSourceP, unmewiness = 1.0-mewiness; } // µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~ - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; long double inputSample; while (nSampleFrames-- > 0) { @@ -351,20 +347,14 @@ void Pressure4Mono::Pressure4MonoKernel::Process( const Float32 *inSourceP, if (inputSample > 0){inputSample = bridgerectifier;} else {inputSample = -bridgerectifier;} //second stage of overdrive to prevent overs and allow bloody loud extremeness - - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSample; - fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeA; - } - else { - fpTemp = inputSample; - fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew); - inputSample += fpNShapeB; - } flip = !flip; - //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; destP += inNumChannels; } diff --git a/plugins/MacAU/Pressure4Mono/Pressure4Mono.h b/plugins/MacAU/Pressure4Mono/Pressure4Mono.h index e88dbac..6c4b3df 100755 --- a/plugins/MacAU/Pressure4Mono/Pressure4Mono.h +++ b/plugins/MacAU/Pressure4Mono/Pressure4Mono.h @@ -141,8 +141,7 @@ public: Float64 muSpeedB; Float64 muCoefficientA; Float64 muCoefficientB; - Float64 fpNShapeA; - Float64 fpNShapeB; + long double fpNShape; bool flip; }; diff --git a/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.pbxuser index db6a4e5..28eee56 100755 --- a/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 292, + 389, 20, 48, 43, @@ -49,44 +49,54 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 553813081; - PBXWorkspaceStateSaveDate = 553813081; + PBXPerProjectTemplateStateSaveDate = 569677251; + PBXWorkspaceStateSaveDate = 569677251; }; perUserProjectItems = { - 8B2E03F31D837F81001B9E01 /* PBXTextBookmark */ = 8B2E03F31D837F81001B9E01 /* PBXTextBookmark */; - 8B9D75931F7F9FAE007AB60F /* PBXTextBookmark */ = 8B9D75931F7F9FAE007AB60F /* PBXTextBookmark */; - 8BB8B69021028B4200751000 /* PBXTextBookmark */ = 8BB8B69021028B4200751000 /* PBXTextBookmark */; + 8B792F6521F495EA006E9731 /* PBXTextBookmark */ = 8B792F6521F495EA006E9731 /* PBXTextBookmark */; + 8B792F6621F495EA006E9731 /* PBXTextBookmark */ = 8B792F6621F495EA006E9731 /* PBXTextBookmark */; + 8B792F6721F495EA006E9731 /* PBXTextBookmark */ = 8B792F6721F495EA006E9731 /* PBXTextBookmark */; 8BEF332D1D81E168008B0B7F /* PlistBookmark */ = 8BEF332D1D81E168008B0B7F /* PlistBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B2E03F31D837F81001B9E01 /* PBXTextBookmark */ = { + 8B792F6521F495EA006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BC6025B073B072D006C4272 /* Pressure4Mono.h */; - name = "Pressure4Mono.h: 67"; + name = "Pressure4Mono.h: 144"; rLen = 0; - rLoc = 3269; + rLoc = 5594; rType = 0; - vrLen = 563; - vrLoc = 2781; + vrLen = 452; + vrLoc = 5278; }; - 8B9D75931F7F9FAE007AB60F /* PBXTextBookmark */ = { + 8B792F6621F495EA006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Pressure4Mono.cpp */; - name = "Pressure4Mono.cpp: 201"; + name = "Pressure4Mono.cpp: 358"; rLen = 0; - rLoc = 9254; + rLoc = 14617; rType = 0; - vrLen = 662; - vrLoc = 8746; + vrLen = 887; + vrLoc = 13781; + }; + 8B792F6721F495EA006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* Pressure4Mono.cpp */; + name = "Pressure4Mono.cpp: 358"; + rLen = 0; + rLoc = 14617; + rType = 0; + vrLen = 814; + vrLoc = 13855; }; 8BA05A660720730100365D66 /* Pressure4Mono.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {656, 4914}}"; - sepNavSelRange = "{9254, 0}"; - sepNavVisRange = "{8748, 660}"; + sepNavIntBoundsRect = "{{0, 0}, {817, 4940}}"; + sepNavSelRange = "{14617, 0}"; + sepNavVisRange = "{13855, 814}"; sepNavWindowFrame = "{{687, 59}, {895, 819}}"; }; }; @@ -98,21 +108,11 @@ sepNavWindowFrame = "{{528, 59}, {895, 819}}"; }; }; - 8BB8B69021028B4200751000 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* Pressure4Mono.cpp */; - name = "Pressure4Mono.cpp: 201"; - rLen = 0; - rLoc = 9254; - rType = 0; - vrLen = 660; - vrLoc = 8748; - }; 8BC6025B073B072D006C4272 /* Pressure4Mono.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 2002}}"; - sepNavSelRange = "{2979, 0}"; - sepNavVisRange = "{4196, 1545}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2041}}"; + sepNavSelRange = "{5594, 0}"; + sepNavVisRange = "{5278, 452}"; sepNavWindowFrame = "{{545, 52}, {895, 819}}"; }; }; diff --git a/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.perspectivev3 index 8a308b1..72322fc 100755 --- a/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -282,7 +280,7 @@ <dict> <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> <array> - <real>288</real> + <real>191</real> </array> <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> <array> @@ -308,7 +306,7 @@ </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {288, 595}}</string> + <string>{{0, 0}, {191, 595}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -318,19 +316,19 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {305, 613}}</string> + <string>{{0, 0}, {208, 613}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> - <real>288</real> + <real>191</real> </array> <key>RubberWindowFrame</key> - <string>651 172 841 654 0 0 1440 878 </string> + <string>471 181 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> <key>Proportion</key> - <string>305pt</string> + <string>208pt</string> </dict> <dict> <key>Dock</key> @@ -353,12 +351,12 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BB8B69021028B4200751000</string> + <string>8B792F6721F495EA006E9731</string> <key>history</key> <array> <string>8BEF332D1D81E168008B0B7F</string> - <string>8B2E03F31D837F81001B9E01</string> - <string>8B9D75931F7F9FAE007AB60F</string> + <string>8B792F6521F495EA006E9731</string> + <string>8B792F6621F495EA006E9731</string> </array> </dict> <key>SplitCount</key> @@ -372,18 +370,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 173}}</string> + <string>{{0, 0}, {628, 336}}</string> <key>RubberWindowFrame</key> - <string>651 172 841 654 0 0 1440 878 </string> + <string>471 181 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>173pt</string> + <string>336pt</string> </dict> <dict> <key>Proportion</key> - <string>435pt</string> + <string>272pt</string> <key>Tabs</key> <array> <dict> @@ -397,9 +395,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 408}}</string> - <key>RubberWindowFrame</key> - <string>651 172 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {628, 245}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -453,7 +449,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {628, 245}}</string> + <key>RubberWindowFrame</key> + <string>471 181 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -462,7 +460,7 @@ </dict> </array> <key>Proportion</key> - <string>531pt</string> + <string>628pt</string> </dict> </array> <key>Name</key> @@ -481,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BB8B69121028B4200751000</string> + <string>8B792F6821F495EA006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BB8B69221028B4200751000</string> + <string>8B792F6921F495EA006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8BB8B69321028B4200751000</string> + <string>8B792F6A21F495EA006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -658,7 +656,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>553814850.34887004</real> + <real>569677290.01837504</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -675,11 +673,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8BB8B69421028B4200751000</string> <string>/Users/christopherjohnson/Desktop/MacAU/Pressure4Mono/Pressure4Mono.xcodeproj</string> </array> <key>WindowString</key> - <string>651 172 841 654 0 0 1440 878 </string> + <string>471 181 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |