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/Air | |
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/Air')
-rwxr-xr-x | plugins/MacAU/Air/Air.cpp | 29 | ||||
-rwxr-xr-x | plugins/MacAU/Air/Air.h | 7 | ||||
-rwxr-xr-x | plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.pbxuser | 40 | ||||
-rwxr-xr-x | plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.perspectivev3 | 28 |
4 files changed, 41 insertions, 63 deletions
diff --git a/plugins/MacAU/Air/Air.cpp b/plugins/MacAU/Air/Air.cpp index 716f907..7ba3efe 100755 --- a/plugins/MacAU/Air/Air.cpp +++ b/plugins/MacAU/Air/Air.cpp @@ -222,11 +222,7 @@ void Air::AirKernel::Reset() tripletC = 0.0; tripletFactor = 0.0; count = 1; - - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; - + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -254,11 +250,6 @@ void Air::AirKernel::Process( const Float32 *inSourceP, Float64 wet = GetParameter( kParam_Six ); Float64 dry = 1.0-wet; - - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; - Float32 fpTemp; - long double inputSample; Float64 drySample; Float64 correction; @@ -399,19 +390,11 @@ void Air::AirKernel::Process( const Float32 *inSourceP, //nice little output stage template: if we have another scale of floating point //number, we really don't want to meaninglessly multiply that by 1.0. - 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; destP += inNumChannels; diff --git a/plugins/MacAU/Air/Air.h b/plugins/MacAU/Air/Air.h index 571b8ac..6dcd06c 100755 --- a/plugins/MacAU/Air/Air.h +++ b/plugins/MacAU/Air/Air.h @@ -164,12 +164,7 @@ public: Float64 tripletC; Float64 tripletFactor; int count; - - - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; - + long double fpNShape; }; }; diff --git a/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.pbxuser index 2af057b..3a436a8 100755 --- a/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.pbxuser @@ -49,34 +49,34 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528421060; - PBXWorkspaceStateSaveDate = 528421060; + PBXPerProjectTemplateStateSaveDate = 569588293; + PBXWorkspaceStateSaveDate = 569588293; }; perUserProjectItems = { - 8B9D72161F7EFB8B007AB60F /* PBXTextBookmark */ = 8B9D72161F7EFB8B007AB60F /* PBXTextBookmark */; - 8B9D72A71F7F10F4007AB60F /* PBXTextBookmark */ = 8B9D72A71F7F10F4007AB60F /* PBXTextBookmark */; + 8B79276221F33AB6006E9731 /* PBXTextBookmark */ = 8B79276221F33AB6006E9731 /* PBXTextBookmark */; + 8B79276821F33AE6006E9731 /* PBXTextBookmark */ = 8B79276821F33AE6006E9731 /* PBXTextBookmark */; 8B9F0C261EB403E000D3B900 /* PBXTextBookmark */ = 8B9F0C261EB403E000D3B900 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D72161F7EFB8B007AB60F /* PBXTextBookmark */ = { + 8B79276221F33AB6006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Air.cpp */; - name = "Air.cpp: 397"; + name = "Air.cpp: 394"; rLen = 0; - rLoc = 15339; + rLoc = 15189; rType = 0; - vrLen = 94; - vrLoc = 14078; + vrLen = 0; + vrLoc = 0; }; - 8B9D72A71F7F10F4007AB60F /* PBXTextBookmark */ = { + 8B79276821F33AE6006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Air.cpp */; - name = "Air.cpp: 398"; + name = "Air.cpp: 389"; rLen = 0; - rLoc = 15339; + rLoc = 15189; rType = 0; vrLen = 0; vrLoc = 0; @@ -86,17 +86,17 @@ fRef = 8BC6025B073B072D006C4272 /* Air.h */; name = "Air.h: 169"; rLen = 0; - rLoc = 6210; + rLoc = 6204; rType = 0; vrLen = 107; vrLoc = 6071; }; 8BA05A660720730100365D66 /* Air.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 5512}}"; - sepNavSelRange = "{15339, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 5421}}"; + sepNavSelRange = "{15189, 0}"; sepNavVisRange = "{0, 0}"; - sepNavWindowFrame = "{{255, 66}, {1145, 812}}"; + sepNavWindowFrame = "{{152, 66}, {1145, 812}}"; }; }; 8BA05A690720730100365D66 /* AirVersion.h */ = { @@ -109,10 +109,10 @@ }; 8BC6025B073B072D006C4272 /* Air.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {656, 2574}}"; - sepNavSelRange = "{6210, 0}"; - sepNavVisRange = "{6071, 107}"; - sepNavWindowFrame = "{{505, 39}, {1053, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {1006, 2483}}"; + sepNavSelRange = "{6190, 0}"; + sepNavVisRange = "{5126, 1198}"; + sepNavWindowFrame = "{{387, 39}, {1053, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.perspectivev3 index f7348cf..c4d0cd5 100755 --- a/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Air/Air.xcodeproj/christopherjohnson.perspectivev3 @@ -352,11 +352,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D72A71F7F10F4007AB60F</string> + <string>8B79276821F33AE6006E9731</string> <key>history</key> <array> <string>8B9F0C261EB403E000D3B900</string> - <string>8B9D72161F7EFB8B007AB60F</string> + <string>8B79276221F33AB6006E9731</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>484 346 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>484 346 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, 328}}</string> + <string>{{10, 27}, {603, 401}}</string> + <key>RubberWindowFrame</key> + <string>484 346 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +479,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D72A81F7F10F4007AB60F</string> + <string>8B79276921F33AE6006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D72A91F7F10F4007AB60F</string> + <string>8B79276A21F33AE6006E9731</string> <string>8BDB25A91EAA638A001F42B2</string> - <string>8B9D72AA1F7F10F4007AB60F</string> + <string>8B79276B21F33AE6006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +636,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528421108.41774899</real> + <real>569588454.36706197</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,7 +653,7 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D72AB1F7F10F4007AB60F</string> + <string>8B79276C21F33AE6006E9731</string> <string>/Users/christopherjohnson/Desktop/MacAU/Air/Air.xcodeproj</string> </array> <key>WindowString</key> |