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/PurestGain | |
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/PurestGain')
-rwxr-xr-x[-rw-r--r--] | plugins/MacAU/PurestGain/PurestGain.cpp | 42 | ||||
-rwxr-xr-x | plugins/MacAU/PurestGain/PurestGain.h | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.mode1v3 | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser | 42 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 | 48 | ||||
-rwxr-xr-x[-rw-r--r--] | plugins/MacAU/PurestGain/PurestGain.xcodeproj/project.pbxproj | 0 |
6 files changed, 69 insertions, 68 deletions
diff --git a/plugins/MacAU/PurestGain/PurestGain.cpp b/plugins/MacAU/PurestGain/PurestGain.cpp index fe5477c..6bc46d5 100644..100755 --- a/plugins/MacAU/PurestGain/PurestGain.cpp +++ b/plugins/MacAU/PurestGain/PurestGain.cpp @@ -170,9 +170,7 @@ void PurestGain::PurestGainKernel::Reset() settingchase = -90.0; gainBchase = -90.0; chasespeed = 350.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -187,7 +185,6 @@ void PurestGain::PurestGainKernel::Process( const Float32 *inSourceP, UInt32 nSampleFrames = inFramesToProcess; const Float32 *sourceP = inSourceP; Float32 *destP = inDestP; - Float32 fpTemp; Float64 inputgain = GetParameter( kParam_One ); if (settingchase != inputgain) { @@ -216,8 +213,6 @@ void PurestGain::PurestGainKernel::Process( const Float32 *inSourceP, Float64 outputgain; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; long double inputSample; while (nSampleFrames-- > 0) { @@ -266,38 +261,17 @@ void PurestGain::PurestGainKernel::Process( const Float32 *inSourceP, } - if (1.0 == outputgain) - { - if (fpFlip) { - fpTemp = inputSample; - fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew); - } - else { - fpTemp = inputSample; - fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew); - } - fpFlip = not fpFlip; - //continue noise shaping when bypassing - *destP = *sourceP; - } + if (1.0 == outputgain) *destP = *sourceP; else { inputSample *= outputgain; - 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/PurestGain/PurestGain.h b/plugins/MacAU/PurestGain/PurestGain.h index 33521dd..ebdac1a 100755 --- a/plugins/MacAU/PurestGain/PurestGain.h +++ b/plugins/MacAU/PurestGain/PurestGain.h @@ -132,10 +132,7 @@ public: Float64 settingchase; Float64 gainBchase; Float64 chasespeed; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; - + Float64 fpNShape; }; }; diff --git a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.mode1v3 b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.mode1v3 index 75ac472..75ac472 100644..100755 --- a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.mode1v3 +++ b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.mode1v3 diff --git a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser index 2071f3a..3035ecc 100644..100755 --- a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser @@ -49,19 +49,43 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 532472865; - PBXWorkspaceStateSaveDate = 532472865; + PBXPerProjectTemplateStateSaveDate = 569586279; + PBXWorkspaceStateSaveDate = 569586279; + }; + perUserProjectItems = { + 8B7926BA21F332FC006E9731 /* PBXTextBookmark */ = 8B7926BA21F332FC006E9731 /* PBXTextBookmark */; + 8B7926C421F3331E006E9731 /* PBXTextBookmark */ = 8B7926C421F3331E006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; + 8B7926BA21F332FC006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* PurestGain.cpp */; + name = "PurestGain.cpp: 239"; + rLen = 1347; + rLoc = 10034; + rType = 0; + vrLen = 189; + vrLoc = 10740; + }; + 8B7926C421F3331E006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* PurestGain.cpp */; + name = "PurestGain.cpp: 238"; + rLen = 1347; + rLoc = 10034; + rType = 0; + vrLen = 171; + vrLoc = 10772; + }; 8BA05A660720730100365D66 /* PurestGain.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {862, 3965}}"; - sepNavSelRange = "{10177, 1347}"; - sepNavVisRange = "{10721, 1649}"; - sepNavWindowFrame = "{{556, 40}, {909, 838}}"; + sepNavIntBoundsRect = "{{0, 0}, {684, 3744}}"; + sepNavSelRange = "{10034, 1347}"; + sepNavVisRange = "{10772, 171}"; + sepNavWindowFrame = "{{390, 40}, {909, 838}}"; }; }; 8BA05A690720730100365D66 /* PurestGainVersion.h */ = { @@ -74,9 +98,9 @@ }; 8BC6025B073B072D006C4272 /* PurestGain.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1885}}"; - sepNavSelRange = "{5290, 58}"; - sepNavVisRange = "{3646, 1707}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 1846}}"; + sepNavSelRange = "{5310, 0}"; + sepNavVisRange = "{3646, 1766}"; sepNavWindowFrame = "{{531, 39}, {909, 838}}"; }; }; diff --git a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 index 11f6e1d..7e92ba1 100644..100755 --- a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>-1</integer> - <integer>-1</integer> + <integer>810</integer> + <integer>810</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> @@ -324,7 +322,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>630 375 810 487 0 0 1440 878 </string> + <string>510 325 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -340,7 +338,7 @@ <key>PBXProjectModuleGUID</key> <string>8BC521591DB3E3F700E72CD6</string> <key>PBXProjectModuleLabel</key> - <string></string> + <string>PurestGain.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -348,7 +346,15 @@ <key>PBXProjectModuleGUID</key> <string>8BC5215A1DB3E3F700E72CD6</string> <key>PBXProjectModuleLabel</key> - <string></string> + <string>PurestGain.cpp</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>8B7926C421F3331E006E9731</string> + <key>history</key> + <array> + <string>8B7926BA21F332FC006E9731</string> + </array> </dict> <key>SplitCount</key> <string>1</string> @@ -361,18 +367,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 0}}</string> + <string>{{0, 0}, {603, 86}}</string> <key>RubberWindowFrame</key> - <string>630 375 810 487 0 0 1440 878 </string> + <string>510 325 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>0pt</string> + <string>86pt</string> </dict> <dict> <key>Proportion</key> - <string>441pt</string> + <string>355pt</string> <key>Tabs</key> <array> <dict> @@ -386,9 +392,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>630 375 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 328}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -442,7 +446,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 31}, {603, 297}}</string> + <string>{{10, 27}, {603, 328}}</string> + <key>RubberWindowFrame</key> + <string>510 325 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -470,11 +476,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BB5DD741FBCE50A008B4570</string> + <string>8B7926C521F3331E006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BB5DD751FBCE50A008B4570</string> + <string>8B7926C621F3331E006E9731</string> <string>8BC521591DB3E3F700E72CD6</string> - <string>8BB5DD761FBCE50A008B4570</string> + <string>8B7926C721F3331E006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -627,7 +633,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>532473098.399234</real> + <real>569586462.880615</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -644,11 +650,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8BB5DD771FBCE50A008B4570</string> + <string>8B7926C821F3331E006E9731</string> <string>/Users/christopherjohnson/Desktop/MacAU/PurestGain/PurestGain.xcodeproj</string> </array> <key>WindowString</key> - <string>630 375 810 487 0 0 1440 878 </string> + <string>510 325 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/project.pbxproj b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/project.pbxproj index 7426519..7426519 100644..100755 --- a/plugins/MacAU/PurestGain/PurestGain.xcodeproj/project.pbxproj +++ b/plugins/MacAU/PurestGain/PurestGain.xcodeproj/project.pbxproj |