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/Wider | |
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/Wider')
-rwxr-xr-x | plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.pbxuser | 30 | ||||
-rwxr-xr-x | plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.perspectivev3 | 20 | ||||
-rwxr-xr-x | plugins/MacVST/Wider/source/Wider.cpp | 7 | ||||
-rwxr-xr-x | plugins/MacVST/Wider/source/Wider.h | 7 | ||||
-rwxr-xr-x | plugins/MacVST/Wider/source/WiderProc.cpp | 62 |
5 files changed, 47 insertions, 79 deletions
diff --git a/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.pbxuser index 83caea6..5391b9e 100755 --- a/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 546573996; - PBXWorkspaceStateSaveDate = 546573996; + PBXPerProjectTemplateStateSaveDate = 569773559; + PBXWorkspaceStateSaveDate = 569773559; }; perUserProjectItems = { + 8B79430B21F60E03006E9731 /* PBXTextBookmark */ = 8B79430B21F60E03006E9731 /* PBXTextBookmark */; 8BC5D04620940E2D0058B257 /* PBXTextBookmark */ = 8BC5D04620940E2D0058B257 /* PBXTextBookmark */; - 8BC5D07D20940F320058B257 /* PBXTextBookmark */ = 8BC5D07D20940F320058B257 /* PBXTextBookmark */; 8BC5D07E20940F320058B257 /* PBXTextBookmark */ = 8BC5D07E20940F320058B257 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -87,9 +87,9 @@ }; 24D8286F09A914000093AEF8 /* WiderProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {852, 4394}}"; + sepNavIntBoundsRect = "{{0, 0}, {691, 3926}}"; sepNavSelRange = "{7057, 0}"; - sepNavVisRange = "{6953, 155}"; + sepNavVisRange = "{6846, 405}"; sepNavWindowFrame = "{{11, 47}, {895, 831}}"; }; }; @@ -107,6 +107,16 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; + 8B79430B21F60E03006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24D8286F09A914000093AEF8 /* WiderProc.cpp */; + name = "WiderProc.cpp: 203"; + rLen = 0; + rLoc = 7057; + rType = 0; + vrLen = 405; + vrLoc = 6846; + }; 8BC5D04620940E2D0058B257 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; @@ -117,16 +127,6 @@ vrLen = 280; vrLoc = 10459; }; - 8BC5D07D20940F320058B257 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 24D8286F09A914000093AEF8 /* WiderProc.cpp */; - name = "WiderProc.cpp: 209"; - rLen = 0; - rLoc = 7057; - rType = 0; - vrLen = 155; - vrLoc = 6953; - }; 8BC5D07E20940F320058B257 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* WiderProc.cpp */; diff --git a/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.perspectivev3 index 733a26c..f44db5a 100755 --- a/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Wider/Wider.xcodeproj/christopherjohnson.perspectivev3 @@ -351,11 +351,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BC5D07E20940F320058B257</string> + <string>8B79430B21F60E03006E9731</string> <key>history</key> <array> <string>8BC5D04620940E2D0058B257</string> - <string>8BC5D07D20940F320058B257</string> + <string>8BC5D07E20940F320058B257</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 102}}</string> + <string>{{0, 0}, {603, 86}}</string> <key>RubberWindowFrame</key> <string>29 317 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>102pt</string> + <string>86pt</string> </dict> <dict> <key>Proportion</key> - <string>339pt</string> + <string>355pt</string> <key>Tabs</key> <array> <dict> @@ -394,7 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 312}}</string> + <string>{{10, 27}, {603, 328}}</string> <key>RubberWindowFrame</key> <string>29 317 810 487 0 0 1440 878 </string> </dict> @@ -478,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BC5D07F20940F320058B257</string> + <string>8B79430C21F60E03006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BC5D08020940F320058B257</string> + <string>8B79430D21F60E03006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8BC5D08120940F320058B257</string> + <string>8B79430E21F60E03006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>546574130.26758397</real> + <real>569773571.22399402</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> diff --git a/plugins/MacVST/Wider/source/Wider.cpp b/plugins/MacVST/Wider/source/Wider.cpp index c1e57d0..26d4d47 100755 --- a/plugins/MacVST/Wider/source/Wider.cpp +++ b/plugins/MacVST/Wider/source/Wider.cpp @@ -17,11 +17,8 @@ Wider::Wider(audioMasterCallback audioMaster) : C = 1.0; for(int fcount = 0; fcount < 4098; fcount++) {p[fcount] = 0.0;} count = 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/Wider/source/Wider.h b/plugins/MacVST/Wider/source/Wider.h index 8b04cfb..6a6a2df 100755 --- a/plugins/MacVST/Wider/source/Wider.h +++ b/plugins/MacVST/Wider/source/Wider.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff double p[4099]; diff --git a/plugins/MacVST/Wider/source/WiderProc.cpp b/plugins/MacVST/Wider/source/WiderProc.cpp index 618e651..f90fa21 100755 --- a/plugins/MacVST/Wider/source/WiderProc.cpp +++ b/plugins/MacVST/Wider/source/WiderProc.cpp @@ -17,9 +17,6 @@ void Wider::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -141,25 +138,14 @@ void Wider::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra inputSampleL = (drySampleL * dry) + ((mid+side) * wet); inputSampleR = (drySampleR * dry) + ((mid-side) * 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; @@ -181,9 +167,6 @@ void Wider::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -305,25 +288,16 @@ void Wider::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s inputSampleL = (drySampleL * dry) + ((mid+side) * wet); inputSampleR = (drySampleR * dry) + ((mid-side) * 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; |