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/ToVinyl4 | |
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/ToVinyl4')
4 files changed, 67 insertions, 81 deletions
diff --git a/plugins/MacAU/ToVinyl4/ToVinyl4.cpp b/plugins/MacAU/ToVinyl4/ToVinyl4.cpp index 0f7f248..3f0d6e4 100755 --- a/plugins/MacAU/ToVinyl4/ToVinyl4.cpp +++ b/plugins/MacAU/ToVinyl4/ToVinyl4.cpp @@ -270,11 +270,8 @@ ComponentResult ToVinyl4::Reset(AudioUnitScope inScope, AudioUnitElement inElem s1R = s2R = s3R = 0.0; o1R = o2R = o3R = 0.0; m1R = m2R = desR = 0.0; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; return noErr; @@ -295,11 +292,7 @@ OSStatus ToVinyl4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag UInt32 nSampleFrames = inFramesToProcess; Float64 overallscale = 1.0; overallscale /= 44100.0; - overallscale *= GetSampleRate(); - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; - + overallscale *= GetSampleRate(); Float64 fusswithscale = 50000; //corrected Float64 cutofffreq = GetParameter( kParam_One ); Float64 resonance = 0.992; @@ -741,25 +734,14 @@ OSStatus ToVinyl4::ProcessBufferLists(AudioUnitRenderActionFlags & ioActionFlag inputSampleR = accumulatorSample; //we just re-use accumulatorSample to do this little shuffle - //noise shaping to 32-bit floating point - if (fpFlip) { - 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; - } - 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/ToVinyl4/ToVinyl4.h b/plugins/MacAU/ToVinyl4/ToVinyl4.h index 31495f3..7e613b7 100755 --- a/plugins/MacAU/ToVinyl4/ToVinyl4.h +++ b/plugins/MacAU/ToVinyl4/ToVinyl4.h @@ -209,13 +209,8 @@ private: Float64 aSidePrev; Float64 bMidPrev; Float64 bSidePrev; - - Float64 fpNShapeAL; - Float64 fpNShapeAR; - Float64 fpNShapeBL; - Float64 fpNShapeBR; - bool fpFlip; - + Float64 fpNShapeR; + Float64 fpNShapeL; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.pbxuser index a31ab0c..1fee72e 100755 --- a/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.pbxuser @@ -10,7 +10,7 @@ PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; PBXFileTableDataSourceColumnWidthsKey = ( 20, - 364, + 410, 20, 48, 43, @@ -49,42 +49,53 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 541893053; - PBXWorkspaceStateSaveDate = 541893053; + PBXPerProjectTemplateStateSaveDate = 569685344; + PBXWorkspaceStateSaveDate = 569685344; }; perUserProjectItems = { - 8B181B5D204CA28100516BEE /* PBXTextBookmark */ = 8B181B5D204CA28100516BEE /* PBXTextBookmark */; - 8B181B5E204CA28100516BEE /* PBXTextBookmark */ = 8B181B5E204CA28100516BEE /* PBXTextBookmark */; + 8B7931C221F4B60F006E9731 /* PBXTextBookmark */ = 8B7931C221F4B60F006E9731 /* PBXTextBookmark */; + 8B7931C421F4B60F006E9731 /* PBXTextBookmark */ = 8B7931C421F4B60F006E9731 /* PBXTextBookmark */; + 8B7931C921F4B651006E9731 /* PBXTextBookmark */ = 8B7931C921F4B651006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B181B5D204CA28100516BEE /* PBXTextBookmark */ = { + 8B7931C221F4B60F006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BC6025B073B072D006C4272 /* ToVinyl4.h */; + name = "ToVinyl4.h: 211"; + rLen = 0; + rLoc = 6757; + rType = 0; + vrLen = 390; + vrLoc = 6513; + }; + 8B7931C421F4B60F006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* ToVinyl4.cpp */; - name = "ToVinyl4.cpp: 428"; + name = "ToVinyl4.cpp: 745"; rLen = 0; - rLoc = 16809; + rLoc = 32669; rType = 0; - vrLen = 91; - vrLoc = 43; + vrLen = 985; + vrLoc = 31849; }; - 8B181B5E204CA28100516BEE /* PBXTextBookmark */ = { + 8B7931C921F4B651006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* ToVinyl4.cpp */; - name = "ToVinyl4.cpp: 428"; + name = "ToVinyl4.cpp: 745"; rLen = 0; - rLoc = 16809; + rLoc = 32669; rType = 0; - vrLen = 91; - vrLoc = 43; + vrLen = 1451; + vrLoc = 19373; }; 8BA05A660720730100365D66 /* ToVinyl4.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {803, 10166}}"; - sepNavSelRange = "{16809, 0}"; - sepNavVisRange = "{43, 91}"; + sepNavIntBoundsRect = "{{0, 0}, {782, 9386}}"; + sepNavSelRange = "{32669, 0}"; + sepNavVisRange = "{19373, 1451}"; sepNavWindowFrame = "{{627, 62}, {981, 816}}"; }; }; @@ -106,9 +117,9 @@ }; 8BC6025B073B072D006C4272 /* ToVinyl4.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {934, 2899}}"; - sepNavSelRange = "{5133, 22}"; - sepNavVisRange = "{5920, 1044}"; + sepNavIntBoundsRect = "{{0, 0}, {656, 3250}}"; + sepNavSelRange = "{6757, 0}"; + sepNavVisRange = "{6513, 390}"; sepNavWindowFrame = "{{459, 62}, {981, 816}}"; }; }; diff --git a/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.perspectivev3 index 64c9c61..2bfe30e 100755 --- a/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/ToVinyl4/ToVinyl4.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>-1</integer> - <integer>-1</integer> + <integer>856</integer> + <integer>856</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> @@ -308,7 +306,7 @@ </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {185, 428}}</string> + <string>{{0, 0}, {185, 635}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -318,14 +316,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {202, 446}}</string> + <string>{{0, 0}, {202, 653}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> <real>185</real> </array> <key>RubberWindowFrame</key> - <string>608 328 810 487 0 0 1440 878 </string> + <string>373 142 856 694 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -353,10 +351,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B181B5E204CA28100516BEE</string> + <string>8B7931C921F4B651006E9731</string> <key>history</key> <array> - <string>8B181B5D204CA28100516BEE</string> + <string>8B7931C221F4B60F006E9731</string> + <string>8B7931C421F4B60F006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 86}}</string> + <string>{{0, 0}, {649, 490}}</string> <key>RubberWindowFrame</key> - <string>608 328 810 487 0 0 1440 878 </string> + <string>373 142 856 694 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>86pt</string> + <string>490pt</string> </dict> <dict> <key>Proportion</key> - <string>355pt</string> + <string>158pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 328}}</string> - <key>RubberWindowFrame</key> - <string>608 328 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {649, 131}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 345}}</string> + <string>{{10, 27}, {649, 131}}</string> + <key>RubberWindowFrame</key> + <string>373 142 856 694 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -460,7 +459,7 @@ </dict> </array> <key>Proportion</key> - <string>603pt</string> + <string>649pt</string> </dict> </array> <key>Name</key> @@ -479,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B181B5F204CA28100516BEE</string> + <string>8B7931CA21F4B651006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B181B60204CA28100516BEE</string> + <string>8B7931CB21F4B651006E9731</string> <string>8B277E7C1FDB48610038EA07</string> - <string>8B181B61204CA28100516BEE</string> + <string>8B7931CC21F4B651006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>541893249.61319196</real> + <real>569685585.11167395</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,11 +652,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B181B62204CA28100516BEE</string> <string>/Users/christopherjohnson/Desktop/MacAU/ToVinyl4/ToVinyl4.xcodeproj</string> </array> <key>WindowString</key> - <string>608 328 810 487 0 0 1440 878 </string> + <string>373 142 856 694 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |