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/Surge | |
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/Surge')
-rwxr-xr-x | plugins/MacAU/Surge/Surge.cpp | 40 | ||||
-rwxr-xr-x | plugins/MacAU/Surge/Surge.h | 7 | ||||
-rwxr-xr-x | plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.pbxuser | 55 | ||||
-rwxr-xr-x | plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.perspectivev3 | 56 |
4 files changed, 72 insertions, 86 deletions
diff --git a/plugins/MacAU/Surge/Surge.cpp b/plugins/MacAU/Surge/Surge.cpp index 6c59016..af2adf4 100755 --- a/plugins/MacAU/Surge/Surge.cpp +++ b/plugins/MacAU/Surge/Surge.cpp @@ -181,11 +181,8 @@ ComponentResult Surge::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ComponentResult Surge::Reset(AudioUnitScope inScope, AudioUnitElement inElement) { - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; - flip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; chaseA = 0.0; chaseB = 0.0; chaseC = 0.0; @@ -210,9 +207,6 @@ OSStatus Surge::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags, Float64 overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -227,7 +221,6 @@ OSStatus Surge::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags, Float64 dry = 1.0 - wet; Float64 inputSense; - while (nSampleFrames-- > 0) { inputSampleL = *inputL; inputSampleR = *inputR; @@ -312,27 +305,14 @@ OSStatus Surge::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlags, inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = (drySampleR * dry) + (inputSampleR * wet); - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((Float32)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((Float32)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *outputL = inputSampleL; *outputR = inputSampleR; diff --git a/plugins/MacAU/Surge/Surge.h b/plugins/MacAU/Surge/Surge.h index 3569845..0d24ad7 100755 --- a/plugins/MacAU/Surge/Surge.h +++ b/plugins/MacAU/Surge/Surge.h @@ -112,11 +112,8 @@ public: virtual ComponentResult Version() { return kSurgeVersion; } private: - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; - bool flip; + long double fpNShapeL; + long double fpNShapeR; long double chaseA; long double chaseB; long double chaseC; diff --git a/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.pbxuser index ea48a6f..c2c098b 100755 --- a/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.pbxuser @@ -12,7 +12,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 292, + 446, 20, 48, 43, @@ -51,12 +51,13 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528458296; - PBXWorkspaceStateSaveDate = 528458296; + PBXPerProjectTemplateStateSaveDate = 569681702; + PBXWorkspaceStateSaveDate = 569681702; }; perUserProjectItems = { - 8B9D72591F7F002B007AB60F /* PBXTextBookmark */ = 8B9D72591F7F002B007AB60F /* PBXTextBookmark */; - 8B9D76551F7FA262007AB60F /* PBXTextBookmark */ = 8B9D76551F7FA262007AB60F /* PBXTextBookmark */; + 8B7930BB21F4A95A006E9731 /* PBXTextBookmark */ = 8B7930BB21F4A95A006E9731 /* PBXTextBookmark */; + 8B7930BD21F4A95A006E9731 /* PBXTextBookmark */ = 8B7930BD21F4A95A006E9731 /* PBXTextBookmark */; + 8B7930C221F4A996006E9731 /* PBXTextBookmark */ = 8B7930C221F4A996006E9731 /* PBXTextBookmark */; 8BD4F5501E6E0C5600288155 /* PlistBookmark */ = 8BD4F5501E6E0C5600288155 /* PlistBookmark */; 8BD4F5511E6E0C5600288155 /* PBXTextBookmark */ = 8BD4F5511E6E0C5600288155 /* PBXTextBookmark */; }; @@ -64,31 +65,41 @@ userBuildSettings = { }; }; - 8B9D72591F7F002B007AB60F /* PBXTextBookmark */ = { + 8B7930BB21F4A95A006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BC6025B073B072D006C4272 /* Surge.h */; - name = "Surge.h: 119"; + name = "Surge.h: 116"; rLen = 0; - rLoc = 4988; + rLoc = 4922; rType = 0; - vrLen = 383; - vrLoc = 2846; + vrLen = 1308; + vrLoc = 3829; }; - 8B9D76551F7FA262007AB60F /* PBXTextBookmark */ = { + 8B7930BD21F4A95A006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BC6025B073B072D006C4272 /* Surge.h */; - name = "Surge.h: 119"; + fRef = 8BA05A660720730100365D66 /* Surge.cpp */; + name = "Surge.cpp: 316"; + rLen = 0; + rLoc = 12980; + rType = 0; + vrLen = 1238; + vrLoc = 11945; + }; + 8B7930C221F4A996006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* Surge.cpp */; + name = "Surge.cpp: 316"; rLen = 0; - rLoc = 4988; + rLoc = 12980; rType = 0; - vrLen = 334; - vrLoc = 2895; + vrLen = 1520; + vrLoc = 10349; }; 8BA05A660720730100365D66 /* Surge.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {977, 4628}}"; - sepNavSelRange = "{10662, 0}"; - sepNavVisRange = "{9183, 2420}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 4511}}"; + sepNavSelRange = "{12980, 0}"; + sepNavVisRange = "{10349, 1520}"; sepNavWindowFrame = "{{416, 39}, {1024, 839}}"; }; }; @@ -102,9 +113,9 @@ }; 8BC6025B073B072D006C4272 /* Surge.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1963}}"; - sepNavSelRange = "{4988, 0}"; - sepNavVisRange = "{2895, 334}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 1768}}"; + sepNavSelRange = "{4922, 0}"; + sepNavVisRange = "{3829, 1308}"; sepNavWindowFrame = "{{788, 29}, {1024, 839}}"; }; }; diff --git a/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.perspectivev3 index 0b410ec..85d373f 100755 --- a/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Surge/Surge.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>841</integer> - <integer>841</integer> + <integer>898</integer> + <integer>898</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> @@ -282,7 +280,7 @@ <dict> <key>PBXSmartGroupTreeModuleColumnWidthsKey</key> <array> - <real>288</real> + <real>191</real> </array> <key>PBXSmartGroupTreeModuleColumnsKey_v4</key> <array> @@ -308,7 +306,7 @@ </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {288, 595}}</string> + <string>{{0, 0}, {191, 681}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -318,19 +316,19 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {305, 613}}</string> + <string>{{0, 0}, {208, 699}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> - <real>288</real> + <real>191</real> </array> <key>RubberWindowFrame</key> - <string>599 205 841 654 0 0 1440 878 </string> + <string>405 127 898 740 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> <key>Proportion</key> - <string>305pt</string> + <string>208pt</string> </dict> <dict> <key>Dock</key> @@ -341,7 +339,7 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274A1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>Surge.h</string> + <string>Surge.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -349,16 +347,17 @@ <key>PBXProjectModuleGUID</key> <string>8BD7274B1D46E5A5000176F0</string> <key>PBXProjectModuleLabel</key> - <string>Surge.h</string> + <string>Surge.cpp</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D76551F7FA262007AB60F</string> + <string>8B7930C221F4A996006E9731</string> <key>history</key> <array> <string>8BD4F5501E6E0C5600288155</string> <string>8BD4F5511E6E0C5600288155</string> - <string>8B9D72591F7F002B007AB60F</string> + <string>8B7930BB21F4A95A006E9731</string> + <string>8B7930BD21F4A95A006E9731</string> </array> </dict> <key>SplitCount</key> @@ -372,18 +371,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 202}}</string> + <string>{{0, 0}, {685, 539}}</string> <key>RubberWindowFrame</key> - <string>599 205 841 654 0 0 1440 878 </string> + <string>405 127 898 740 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>202pt</string> + <string>539pt</string> </dict> <dict> <key>Proportion</key> - <string>406pt</string> + <string>155pt</string> <key>Tabs</key> <array> <dict> @@ -397,9 +396,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 379}}</string> - <key>RubberWindowFrame</key> - <string>599 205 841 654 0 0 1440 878 </string> + <string>{{10, 27}, {685, 128}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -453,7 +450,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 315}}</string> + <string>{{10, 27}, {685, 128}}</string> + <key>RubberWindowFrame</key> + <string>405 127 898 740 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -462,7 +461,7 @@ </dict> </array> <key>Proportion</key> - <string>531pt</string> + <string>685pt</string> </dict> </array> <key>Name</key> @@ -481,11 +480,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D76561F7FA262007AB60F</string> + <string>8B7930C321F4A996006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D76571F7FA262007AB60F</string> + <string>8B7930C421F4A996006E9731</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8B9D76581F7FA262007AB60F</string> + <string>8B7930C521F4A996006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -658,7 +657,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528458338.37719601</real> + <real>569682326.61837006</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -675,11 +674,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D76591F7FA262007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/Surge/Surge.xcodeproj</string> </array> <key>WindowString</key> - <string>599 205 841 654 0 0 1440 878 </string> + <string>405 127 898 740 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |