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/PDBuss | |
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/PDBuss')
-rwxr-xr-x | plugins/MacAU/PDBuss/PDBuss.cpp | 26 | ||||
-rwxr-xr-x | plugins/MacAU/PDBuss/PDBuss.h | 4 | ||||
-rwxr-xr-x | plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser | 54 | ||||
-rwxr-xr-x | plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3 | 44 |
4 files changed, 58 insertions, 70 deletions
diff --git a/plugins/MacAU/PDBuss/PDBuss.cpp b/plugins/MacAU/PDBuss/PDBuss.cpp index 5e27a7c..6f450c6 100755 --- a/plugins/MacAU/PDBuss/PDBuss.cpp +++ b/plugins/MacAU/PDBuss/PDBuss.cpp @@ -170,9 +170,7 @@ void PDBuss::PDBussKernel::Reset() settingchase = -90.0; chasespeed = 350.0; previousSample = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -187,10 +185,6 @@ void PDBuss::PDBussKernel::Process( const Float32 *inSourceP, UInt32 nSampleFrames = inFramesToProcess; const Float32 *sourceP = inSourceP; Float32 *destP = inDestP; - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - Float64 inputgain = GetParameter( kParam_One ); Float64 intensity = GetParameter( kParam_Two ); Float64 apply; @@ -265,19 +259,11 @@ void PDBuss::PDBussKernel::Process( const Float32 *inSourceP, previousSample = sin(drySample); //apply the sine while storing previous sample - //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/PDBuss/PDBuss.h b/plugins/MacAU/PDBuss/PDBuss.h index 906cb85..476b436 100755 --- a/plugins/MacAU/PDBuss/PDBuss.h +++ b/plugins/MacAU/PDBuss/PDBuss.h @@ -132,9 +132,7 @@ public: Float64 settingchase; Float64 chasespeed; Float64 previousSample; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser index f1228a5..40d8bcc 100755 --- a/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser @@ -49,14 +49,14 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 538696879; - PBXWorkspaceStateSaveDate = 538696879; + PBXPerProjectTemplateStateSaveDate = 569652165; + PBXWorkspaceStateSaveDate = 569652165; }; perUserProjectItems = { 8B4E5518201BB8EE00B5DC2A /* PlistBookmark */ = 8B4E5518201BB8EE00B5DC2A /* PlistBookmark */; - 8B4E573F201BE1D700B5DC2A /* PBXTextBookmark */ = 8B4E573F201BE1D700B5DC2A /* PBXTextBookmark */; - 8B4E5740201BE1D700B5DC2A /* PBXBookmark */ = 8B4E5740201BE1D700B5DC2A /* PBXBookmark */; - 8B4E5741201BE1D700B5DC2A /* PBXTextBookmark */ = 8B4E5741201BE1D700B5DC2A /* PBXTextBookmark */; + 8B792E8621F43436006E9731 /* PBXTextBookmark */ = 8B792E8621F43436006E9731 /* PBXTextBookmark */; + 8B792E8721F43436006E9731 /* PBXTextBookmark */ = 8B792E8721F43436006E9731 /* PBXTextBookmark */; + 8B792E8C21F43451006E9731 /* PBXTextBookmark */ = 8B792E8C21F43451006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -74,36 +74,42 @@ rLen = 0; rLoc = 9223372036854775808; }; - 8B4E573F201BE1D700B5DC2A /* PBXTextBookmark */ = { + 8B792E8621F43436006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* PDBuss.cpp */; + name = "PDBuss.cpp: 165"; + rLen = 0; + rLoc = 7437; + rType = 0; + vrLen = 1; + vrLoc = 7311; + }; + 8B792E8721F43436006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BC6025B073B072D006C4272 /* PDBuss.h */; name = "PDBuss.h: 68"; rLen = 0; rLoc = 3175; rType = 0; - vrLen = 29; - vrLoc = 2587; + vrLen = 26; + vrLoc = 2590; }; - 8B4E5740201BE1D700B5DC2A /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 8BA05A660720730100365D66 /* PDBuss.cpp */; - }; - 8B4E5741201BE1D700B5DC2A /* PBXTextBookmark */ = { + 8B792E8C21F43451006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* PDBuss.cpp */; - name = "PDBuss.cpp: 165"; + fRef = 8BC6025B073B072D006C4272 /* PDBuss.h */; + name = "PDBuss.h: 68"; rLen = 0; - rLoc = 7437; + rLoc = 3175; rType = 0; - vrLen = 95; - vrLoc = 7310; + vrLen = 26; + vrLoc = 2590; }; 8BA05A660720730100365D66 /* PDBuss.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {656, 3887}}"; - sepNavSelRange = "{7437, 0}"; - sepNavVisRange = "{7310, 95}"; - sepNavWindowFrame = "{{489, 50}, {923, 828}}"; + sepNavIntBoundsRect = "{{0, 0}, {876, 3822}}"; + sepNavSelRange = "{11537, 0}"; + sepNavVisRange = "{9680, 1945}"; + sepNavWindowFrame = "{{352, 50}, {923, 828}}"; }; }; 8BA05A690720730100365D66 /* PDBussVersion.h */ = { @@ -116,9 +122,9 @@ }; 8BC6025B073B072D006C4272 /* PDBuss.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1703}}"; + sepNavIntBoundsRect = "{{0, 0}, {761, 1885}}"; sepNavSelRange = "{3175, 0}"; - sepNavVisRange = "{2035, 1751}"; + sepNavVisRange = "{2590, 26}"; sepNavWindowFrame = "{{506, 50}, {923, 828}}"; }; }; diff --git a/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3 index c01d4ac..ba04652 100755 --- a/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>841</integer> - <integer>841</integer> + <integer>775</integer> + <integer>775</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> @@ -326,7 +324,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>656 383 775 495 0 0 1440 878 </string> + <string>528 353 775 495 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -342,7 +340,7 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274A1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>PDBuss.cpp</string> + <string>PDBuss.h</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -350,16 +348,16 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274B1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>PDBuss.cpp</string> + <string>PDBuss.h</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B4E5741201BE1D700B5DC2A</string> + <string>8B792E8C21F43451006E9731</string> <key>history</key> <array> <string>8B4E5518201BB8EE00B5DC2A</string> - <string>8B4E573F201BE1D700B5DC2A</string> - <string>8B4E5740201BE1D700B5DC2A</string> + <string>8B792E8621F43436006E9731</string> + <string>8B792E8721F43436006E9731</string> </array> </dict> <key>SplitCount</key> @@ -373,18 +371,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {465, 52}}</string> + <string>{{0, 0}, {465, 33}}</string> <key>RubberWindowFrame</key> - <string>656 383 775 495 0 0 1440 878 </string> + <string>528 353 775 495 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>52pt</string> + <string>33pt</string> </dict> <dict> <key>Proportion</key> - <string>397pt</string> + <string>416pt</string> <key>Tabs</key> <array> <dict> @@ -398,9 +396,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {465, 370}}</string> - <key>RubberWindowFrame</key> - <string>656 383 775 495 0 0 1440 878 </string> + <string>{{10, 27}, {465, 389}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -454,7 +450,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 339}}</string> + <string>{{10, 27}, {465, 389}}</string> + <key>RubberWindowFrame</key> + <string>528 353 775 495 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -482,11 +480,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B4E5742201BE1D700B5DC2A</string> + <string>8B792E8D21F43451006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B4E5743201BE1D700B5DC2A</string> + <string>8B792E8E21F43451006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B4E5744201BE1D700B5DC2A</string> + <string>8B792E8F21F43451006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -659,7 +657,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>538698199.879107</real> + <real>569652305.95869505</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -679,7 +677,7 @@ <string>/Users/christopherjohnson/Desktop/MacAU/PDBuss/PDBuss.xcodeproj</string> </array> <key>WindowString</key> - <string>656 383 775 495 0 0 1440 878 </string> + <string>528 353 775 495 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |