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/SurgeMono | |
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/SurgeMono')
4 files changed, 70 insertions, 68 deletions
diff --git a/plugins/MacAU/SurgeMono/SurgeMono.cpp b/plugins/MacAU/SurgeMono/SurgeMono.cpp index dac3bbd..8909d58 100755 --- a/plugins/MacAU/SurgeMono/SurgeMono.cpp +++ b/plugins/MacAU/SurgeMono/SurgeMono.cpp @@ -166,9 +166,7 @@ ComponentResult SurgeMono::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void SurgeMono::SurgeMonoKernel::Reset() { - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; chaseA = 0.0; chaseB = 0.0; chaseC = 0.0; @@ -190,11 +188,7 @@ void SurgeMono::SurgeMonoKernel::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(); long double inputSample; long double drySample; Float64 chaseMax = 0.0; @@ -205,7 +199,6 @@ void SurgeMono::SurgeMonoKernel::Process( const Float32 *inSourceP, Float64 dry = 1.0 - wet; Float64 inputSense; - while (nSampleFrames-- > 0) { inputSample = *sourceP; if (inputSample<1.2e-38 && -inputSample<1.2e-38) { @@ -265,19 +258,11 @@ void SurgeMono::SurgeMonoKernel::Process( const Float32 *inSourceP, inputSample = drySample - (inputSample * intensity); inputSample = (drySample * dry) + (inputSample * wet); - //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/SurgeMono/SurgeMono.h b/plugins/MacAU/SurgeMono/SurgeMono.h index 68d3d7b..692d325 100755 --- a/plugins/MacAU/SurgeMono/SurgeMono.h +++ b/plugins/MacAU/SurgeMono/SurgeMono.h @@ -128,9 +128,7 @@ public: virtual void Reset(); private: - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; long double chaseA; long double chaseB; long double chaseC; diff --git a/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.pbxuser index e9de3fd..073386c 100755 --- a/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,20 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528458347; - PBXWorkspaceStateSaveDate = 528458347; + PBXPerProjectTemplateStateSaveDate = 569682465; + PBXWorkspaceStateSaveDate = 569682465; }; perUserProjectItems = { - 8B9D67791F7C8FFF007AB60F /* PlistBookmark */ = 8B9D67791F7C8FFF007AB60F /* PlistBookmark */; - 8B9D76661F7FA27C007AB60F /* PlistBookmark */ = 8B9D76661F7FA27C007AB60F /* PlistBookmark */; + 8B7930D121F4AAA2006E9731 /* PlistBookmark */ = 8B7930D121F4AAA2006E9731 /* PlistBookmark */; + 8B7930D221F4AAA2006E9731 /* PBXTextBookmark */ = 8B7930D221F4AAA2006E9731 /* PBXTextBookmark */; + 8B7930D421F4AAA2006E9731 /* PBXTextBookmark */ = 8B7930D421F4AAA2006E9731 /* PBXTextBookmark */; + 8B7930D921F4AAD9006E9731 /* PBXTextBookmark */ = 8B7930D921F4AAD9006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D67791F7C8FFF007AB60F /* PlistBookmark */ = { + 8B7930D121F4AAA2006E9731 /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -70,25 +72,43 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/SurgeMono/Info.plist; rLen = 0; - rLoc = 9223372036854775808; + rLoc = 9223372036854775807; }; - 8B9D76661F7FA27C007AB60F /* PlistBookmark */ = { - isa = PlistBookmark; - fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; - fallbackIsa = PBXBookmark; - isK = 0; - kPath = ( - CFBundleName, - ); - name = /Users/christopherjohnson/Desktop/MacAU/SurgeMono/Info.plist; + 8B7930D221F4AAA2006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BC6025B073B072D006C4272 /* SurgeMono.h */; + name = "SurgeMono.h: 131"; rLen = 0; - rLoc = 9223372036854775807; + rLoc = 5211; + rType = 0; + vrLen = 694; + vrLoc = 4739; + }; + 8B7930D421F4AAA2006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* SurgeMono.cpp */; + name = "SurgeMono.cpp: 266"; + rLen = 0; + rLoc = 11482; + rType = 0; + vrLen = 860; + vrLoc = 10710; + }; + 8B7930D921F4AAD9006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* SurgeMono.cpp */; + name = "SurgeMono.cpp: 266"; + rLen = 0; + rLoc = 11482; + rType = 0; + vrLen = 863; + vrLoc = 10707; }; 8BA05A660720730100365D66 /* SurgeMono.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {977, 3770}}"; - sepNavSelRange = "{9077, 0}"; - sepNavVisRange = "{8218, 2347}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 3796}}"; + sepNavSelRange = "{11482, 0}"; + sepNavVisRange = "{10707, 863}"; sepNavWindowFrame = "{{416, 39}, {1024, 839}}"; }; }; @@ -102,9 +122,9 @@ }; 8BC6025B073B072D006C4272 /* SurgeMono.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {977, 1885}}"; - sepNavSelRange = "{5253, 112}"; - sepNavVisRange = "{3887, 1587}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 2210}}"; + sepNavSelRange = "{5211, 0}"; + sepNavVisRange = "{4739, 694}"; sepNavWindowFrame = "{{571, 39}, {1024, 839}}"; }; }; diff --git a/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.perspectivev3 index e17ff881..3226810 100755 --- a/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/SurgeMono/SurgeMono.xcodeproj/christopherjohnson.perspectivev3 @@ -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>582 129 841 654 0 0 1440 878 </string> + <string>444 180 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -341,7 +339,7 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274A1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>Info.plist</string> + <string>SurgeMono.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -349,14 +347,16 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274B1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>Info.plist</string> + <string>SurgeMono.cpp</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D76661F7FA27C007AB60F</string> + <string>8B7930D921F4AAD9006E9731</string> <key>history</key> <array> - <string>8B9D67791F7C8FFF007AB60F</string> + <string>8B7930D121F4AAA2006E9731</string> + <string>8B7930D221F4AAA2006E9731</string> + <string>8B7930D421F4AAA2006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +370,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 216}}</string> + <string>{{0, 0}, {531, 414}}</string> <key>RubberWindowFrame</key> - <string>582 129 841 654 0 0 1440 878 </string> + <string>444 180 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>216pt</string> + <string>414pt</string> </dict> <dict> <key>Proportion</key> - <string>392pt</string> + <string>194pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +395,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 365}}</string> - <key>RubberWindowFrame</key> - <string>582 129 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {531, 167}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +449,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {531, 167}}</string> + <key>RubberWindowFrame</key> + <string>444 180 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D76671F7FA27C007AB60F</string> + <string>8B7930DA21F4AAD9006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D76681F7FA27C007AB60F</string> + <string>8B7930DB21F4AAD9006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D76691F7FA27C007AB60F</string> + <string>8B7930DC21F4AAD9006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -656,7 +656,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528458364.66416103</real> + <real>569682649.56976402</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -673,11 +673,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D766A1F7FA27C007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/SurgeMono/SurgeMono.xcodeproj</string> </array> <key>WindowString</key> - <string>582 129 841 654 0 0 1440 878 </string> + <string>444 180 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |