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/OneCornerClip | |
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/OneCornerClip')
4 files changed, 41 insertions, 61 deletions
diff --git a/plugins/MacAU/OneCornerClip/OneCornerClip.cpp b/plugins/MacAU/OneCornerClip/OneCornerClip.cpp index db4dcd0..9ddb8db 100755 --- a/plugins/MacAU/OneCornerClip/OneCornerClip.cpp +++ b/plugins/MacAU/OneCornerClip/OneCornerClip.cpp @@ -193,9 +193,7 @@ void OneCornerClip::OneCornerClipKernel::Reset() lastSample = 0.0; limitPos = 0.0; limitNeg = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -213,9 +211,6 @@ void OneCornerClip::OneCornerClipKernel::Process( const Float32 *inSourceP, long double overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; Float64 inputGain = pow(10.0,(GetParameter( kParam_One ))/20.0); Float64 posThreshold = pow(10.0,(GetParameter( kParam_Two ))/20.0); @@ -309,21 +304,11 @@ void OneCornerClip::OneCornerClipKernel::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 = not fpFlip; - //end noise shaping on 32 bit output - //we are making an 80 bit arbitrary curve, woot - //at least we can say it's either 80 bit or pure bypass + //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 if (clipEngage == false) { diff --git a/plugins/MacAU/OneCornerClip/OneCornerClip.h b/plugins/MacAU/OneCornerClip/OneCornerClip.h index 0931824..013fc94 100755 --- a/plugins/MacAU/OneCornerClip/OneCornerClip.h +++ b/plugins/MacAU/OneCornerClip/OneCornerClip.h @@ -140,9 +140,7 @@ public: Float64 lastSample; Float64 limitPos; Float64 limitNeg; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.pbxuser index 13fb85a..872b672 100755 --- a/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.pbxuser @@ -49,59 +49,59 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 541882937; - PBXWorkspaceStateSaveDate = 541882937; + PBXPerProjectTemplateStateSaveDate = 569651957; + PBXWorkspaceStateSaveDate = 569651957; }; perUserProjectItems = { - 8B181972204B914C00516BEE /* PBXTextBookmark */ = 8B181972204B914C00516BEE /* PBXTextBookmark */; - 8B181A47204C83CC00516BEE /* PBXTextBookmark */ = 8B181A47204C83CC00516BEE /* PBXTextBookmark */; + 8B792E6F21F43380006E9731 /* PBXTextBookmark */ = 8B792E6F21F43380006E9731 /* PBXTextBookmark */; + 8B792E7421F43391006E9731 /* PBXTextBookmark */ = 8B792E7421F43391006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B181972204B914C00516BEE /* PBXTextBookmark */ = { + 8B792E6F21F43380006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* OneCornerClipVersion.h */; name = "OneCornerClipVersion.h: 1"; rLen = 0; rLoc = 0; rType = 0; - vrLen = 240; + vrLen = 187; vrLoc = 2736; }; - 8B181A47204C83CC00516BEE /* PBXTextBookmark */ = { + 8B792E7421F43391006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A690720730100365D66 /* OneCornerClipVersion.h */; name = "OneCornerClipVersion.h: 1"; rLen = 0; rLoc = 0; rType = 0; - vrLen = 239; + vrLen = 187; vrLoc = 2736; }; 8BA05A660720730100365D66 /* OneCornerClip.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {885, 4251}}"; - sepNavSelRange = "{13850, 0}"; - sepNavVisRange = "{9777, 2480}"; - sepNavWindowFrame = "{{488, 63}, {932, 815}}"; + sepNavIntBoundsRect = "{{0, 0}, {885, 4667}}"; + sepNavSelRange = "{13380, 0}"; + sepNavVisRange = "{12469, 1116}"; + sepNavWindowFrame = "{{356, 63}, {932, 815}}"; }; }; 8BA05A690720730100365D66 /* OneCornerClipVersion.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {803, 949}}"; + sepNavIntBoundsRect = "{{0, 0}, {803, 936}}"; sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{2736, 239}"; + sepNavVisRange = "{2736, 187}"; sepNavWindowFrame = "{{15, 58}, {932, 815}}"; }; }; 8BC6025B073B072D006C4272 /* OneCornerClip.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {894, 1976}}"; - sepNavSelRange = "{5638, 62}"; - sepNavVisRange = "{0, 2780}"; - sepNavWindowFrame = "{{837, 56}, {932, 815}}"; + sepNavSelRange = "{5723, 0}"; + sepNavVisRange = "{4252, 1581}"; + sepNavWindowFrame = "{{508, 56}, {932, 815}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.perspectivev3 index 84e772a..73a7a50 100755 --- a/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/OneCornerClip/OneCornerClip.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -300,7 +298,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>4</integer> + <integer>3</integer> <integer>2</integer> <integer>1</integer> <integer>0</integer> @@ -324,7 +322,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>630 365 810 487 0 0 1440 878 </string> + <string>428 370 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,10 +350,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B181A47204C83CC00516BEE</string> + <string>8B792E7421F43391006E9731</string> <key>history</key> <array> - <string>8B181972204B914C00516BEE</string> + <string>8B792E6F21F43380006E9731</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +367,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 117}}</string> + <string>{{0, 0}, {603, 102}}</string> <key>RubberWindowFrame</key> - <string>630 365 810 487 0 0 1440 878 </string> + <string>428 370 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>117pt</string> + <string>102pt</string> </dict> <dict> <key>Proportion</key> - <string>324pt</string> + <string>339pt</string> <key>Tabs</key> <array> <dict> @@ -394,9 +392,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 297}}</string> - <key>RubberWindowFrame</key> - <string>630 365 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 312}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -450,7 +446,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 312}}</string> + <key>RubberWindowFrame</key> + <string>428 370 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -478,11 +476,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B181A48204C83CC00516BEE</string> + <string>8B792E7521F43391006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B181A49204C83CC00516BEE</string> + <string>8B792E7621F43391006E9731</string> <string>8BCA0F591D871CB100A4EFAF</string> - <string>8B181A4A204C83CC00516BEE</string> + <string>8B792E7721F43391006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +633,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>541885388.89707994</real> + <real>569652113.25814903</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,11 +650,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B181A4B204C83CC00516BEE</string> <string>/Users/christopherjohnson/Desktop/MacAU/OneCornerClip/OneCornerClip.xcodeproj</string> </array> <key>WindowString</key> - <string>630 365 810 487 0 0 1440 878 </string> + <string>428 370 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |