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/MacVST/Distance | |
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/MacVST/Distance')
5 files changed, 74 insertions, 89 deletions
diff --git a/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.pbxuser index 35d1267..f25d8b8 100755 --- a/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,14 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528460155; - PBXWorkspaceStateSaveDate = 528460155; + PBXPerProjectTemplateStateSaveDate = 569734484; + PBXWorkspaceStateSaveDate = 569734484; }; perUserProjectItems = { - 8B9D6B631F7EE05F007AB60F /* PBXTextBookmark */ = 8B9D6B631F7EE05F007AB60F /* PBXTextBookmark */; - 8B9D79701F7FA98F007AB60F /* PBXTextBookmark */ = 8B9D79701F7FA98F007AB60F /* PBXTextBookmark */; + 8B79381621F5756D006E9731 /* PBXTextBookmark */ = 8B79381621F5756D006E9731 /* PBXTextBookmark */; + 8B79381721F5756D006E9731 /* PBXTextBookmark */ = 8B79381721F5756D006E9731 /* PBXTextBookmark */; + 8B79381821F5756D006E9731 /* PBXBookmark */ = 8B79381821F5756D006E9731 /* PBXBookmark */; + 8B79381921F5756D006E9731 /* PBXTextBookmark */ = 8B79381921F5756D006E9731 /* PBXTextBookmark */; 8BD79BE91DB421CA006FFA16 /* PBXTextBookmark */ = 8BD79BE91DB421CA006FFA16 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -63,17 +65,17 @@ }; 2407DEB6089929BA00EB68BF /* Distance.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1729}}"; + sepNavIntBoundsRect = "{{0, 0}, {740, 1664}}"; sepNavSelRange = "{460, 0}"; - sepNavVisRange = "{0, 2083}"; + sepNavVisRange = "{0, 650}"; sepNavWindowFrame = "{{12, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Distance.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 1274}}"; - sepNavSelRange = "{2777, 0}"; - sepNavVisRange = "{2448, 79}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 1027}}"; + sepNavSelRange = "{2723, 0}"; + sepNavVisRange = "{509, 1342}"; sepNavWindowFrame = "{{20, 47}, {895, 831}}"; }; }; @@ -87,9 +89,9 @@ }; 24D8286F09A914000093AEF8 /* DistanceProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 3939}}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 3562}}"; sepNavSelRange = "{7303, 0}"; - sepNavVisRange = "{812, 2313}"; + sepNavVisRange = "{8890, 722}"; sepNavWindowFrame = "{{266, 47}, {895, 831}}"; }; }; @@ -107,25 +109,39 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6B631F7EE05F007AB60F /* PBXTextBookmark */ = { + 8B79381621F5756D006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 245463B80991757100464AD3 /* Distance.h */; - name = "Distance.h: 78"; + name = "Distance.h: 79"; rLen = 0; - rLoc = 2777; + rLoc = 2723; rType = 0; - vrLen = 96; - vrLoc = 2431; + vrLen = 1342; + vrLoc = 509; }; - 8B9D79701F7FA98F007AB60F /* PBXTextBookmark */ = { + 8B79381721F5756D006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 245463B80991757100464AD3 /* Distance.h */; - name = "Distance.h: 78"; + fRef = 2407DEB6089929BA00EB68BF /* Distance.cpp */; + name = "Distance.cpp: 16"; + rLen = 0; + rLoc = 460; + rType = 0; + vrLen = 650; + vrLoc = 0; + }; + 8B79381821F5756D006E9731 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 24D8286F09A914000093AEF8 /* DistanceProc.cpp */; + }; + 8B79381921F5756D006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24D8286F09A914000093AEF8 /* DistanceProc.cpp */; + name = "DistanceProc.cpp: 203"; rLen = 0; - rLoc = 2777; + rLoc = 7303; rType = 0; - vrLen = 79; - vrLoc = 2448; + vrLen = 722; + vrLoc = 8890; }; 8BD79BE91DB421CA006FFA16 /* PBXTextBookmark */ = { isa = PBXTextBookmark; diff --git a/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.perspectivev3 index 6450494..5df581a 100755 --- a/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Distance/Distance.xcodeproj/christopherjohnson.perspectivev3 @@ -339,7 +339,7 @@ <key>PBXProjectModuleGUID</key> <string>8B0237581D42B1C400E1E8C8</string> <key>PBXProjectModuleLabel</key> - <string>Distance.h</string> + <string>DistanceProc.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -347,15 +347,17 @@ <key>PBXProjectModuleGUID</key> <string>8B0237591D42B1C400E1E8C8</string> <key>PBXProjectModuleLabel</key> - <string>Distance.h</string> + <string>DistanceProc.cpp</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D79701F7FA98F007AB60F</string> + <string>8B79381921F5756D006E9731</string> <key>history</key> <array> <string>8BD79BE91DB421CA006FFA16</string> - <string>8B9D6B631F7EE05F007AB60F</string> + <string>8B79381621F5756D006E9731</string> + <string>8B79381721F5756D006E9731</string> + <string>8B79381821F5756D006E9731</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +371,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 86}}</string> + <string>{{0, 0}, {603, 281}}</string> <key>RubberWindowFrame</key> <string>518 304 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>86pt</string> + <string>281pt</string> </dict> <dict> <key>Proportion</key> - <string>355pt</string> + <string>160pt</string> <key>Tabs</key> <array> <dict> @@ -394,7 +396,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 328}}</string> + <string>{{10, 27}, {603, 133}}</string> <key>RubberWindowFrame</key> <string>518 304 810 487 0 0 1440 878 </string> </dict> @@ -478,11 +480,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D79711F7FA98F007AB60F</string> + <string>8B79381A21F5756D006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D79721F7FA98F007AB60F</string> + <string>8B79381B21F5756D006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D79731F7FA98F007AB60F</string> + <string>8B79381C21F5756D006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +637,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528460175.35196102</real> + <real>569734509.28240097</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,7 +654,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D79741F7FA98F007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/Distance/Distance.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/Distance/source/Distance.cpp b/plugins/MacVST/Distance/source/Distance.cpp index bae55c1..7ccd8fb 100755 --- a/plugins/MacVST/Distance/source/Distance.cpp +++ b/plugins/MacVST/Distance/source/Distance.cpp @@ -16,11 +16,8 @@ Distance::Distance(audioMasterCallback audioMaster) : B = 1.0; thirdresultL = prevresultL = lastclampL = clampL = changeL = lastL = 0.0; thirdresultR = prevresultR = lastclampR = clampR = changeR = lastR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + fpNShapeL = 0.0; + fpNShapeR = 0.0; //this is reset: values being initialized only once. Startup values, whatever they are. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. diff --git a/plugins/MacVST/Distance/source/Distance.h b/plugins/MacVST/Distance/source/Distance.h index 52ecc14..5566f84 100755 --- a/plugins/MacVST/Distance/source/Distance.h +++ b/plugins/MacVST/Distance/source/Distance.h @@ -67,11 +67,8 @@ private: double prevresultR; double lastR; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/MacVST/Distance/source/DistanceProc.cpp b/plugins/MacVST/Distance/source/DistanceProc.cpp index bdf3c13..32eb3fa 100755 --- a/plugins/MacVST/Distance/source/DistanceProc.cpp +++ b/plugins/MacVST/Distance/source/DistanceProc.cpp @@ -28,9 +28,6 @@ void Distance::processReplacing(float **inputs, float **outputs, VstInt32 sample double dry = 1.0-wet; double bridgerectifier; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double drySampleL; @@ -126,25 +123,14 @@ void Distance::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (drySampleR * dry)+(inputSampleR*wet); } - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = inputSampleL; *out2 = inputSampleR; @@ -177,9 +163,6 @@ void Distance::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double dry = 1.0-wet; double bridgerectifier; - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; long double drySampleL; @@ -275,25 +258,16 @@ void Distance::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (drySampleR * dry)+(inputSampleR*wet); } - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = inputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLA; - fpTemp = inputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRA; - } - else { - fpTemp = inputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeLB; - fpTemp = inputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)inputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)inputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = inputSampleL; *out2 = inputSampleR; |