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/Chorus | |
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/Chorus')
-rwxr-xr-x | plugins/MacAU/Chorus/Chorus.cpp | 27 | ||||
-rwxr-xr-x | plugins/MacAU/Chorus/Chorus.h | 5 | ||||
-rwxr-xr-x | plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.pbxuser | 36 | ||||
-rwxr-xr-x | plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.perspectivev3 | 35 |
4 files changed, 44 insertions, 59 deletions
diff --git a/plugins/MacAU/Chorus/Chorus.cpp b/plugins/MacAU/Chorus/Chorus.cpp index c82a9f8..6a4eb69 100755 --- a/plugins/MacAU/Chorus/Chorus.cpp +++ b/plugins/MacAU/Chorus/Chorus.cpp @@ -181,9 +181,8 @@ void Chorus::ChorusKernel::Reset() airEven = 0.0; airOdd = 0.0; airFactor = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; + fpFlip = false; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -214,10 +213,6 @@ void Chorus::ChorusKernel::Process( const Float32 *inSourceP, Float64 tupi = 3.141592653589793238 * 2.0; Float64 offset; //this is a double buffer so we will be splitting it in two - - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSample; Float64 drySample; @@ -282,19 +277,11 @@ void Chorus::ChorusKernel::Process( const Float32 *inSourceP, inputSample = (inputSample * wet) + (drySample * dry); } - //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; destP += inNumChannels; diff --git a/plugins/MacAU/Chorus/Chorus.h b/plugins/MacAU/Chorus/Chorus.h index e25e995..ff1fdf2 100755 --- a/plugins/MacAU/Chorus/Chorus.h +++ b/plugins/MacAU/Chorus/Chorus.h @@ -139,9 +139,8 @@ public: Float64 airEven; Float64 airOdd; Float64 airFactor; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; + bool fpFlip; }; }; diff --git a/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.pbxuser index 3cae981..f61c3d3 100755 --- a/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.pbxuser @@ -49,44 +49,44 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 529841844; - PBXWorkspaceStateSaveDate = 529841844; + PBXPerProjectTemplateStateSaveDate = 569591348; + PBXWorkspaceStateSaveDate = 569591348; }; perUserProjectItems = { - 8B36C9E21F94D13C003BE0C9 /* PBXTextBookmark */ = 8B36C9E21F94D13C003BE0C9 /* PBXTextBookmark */; - 8B9D733F1F7F1245007AB60F /* PBXTextBookmark */ = 8B9D733F1F7F1245007AB60F /* PBXTextBookmark */; + 8B79292521F34676006E9731 /* PBXTextBookmark */ = 8B79292521F34676006E9731 /* PBXTextBookmark */; + 8B79293221F346AC006E9731 /* PBXTextBookmark */ = 8B79293221F346AC006E9731 /* PBXTextBookmark */; 8BCF321C1F4E492C00632CB6 /* PBXTextBookmark */ = 8BCF321C1F4E492C00632CB6 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B36C9E21F94D13C003BE0C9 /* PBXTextBookmark */ = { + 8B79292521F34676006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Chorus.cpp */; - name = "Chorus.cpp: 269"; + name = "Chorus.cpp: 263"; rLen = 0; - rLoc = 11881; + rLoc = 11745; rType = 0; vrLen = 0; vrLoc = 0; }; - 8B9D733F1F7F1245007AB60F /* PBXTextBookmark */ = { + 8B79293221F346AC006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Chorus.cpp */; - name = "Chorus.cpp: 269"; + name = "Chorus.cpp: 264"; rLen = 0; - rLoc = 11881; + rLoc = 11745; rType = 0; - vrLen = 65; - vrLoc = 10659; + vrLen = 0; + vrLoc = 0; }; 8BA05A660720730100365D66 /* Chorus.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 4004}}"; - sepNavSelRange = "{11881, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 3887}}"; + sepNavSelRange = "{11745, 0}"; sepNavVisRange = "{0, 0}"; - sepNavWindowFrame = "{{784, 39}, {1024, 839}}"; + sepNavWindowFrame = "{{257, 39}, {1024, 839}}"; }; }; 8BA05A670720730100365D66 /* Chorus.exp */ = { @@ -107,9 +107,9 @@ }; 8BC6025B073B072D006C4272 /* Chorus.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {958, 1963}}"; - sepNavSelRange = "{5229, 0}"; - sepNavVisRange = "{4125, 1457}"; + sepNavIntBoundsRect = "{{0, 0}, {958, 1937}}"; + sepNavSelRange = "{5444, 0}"; + sepNavVisRange = "{4046, 1502}"; sepNavWindowFrame = "{{435, 39}, {1005, 839}}"; }; }; diff --git a/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.perspectivev3 index ecf0b5a..4dc6f92 100755 --- a/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Chorus/Chorus.xcodeproj/christopherjohnson.perspectivev3 @@ -300,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>4</integer> + <integer>3</integer> <integer>2</integer> <integer>1</integer> <integer>0</integer> @@ -324,7 +324,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>630 329 810 487 0 0 1440 878 </string> + <string>473 332 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,11 +352,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B36C9E21F94D13C003BE0C9</string> + <string>8B79293221F346AC006E9731</string> <key>history</key> <array> <string>8BCF321C1F4E492C00632CB6</string> - <string>8B9D733F1F7F1245007AB60F</string> + <string>8B79292521F34676006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +370,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 32}}</string> + <string>{{0, 0}, {603, 13}}</string> <key>RubberWindowFrame</key> - <string>630 329 810 487 0 0 1440 878 </string> + <string>473 332 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>32pt</string> + <string>13pt</string> </dict> <dict> <key>Proportion</key> - <string>409pt</string> + <string>428pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +395,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 382}}</string> - <key>RubberWindowFrame</key> - <string>630 329 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 401}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +449,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 282}}</string> + <string>{{10, 27}, {603, 401}}</string> + <key>RubberWindowFrame</key> + <string>473 332 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B36C9E31F94D13C003BE0C9</string> + <string>8B79293321F346AC006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B36C9E41F94D13C003BE0C9</string> + <string>8B79293421F346AC006E9731</string> <string>8BCFBD371E6DE48D0046F93B</string> - <string>8B36C9E51F94D13C003BE0C9</string> + <string>8B79293521F346AC006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +636,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>529846588.24690598</real> + <real>569591468.25551903</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,11 +653,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B36C9E61F94D13C003BE0C9</string> <string>/Users/christopherjohnson/Desktop/MacAU/Chorus/Chorus.xcodeproj</string> </array> <key>WindowString</key> - <string>630 329 810 487 0 0 1440 878 </string> + <string>473 332 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |