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/Hombre | |
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/Hombre')
-rwxr-xr-x | plugins/MacAU/Hombre/Hombre.cpp | 31 | ||||
-rwxr-xr-x | plugins/MacAU/Hombre/Hombre.h | 4 | ||||
-rwxr-xr-x | plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.pbxuser | 24 | ||||
-rwxr-xr-x | plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.perspectivev3 | 27 |
4 files changed, 32 insertions, 54 deletions
diff --git a/plugins/MacAU/Hombre/Hombre.cpp b/plugins/MacAU/Hombre/Hombre.cpp index d16d992..420afa5 100755 --- a/plugins/MacAU/Hombre/Hombre.cpp +++ b/plugins/MacAU/Hombre/Hombre.cpp @@ -169,9 +169,7 @@ void Hombre::HombreKernel::Reset() for(int count = 0; count < 4000; count++) {p[count] = 0.0;} gcount = 0; slide = 0.421; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -196,15 +194,10 @@ void Hombre::HombreKernel::Process( const Float32 *inSourceP, int widthB = (int)(7.0*overallscale); //max 364 at 44.1, 792 at 96K Float64 wet = GetParameter( kParam_Two ); Float64 dry = 1.0 - wet; - long double inputSample; Float64 drySample; Float64 total; - int count; - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + int count; while (nSampleFrames-- > 0) { inputSample = *sourceP; @@ -273,23 +266,13 @@ void Hombre::HombreKernel::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; - //built in output trim and dry/wet if desired - //*destP = inputSample; sourceP += inNumChannels; destP += inNumChannels; } diff --git a/plugins/MacAU/Hombre/Hombre.h b/plugins/MacAU/Hombre/Hombre.h index fd408c3..0f2225b 100755 --- a/plugins/MacAU/Hombre/Hombre.h +++ b/plugins/MacAU/Hombre/Hombre.h @@ -131,9 +131,7 @@ public: Float64 p[4001]; Float64 slide; int gcount; - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.pbxuser index 5ff61b8..31f4928 100755 --- a/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,18 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528456614; - PBXWorkspaceStateSaveDate = 528456614; + PBXPerProjectTemplateStateSaveDate = 569649376; + PBXWorkspaceStateSaveDate = 569649376; }; perUserProjectItems = { - 8B9D65431F7C899F007AB60F /* PBXTextBookmark */ = 8B9D65431F7C899F007AB60F /* PBXTextBookmark */; + 8B792D7F21F4297F006E9731 /* PBXTextBookmark */ = 8B792D7F21F4297F006E9731 /* PBXTextBookmark */; 8B9D74961F7F9BB0007AB60F /* PBXTextBookmark */ = 8B9D74961F7F9BB0007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D65431F7C899F007AB60F /* PBXTextBookmark */ = { + 8B792D7F21F4297F006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A670720730100365D66 /* Hombre.exp */; name = "Hombre.exp: 2"; @@ -82,10 +82,10 @@ }; 8BA05A660720730100365D66 /* Hombre.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1098, 3900}}"; - sepNavSelRange = "{9060, 0}"; - sepNavVisRange = "{8861, 2038}"; - sepNavWindowFrame = "{{295, 66}, {1145, 812}}"; + sepNavIntBoundsRect = "{{0, 0}, {1098, 3913}}"; + sepNavSelRange = "{11704, 0}"; + sepNavVisRange = "{10307, 1458}"; + sepNavWindowFrame = "{{165, 66}, {1145, 812}}"; }; }; 8BA05A670720730100365D66 /* Hombre.exp */ = { @@ -106,10 +106,10 @@ }; 8BC6025B073B072D006C4272 /* Hombre.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {958, 1859}}"; - sepNavSelRange = "{5132, 0}"; - sepNavVisRange = "{3790, 1531}"; - sepNavWindowFrame = "{{809, 39}, {1005, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {958, 1833}}"; + sepNavSelRange = "{5170, 0}"; + sepNavVisRange = "{3685, 1595}"; + sepNavWindowFrame = "{{111, 39}, {1005, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.perspectivev3 index 6c54c7c..794a8fd 100755 --- a/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Hombre/Hombre.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -324,7 +322,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>630 297 810 487 0 0 1440 878 </string> + <string>455 313 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,10 +350,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D74961F7F9BB0007AB60F</string> + <string>8B792D7F21F4297F006E9731</string> <key>history</key> <array> - <string>8B9D65431F7C899F007AB60F</string> + <string>8B9D74961F7F9BB0007AB60F</string> </array> </dict> <key>SplitCount</key> @@ -371,7 +369,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>630 297 810 487 0 0 1440 878 </string> + <string>455 313 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -395,8 +393,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>630 297 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -450,7 +446,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 328}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>455 313 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -478,11 +476,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D74971F7F9BB0007AB60F</string> + <string>8B792D7221F428E1006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D74981F7F9BB0007AB60F</string> + <string>8B792D7321F428E1006E9731</string> <string>8BAC23231F1EA3AC009C635C</string> - <string>8B9D74991F7F9BB0007AB60F</string> + <string>8B792D7421F428E1006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +633,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528456624.78481799</real> + <real>569649535.57319403</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,11 +650,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D749A1F7F9BB0007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/Hombre/Hombre.xcodeproj</string> </array> <key>WindowString</key> - <string>630 297 810 487 0 0 1440 878 </string> + <string>455 313 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |