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/Logical4 | |
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/Logical4')
4 files changed, 39 insertions, 87 deletions
diff --git a/plugins/MacAU/Logical4/Logical4.cpp b/plugins/MacAU/Logical4/Logical4.cpp index 32e4312..af228c2 100755 --- a/plugins/MacAU/Logical4/Logical4.cpp +++ b/plugins/MacAU/Logical4/Logical4.cpp @@ -267,10 +267,9 @@ ComponentResult Logical4::Reset(AudioUnitScope inScope, AudioUnitElement inElem gcount = 0; //end Power Sags - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; return noErr; } @@ -293,16 +292,16 @@ OSStatus Logical4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag Float64 overallscale = 1.0; overallscale /= 44100.0; overallscale *= GetSampleRate(); - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; UInt32 nSampleFrames = inFramesToProcess; Float32 drySampleL; Float32 drySampleR; - Float64 inputSampleL; - Float64 inputSampleR; - + long double inputSampleL; + long double inputSampleR; + + long double fpOld = 0.618033988749894848204586; //golden ratio! + long double fpNew = 1.0 - fpOld; + //begin ButterComp Float64 inputpos; Float64 inputneg; @@ -1145,26 +1144,16 @@ OSStatus Logical4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = drySampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((drySampleL-fpTemp)*fpNew); - drySampleL += fpNShapeAL; - fpTemp = drySampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((drySampleR-fpTemp)*fpNew); - drySampleR += fpNShapeAR; - } - else { - fpTemp = drySampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((drySampleL-fpTemp)*fpNew); - drySampleL += fpNShapeBL; - fpTemp = drySampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((drySampleR-fpTemp)*fpNew); - drySampleR += fpNShapeBR; - } fpFlip = !fpFlip; - //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/Logical4/Logical4.h b/plugins/MacAU/Logical4/Logical4.h index 269fb08..31b3c1a 100755 --- a/plugins/MacAU/Logical4/Logical4.h +++ b/plugins/MacAU/Logical4/Logical4.h @@ -210,10 +210,8 @@ private: int gcount; - Float64 fpNShapeAL; - Float64 fpNShapeAR; - Float64 fpNShapeBL; - Float64 fpNShapeBR; + long double fpNShapeR; + long double fpNShapeL; bool fpFlip; }; diff --git a/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser index aeec156..7396e6c 100755 --- a/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser @@ -49,43 +49,19 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528456690; - PBXWorkspaceStateSaveDate = 528456690; - }; - perUserProjectItems = { - 8B9D65761F7C8A4B007AB60F /* PBXTextBookmark */ = 8B9D65761F7C8A4B007AB60F /* PBXTextBookmark */; - 8B9D74C31F7F9C65007AB60F /* PBXTextBookmark */ = 8B9D74C31F7F9C65007AB60F /* PBXTextBookmark */; + PBXPerProjectTemplateStateSaveDate = 569649914; + PBXWorkspaceStateSaveDate = 569649914; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B9D65761F7C8A4B007AB60F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BC6025B073B072D006C4272 /* Logical4.h */; - name = "Logical4.h: 65"; - rLen = 0; - rLoc = 3218; - rType = 0; - vrLen = 0; - vrLoc = 0; - }; - 8B9D74C31F7F9C65007AB60F /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BC6025B073B072D006C4272 /* Logical4.h */; - name = "Logical4.h: 65"; - rLen = 0; - rLoc = 3218; - rType = 0; - vrLen = 0; - vrLoc = 0; - }; 8BA05A660720730100365D66 /* Logical4.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1156, 15431}}"; - sepNavSelRange = "{14451, 0}"; - sepNavVisRange = "{14181, 2352}"; - sepNavWindowFrame = "{{237, 42}, {1203, 836}}"; + sepNavIntBoundsRect = "{{0, 0}, {1156, 15860}}"; + sepNavSelRange = "{11365, 0}"; + sepNavVisRange = "{10694, 1692}"; + sepNavWindowFrame = "{{85, 42}, {1203, 836}}"; }; }; 8BA05A690720730100365D66 /* Logical4Version.h */ = { @@ -98,10 +74,10 @@ }; 8BC6025B073B072D006C4272 /* Logical4.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 2925}}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 2912}}"; sepNavSelRange = "{3218, 0}"; sepNavVisRange = "{0, 0}"; - sepNavWindowFrame = "{{767, -61}, {932, 815}}"; + sepNavWindowFrame = "{{508, 39}, {932, 815}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 index 2664542..65ca7eb 100755 --- a/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 @@ -325,7 +325,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>630 344 810 487 0 0 1440 878 </string> + <string>489 322 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -341,23 +341,13 @@ <key>PBXProjectModuleGUID</key> <string>8BAC22EC1F1EA26E009C635C</string> <key>PBXProjectModuleLabel</key> - <string>Logical4.h</string> + <string><No Editor></string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> <dict> <key>PBXProjectModuleGUID</key> <string>8BAC22ED1F1EA26E009C635C</string> - <key>PBXProjectModuleLabel</key> - <string>Logical4.h</string> - <key>_historyCapacity</key> - <integer>0</integer> - <key>bookmark</key> - <string>8B9D74C31F7F9C65007AB60F</string> - <key>history</key> - <array> - <string>8B9D65761F7C8A4B007AB60F</string> - </array> </dict> <key>SplitCount</key> <string>1</string> @@ -372,7 +362,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>630 344 810 487 0 0 1440 878 </string> + <string>489 322 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -396,8 +386,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>630 344 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +439,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 363}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>489 322 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +469,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D74C41F7F9C65007AB60F</string> + <string>8B792DC121F42BF4006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D74C51F7F9C65007AB60F</string> + <string>8B792DC221F42BF4006E9731</string> <string>8BAC22EC1F1EA26E009C635C</string> - <string>8B9D74C61F7F9C65007AB60F</string> + <string>8B792DC321F42BF4006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +626,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528456805.22078699</real> + <real>569650164.73212397</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,11 +643,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D74C71F7F9C65007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/Logical4/Logical4.xcodeproj</string> </array> <key>WindowString</key> - <string>630 344 810 487 0 0 1440 878 </string> + <string>489 322 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |