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/ToneSlant | |
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/ToneSlant')
4 files changed, 62 insertions, 81 deletions
diff --git a/plugins/MacAU/ToneSlant/ToneSlant.cpp b/plugins/MacAU/ToneSlant/ToneSlant.cpp index 9b78bea..55f7435 100755 --- a/plugins/MacAU/ToneSlant/ToneSlant.cpp +++ b/plugins/MacAU/ToneSlant/ToneSlant.cpp @@ -168,9 +168,7 @@ ComponentResult ToneSlant::Initialize() void ToneSlant::ToneSlantKernel::Reset() { for(int count = 0; count < 102; count++) {b[count] = 0.0; f[count] = 0.0;} - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -192,9 +190,6 @@ void ToneSlant::ToneSlantKernel::Process( const Float32 *inSourceP, Float64 overallscale = GetParameter( kParam_One ); if (overallscale < 1.0) overallscale = 1.0; Float64 applySlant = GetParameter( kParam_Two ); - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; f[0] = 1.0 / overallscale; //count to f(gain) which will be 0. f(0) is x1 @@ -236,7 +231,6 @@ void ToneSlant::ToneSlantKernel::Process( const Float32 *inSourceP, //the silence will return to being digital black again. } - b[0] = accumulatorSample = drySample = inputSample; accumulatorSample *= f[0]; @@ -248,19 +242,11 @@ void ToneSlant::ToneSlantKernel::Process( const Float32 *inSourceP, inputSample += (correctionSample * applySlant); //our one math operation on the input data coming in - //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/ToneSlant/ToneSlant.h b/plugins/MacAU/ToneSlant/ToneSlant.h index f07890b..8f94128 100755 --- a/plugins/MacAU/ToneSlant/ToneSlant.h +++ b/plugins/MacAU/ToneSlant/ToneSlant.h @@ -131,9 +131,7 @@ public: private: Float64 b[102]; Float64 f[102]; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.pbxuser index bd0d093..e300ab9 100755 --- a/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 292, + 388, 20, 48, 43, @@ -49,15 +49,15 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528458576; - PBXWorkspaceStateSaveDate = 528458576; + PBXPerProjectTemplateStateSaveDate = 569684848; + PBXWorkspaceStateSaveDate = 569684848; }; perUserProjectItems = { 8B22B0A31DB17F9F0075D7AA /* PBXTextBookmark */ = 8B22B0A31DB17F9F0075D7AA /* PBXTextBookmark */; - 8B42FB2B1DB15DB60057B6AB /* PBXTextBookmark */ = 8B42FB2B1DB15DB60057B6AB /* PBXTextBookmark */; 8B51D7811DAF1671009F3CF8 /* PlistBookmark */ = 8B51D7811DAF1671009F3CF8 /* PlistBookmark */; - 8B9D67DF1F7C911F007AB60F /* PBXTextBookmark */ = 8B9D67DF1F7C911F007AB60F /* PBXTextBookmark */; - 8B9D76C01F7FA369007AB60F /* PBXTextBookmark */ = 8B9D76C01F7FA369007AB60F /* PBXTextBookmark */; + 8B79319221F4B409006E9731 /* PBXTextBookmark */ = 8B79319221F4B409006E9731 /* PBXTextBookmark */; + 8B79319421F4B409006E9731 /* PBXTextBookmark */ = 8B79319421F4B409006E9731 /* PBXTextBookmark */; + 8B79319921F4B43F006E9731 /* PBXTextBookmark */ = 8B79319921F4B43F006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -73,16 +73,6 @@ vrLen = 356; vrLoc = 2601; }; - 8B42FB2B1DB15DB60057B6AB /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BC6025B073B072D006C4272 /* ToneSlant.h */; - name = "ToneSlant.h: 57"; - rLen = 0; - rLoc = 2865; - rType = 0; - vrLen = 410; - vrLoc = 2675; - }; 8B51D7811DAF1671009F3CF8 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; @@ -95,31 +85,41 @@ rLen = 0; rLoc = 9223372036854775808; }; - 8B9D67DF1F7C911F007AB60F /* PBXTextBookmark */ = { + 8B79319221F4B409006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BC6025B073B072D006C4272 /* ToneSlant.h */; + name = "ToneSlant.h: 134"; + rLen = 0; + rLoc = 5306; + rType = 0; + vrLen = 794; + vrLoc = 4622; + }; + 8B79319421F4B409006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* ToneSlant.cpp */; - name = "ToneSlant.cpp: 195"; + name = "ToneSlant.cpp: 250"; rLen = 0; - rLoc = 8729; + rLoc = 11254; rType = 0; - vrLen = 457; - vrLoc = 8458; + vrLen = 1286; + vrLoc = 10056; }; - 8B9D76C01F7FA369007AB60F /* PBXTextBookmark */ = { + 8B79319921F4B43F006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* ToneSlant.cpp */; - name = "ToneSlant.cpp: 195"; + name = "ToneSlant.cpp: 250"; rLen = 0; - rLoc = 8729; + rLoc = 11254; rType = 0; - vrLen = 418; - vrLoc = 8421; + vrLen = 1320; + vrLoc = 10022; }; 8BA05A660720730100365D66 /* ToneSlant.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {656, 3549}}"; - sepNavSelRange = "{8729, 0}"; - sepNavVisRange = "{8421, 418}"; + sepNavIntBoundsRect = "{{0, 0}, {726, 3471}}"; + sepNavSelRange = "{11254, 0}"; + sepNavVisRange = "{10022, 1320}"; sepNavWindowFrame = "{{537, 59}, {895, 819}}"; }; }; @@ -133,9 +133,9 @@ }; 8BC6025B073B072D006C4272 /* ToneSlant.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1859}}"; - sepNavSelRange = "{5283, 65}"; - sepNavVisRange = "{3870, 1587}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2145}}"; + sepNavSelRange = "{5306, 0}"; + sepNavVisRange = "{4622, 794}"; sepNavWindowFrame = "{{15, 54}, {895, 819}}"; }; }; diff --git a/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.perspectivev3 index d236663..4b2a46a 100755 --- a/plugins/MacAU/ToneSlant/ToneSlant.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/ToneSlant/ToneSlant.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>192</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}, {192, 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}, {209, 613}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> - <real>288</real> + <real>192</real> </array> <key>RubberWindowFrame</key> - <string>591 215 841 654 0 0 1440 878 </string> + <string>448 210 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> <key>Proportion</key> - <string>305pt</string> + <string>209pt</string> </dict> <dict> <key>Dock</key> @@ -353,13 +351,13 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D76C01F7FA369007AB60F</string> + <string>8B79319921F4B43F006E9731</string> <key>history</key> <array> <string>8B51D7811DAF1671009F3CF8</string> - <string>8B42FB2B1DB15DB60057B6AB</string> <string>8B22B0A31DB17F9F0075D7AA</string> - <string>8B9D67DF1F7C911F007AB60F</string> + <string>8B79319221F4B409006E9731</string> + <string>8B79319421F4B409006E9731</string> </array> </dict> <key>SplitCount</key> @@ -373,18 +371,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 188}}</string> + <string>{{0, 0}, {627, 466}}</string> <key>RubberWindowFrame</key> - <string>591 215 841 654 0 0 1440 878 </string> + <string>448 210 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>188pt</string> + <string>466pt</string> </dict> <dict> <key>Proportion</key> - <string>420pt</string> + <string>142pt</string> <key>Tabs</key> <array> <dict> @@ -398,9 +396,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 393}}</string> - <key>RubberWindowFrame</key> - <string>591 215 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {627, 115}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -454,7 +450,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {627, 115}}</string> + <key>RubberWindowFrame</key> + <string>448 210 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -463,7 +461,7 @@ </dict> </array> <key>Proportion</key> - <string>531pt</string> + <string>627pt</string> </dict> </array> <key>Name</key> @@ -482,11 +480,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D76C11F7FA369007AB60F</string> + <string>8B79319A21F4B43F006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D76C21F7FA369007AB60F</string> + <string>8B79319B21F4B43F006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D76C31F7FA369007AB60F</string> + <string>8B79319C21F4B43F006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -659,7 +657,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528458601.15789098</real> + <real>569685055.02673697</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -676,11 +674,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D76C41F7FA369007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/ToneSlant/ToneSlant.xcodeproj</string> </array> <key>WindowString</key> - <string>591 215 841 654 0 0 1440 878 </string> + <string>448 210 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |