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/IronOxide5 | |
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/IronOxide5')
4 files changed, 36 insertions, 60 deletions
diff --git a/plugins/MacAU/IronOxide5/IronOxide5.cpp b/plugins/MacAU/IronOxide5/IronOxide5.cpp index f0c27dd..c64d19a 100755 --- a/plugins/MacAU/IronOxide5/IronOxide5.cpp +++ b/plugins/MacAU/IronOxide5/IronOxide5.cpp @@ -224,9 +224,7 @@ void IronOxide5::IronOxide5Kernel::Reset() sweep = 0.0; rateof = 0.5; nextmax = 0.5; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -288,11 +286,6 @@ void IronOxide5::IronOxide5Kernel::Process( const Float32 *inSourceP, Float64 dry = 1.0; if (invdrywet > 0.0) dry -= invdrywet; - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; - - while (nSampleFrames-- > 0) { inputSample = *sourceP; if (inputSample<1.2e-38 && -inputSample<1.2e-38) { @@ -475,7 +468,7 @@ void IronOxide5::IronOxide5Kernel::Process( const Float32 *inSourceP, inputSample += (prevInputSample*randy); prevInputSample = drySample; - flip = not flip; + flip = !flip; //begin invdrywet block with outputgain if (outputgain != 1.0) inputSample *= outputgain; @@ -484,23 +477,14 @@ void IronOxide5::IronOxide5Kernel::Process( const Float32 *inSourceP, if (fabs(drySample) > 0.0) inputSample += drySample; //end invdrywet block with outputgain - //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 + //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; - sourceP += inNumChannels; destP += inNumChannels; } } diff --git a/plugins/MacAU/IronOxide5/IronOxide5.h b/plugins/MacAU/IronOxide5/IronOxide5.h index 2b0b16e..2b3c655 100755 --- a/plugins/MacAU/IronOxide5/IronOxide5.h +++ b/plugins/MacAU/IronOxide5/IronOxide5.h @@ -167,13 +167,8 @@ public: Float64 rateof; Float64 sweep; Float64 nextmax; - - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; - + long double fpNShape; bool flip; - int demotimer; }; }; diff --git a/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.pbxuser index 0cb3aa0..8cbc973 100755 --- a/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,18 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528456633; - PBXWorkspaceStateSaveDate = 528456633; + PBXPerProjectTemplateStateSaveDate = 569649559; + PBXWorkspaceStateSaveDate = 569649559; }; perUserProjectItems = { - 8B9D65541F7C89D7007AB60F /* PlistBookmark */ = 8B9D65541F7C89D7007AB60F /* PlistBookmark */; + 8B792D9121F42A46006E9731 /* PlistBookmark */ = 8B792D9121F42A46006E9731 /* PlistBookmark */; 8B9D74A51F7F9BC2007AB60F /* PlistBookmark */ = 8B9D74A51F7F9BC2007AB60F /* PlistBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D65541F7C89D7007AB60F /* PlistBookmark */ = { + 8B792D9121F42A46006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -70,7 +70,7 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/IronOxide5/Info.plist; rLen = 0; - rLoc = 9223372036854775808; + rLoc = 9223372036854775807; }; 8B9D74A51F7F9BC2007AB60F /* PlistBookmark */ = { isa = PlistBookmark; @@ -82,14 +82,14 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/IronOxide5/Info.plist; rLen = 0; - rLoc = 9223372036854775807; + rLoc = 9223372036854775808; }; 8BA05A660720730100365D66 /* IronOxide5.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1006, 6552}}"; - sepNavSelRange = "{13026, 0}"; - sepNavVisRange = "{12449, 2393}"; - sepNavWindowFrame = "{{387, 39}, {1053, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {1006, 7072}}"; + sepNavSelRange = "{19392, 0}"; + sepNavVisRange = "{17695, 1759}"; + sepNavWindowFrame = "{{237, 39}, {1053, 839}}"; }; }; 8BA05A690720730100365D66 /* IronOxide5Version.h */ = { @@ -102,10 +102,10 @@ }; 8BC6025B073B072D006C4272 /* IronOxide5.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1006, 2327}}"; - sepNavSelRange = "{3959, 0}"; - sepNavVisRange = "{4993, 1457}"; - sepNavWindowFrame = "{{387, 39}, {1053, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {1006, 2535}}"; + sepNavSelRange = "{6418, 0}"; + sepNavVisRange = "{5321, 1207}"; + sepNavWindowFrame = "{{130, 39}, {1053, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.perspectivev3 index e2992e0..fd0036a 100755 --- a/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/IronOxide5/IronOxide5.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>841</integer> - <integer>841</integer> + <integer>826</integer> + <integer>826</integer> </array> <key>Perspectives</key> <array> @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -325,7 +323,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>607 110 826 502 0 0 1440 878 </string> + <string>386 241 826 502 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -353,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D74A51F7F9BC2007AB60F</string> + <string>8B792D9121F42A46006E9731</string> <key>history</key> <array> - <string>8B9D65541F7C89D7007AB60F</string> + <string>8B9D74A51F7F9BC2007AB60F</string> </array> </dict> <key>SplitCount</key> @@ -372,7 +370,7 @@ <key>Frame</key> <string>{{0, 0}, {516, 0}}</string> <key>RubberWindowFrame</key> - <string>607 110 826 502 0 0 1440 878 </string> + <string>386 241 826 502 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -396,8 +394,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {516, 429}}</string> - <key>RubberWindowFrame</key> - <string>607 110 826 502 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {516, 429}}</string> + <key>RubberWindowFrame</key> + <string>386 241 826 502 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D74A61F7F9BC2007AB60F</string> + <string>8B792D9221F42A46006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D74A71F7F9BC2007AB60F</string> + <string>8B792D9321F42A46006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D74A81F7F9BC2007AB60F</string> + <string>8B792D9421F42A46006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -656,7 +654,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528456642.85610998</real> + <real>569649734.80982804</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -673,11 +671,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D74A91F7F9BC2007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/IronOxide5/IronOxide5.xcodeproj</string> </array> <key>WindowString</key> - <string>607 110 826 502 0 0 1440 878 </string> + <string>386 241 826 502 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |