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/Console5DarkCh | |
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/Console5DarkCh')
4 files changed, 38 insertions, 57 deletions
diff --git a/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp b/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp index 2ad03c3..4b1cefd 100755 --- a/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp +++ b/plugins/MacAU/Console5DarkCh/Console5DarkCh.cpp @@ -165,9 +165,7 @@ void Console5DarkCh::Console5DarkChKernel::Reset() settingchase = -90.0; chasespeed = 350.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -184,11 +182,7 @@ void Console5DarkCh::Console5DarkChKernel::Process( const Float32 *inSourceP, Float32 *destP = inDestP; 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; - + overallscale *= GetSampleRate(); Float64 inputgain = GetParameter( kParam_One ); Float64 difference; Float64 nearZero; @@ -279,19 +273,11 @@ void Console5DarkCh::Console5DarkChKernel::Process( const Float32 *inSourceP, inputSample = sin(inputSample); //amplitude aspect - //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/Console5DarkCh/Console5DarkCh.h b/plugins/MacAU/Console5DarkCh/Console5DarkCh.h index 8bb2126..157ad9b 100755 --- a/plugins/MacAU/Console5DarkCh/Console5DarkCh.h +++ b/plugins/MacAU/Console5DarkCh/Console5DarkCh.h @@ -131,9 +131,7 @@ public: Float64 settingchase; Float64 chasespeed; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.pbxuser index 4adcf1e..0562b0f 100755 --- a/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,18 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 537050873; - PBXWorkspaceStateSaveDate = 537050873; + PBXPerProjectTemplateStateSaveDate = 569594878; + PBXWorkspaceStateSaveDate = 569594878; }; perUserProjectItems = { - 8B4D27592002BF690051360A /* PlistBookmark */ = 8B4D27592002BF690051360A /* PlistBookmark */; - 8B95A7E020006AC9007183A2 /* PlistBookmark */ = 8B95A7E020006AC9007183A2 /* PlistBookmark */; + 8B7929CF21F3543F006E9731 /* PlistBookmark */ = 8B7929CF21F3543F006E9731 /* PlistBookmark */; + 8B7929D421F35450006E9731 /* PlistBookmark */ = 8B7929D421F35450006E9731 /* PlistBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B4D27592002BF690051360A /* PlistBookmark */ = { + 8B7929CF21F3543F006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -72,7 +72,7 @@ rLen = 0; rLoc = 9223372036854775807; }; - 8B95A7E020006AC9007183A2 /* PlistBookmark */ = { + 8B7929D421F35450006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -80,15 +80,15 @@ kPath = ( CFBundleName, ); - name = /Users/christopherjohnson/Desktop/Console5DarkCh/Info.plist; + name = /Users/christopherjohnson/Desktop/MacAU/Console5DarkCh/Info.plist; rLen = 26; rLoc = 0; }; 8BA05A660720730100365D66 /* Console5DarkCh.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 4160}}"; - sepNavSelRange = "{10956, 0}"; - sepNavVisRange = "{10771, 1848}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 3991}}"; + sepNavSelRange = "{12259, 0}"; + sepNavVisRange = "{10314, 2033}"; sepNavWindowFrame = "{{29, 39}, {895, 839}}"; }; }; @@ -102,10 +102,10 @@ }; 8BC6025B073B072D006C4272 /* Console5DarkCh.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1846}}"; - sepNavSelRange = "{5389, 0}"; - sepNavVisRange = "{3832, 1557}"; - sepNavWindowFrame = "{{579, 39}, {895, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 1833}}"; + sepNavSelRange = "{5240, 0}"; + sepNavVisRange = "{3753, 1595}"; + sepNavWindowFrame = "{{329, 39}, {895, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.perspectivev3 index 91ebb9c..8b9ecd1 100755 --- a/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -326,7 +324,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>20 224 841 654 0 0 1440 878 </string> + <string>55 218 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -354,10 +352,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B4D27592002BF690051360A</string> + <string>8B7929D421F35450006E9731</string> <key>history</key> <array> - <string>8B95A7E020006AC9007183A2</string> + <string>8B7929CF21F3543F006E9731</string> </array> </dict> <key>SplitCount</key> @@ -371,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 229}}</string> + <string>{{0, 0}, {531, 216}}</string> <key>RubberWindowFrame</key> - <string>20 224 841 654 0 0 1440 878 </string> + <string>55 218 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>229pt</string> + <string>216pt</string> </dict> <dict> <key>Proportion</key> - <string>379pt</string> + <string>392pt</string> <key>Tabs</key> <array> <dict> @@ -396,9 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 352}}</string> - <key>RubberWindowFrame</key> - <string>20 224 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {531, 365}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -452,7 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 339}}</string> + <string>{{10, 27}, {531, 365}}</string> + <key>RubberWindowFrame</key> + <string>55 218 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -480,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B4D275A2002BF690051360A</string> + <string>8B7929D521F35450006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B4D275B2002BF690051360A</string> + <string>8B7929D621F35450006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B4D275C2002BF690051360A</string> + <string>8B7929D721F35450006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -657,7 +655,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>537050985.45516396</real> + <real>569594960.15694499</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -674,11 +672,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B4D275D2002BF690051360A</string> <string>/Users/christopherjohnson/Desktop/MacAU/Console5DarkCh/Console5DarkCh.xcodeproj</string> </array> <key>WindowString</key> - <string>20 224 841 654 0 0 1440 878 </string> + <string>55 218 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |