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/BussColors4 | |
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/BussColors4')
5 files changed, 47 insertions, 94 deletions
diff --git a/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.pbxuser index 874e77e..56965b2 100755 --- a/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.pbxuser @@ -49,11 +49,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 553995952; - PBXWorkspaceStateSaveDate = 553995952; + PBXPerProjectTemplateStateSaveDate = 569718632; + PBXWorkspaceStateSaveDate = 569718632; }; perUserProjectItems = { - 8BBD1972210550260015A233 /* PBXTextBookmark */ = 8BBD1972210550260015A233 /* PBXTextBookmark */; + 8B7934BC21F53792006E9731 /* PBXTextBookmark */ = 8B7934BC21F53792006E9731 /* PBXTextBookmark */; 8BBD1973210550260015A233 /* PBXTextBookmark */ = 8BBD1973210550260015A233 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -62,9 +62,9 @@ }; 2407DEB6089929BA00EB68BF /* BussColors4.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {747, 2613}}"; + sepNavIntBoundsRect = "{{0, 0}, {747, 2392}}"; sepNavSelRange = "{6740, 15}"; - sepNavVisRange = "{44, 192}"; + sepNavVisRange = "{44, 191}"; sepNavWindowFrame = "{{545, 42}, {895, 831}}"; }; }; @@ -86,10 +86,10 @@ }; 24D8286F09A914000093AEF8 /* BussColors4Proc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 22958}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 21840}}"; sepNavSelRange = "{2156, 16}"; - sepNavVisRange = "{2297, 2204}"; - sepNavWindowFrame = "{{529, 47}, {895, 831}}"; + sepNavVisRange = "{114530, 2497}"; + sepNavWindowFrame = "{{399, 47}, {895, 831}}"; }; }; 8B02375E1D42B1C400E1E8C8 /* Source Control */ = { @@ -106,14 +106,14 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8BBD1972210550260015A233 /* PBXTextBookmark */ = { + 8B7934BC21F53792006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2407DEB6089929BA00EB68BF /* BussColors4.cpp */; name = "BussColors4.cpp: 167"; rLen = 15; rLoc = 6740; rType = 0; - vrLen = 328; + vrLen = 191; vrLoc = 44; }; 8BBD1973210550260015A233 /* PBXTextBookmark */ = { diff --git a/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.perspectivev3 index dff2c57..38ff207 100755 --- a/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/BussColors4/BussColors4.xcodeproj/christopherjohnson.perspectivev3 @@ -323,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>567 362 810 487 0 0 1440 878 </string> + <string>567 361 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -351,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BBD1973210550260015A233</string> + <string>8B7934BC21F53792006E9731</string> <key>history</key> <array> - <string>8BBD1972210550260015A233</string> + <string>8BBD1973210550260015A233</string> </array> </dict> <key>SplitCount</key> @@ -368,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 132}}</string> + <string>{{0, 0}, {603, 117}}</string> <key>RubberWindowFrame</key> - <string>567 362 810 487 0 0 1440 878 </string> + <string>567 361 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>132pt</string> + <string>117pt</string> </dict> <dict> <key>Proportion</key> - <string>309pt</string> + <string>324pt</string> <key>Tabs</key> <array> <dict> @@ -393,9 +393,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 282}}</string> + <string>{{10, 27}, {603, 297}}</string> <key>RubberWindowFrame</key> - <string>567 362 810 487 0 0 1440 878 </string> + <string>567 361 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BBD1974210550260015A233</string> + <string>8B7934AA21F5376C006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BBD1975210550260015A233</string> + <string>8B7934AB21F5376C006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8BBD1976210550260015A233</string> + <string>8B7934AC21F5376C006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -634,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>553996326.29762602</real> + <real>569718674.56684196</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -651,11 +651,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8BBD1977210550260015A233</string> + <string>8B7934BD21F53792006E9731</string> <string>/Users/christopherjohnson/Desktop/MacVST/BussColors4/BussColors4.xcodeproj</string> </array> <key>WindowString</key> - <string>567 362 810 487 0 0 1440 878 </string> + <string>567 361 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/BussColors4/source/BussColors4.cpp b/plugins/MacVST/BussColors4/source/BussColors4.cpp index 720dbf9..c7de380 100755 --- a/plugins/MacVST/BussColors4/source/BussColors4.cpp +++ b/plugins/MacVST/BussColors4/source/BussColors4.cpp @@ -44,11 +44,8 @@ BussColors4::BussColors4(audioMasterCallback audioMaster) : slowdynR = 0; gcount = 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. @@ -114,21 +111,6 @@ void BussColors4::setParameter(VstInt32 index, float value) { case kParamD: D = value; break; //this is the popup, stored as a float default: throw; // unknown parameter, shouldn't happen! } - //we can also set other defaults here, and do calculations that only have to happen - //once when parameters actually change. Here is the 'popup' setting its (global) values. - //variables can also be set in the processreplacing loop, and there they'll be set every buffersize - //here they're set when a parameter's actually changed, which should be less frequent, but - //you must use global variables in the BussColors4.h file to do it. - switch((VstInt32)( D * 3.999 )) - { - case 0: fpFlip = true; break; //choice A - case 1: fpFlip = false; break; //choice B - case 2: break; //choice C - case 3: break; //choice D - default: break; //should not happen - } - //this relates to using D as a 'popup' and changing things based on that switch. - //we are using fpFlip just because it's already there globally, as an example. } float BussColors4::getParameter(VstInt32 index) { diff --git a/plugins/MacVST/BussColors4/source/BussColors4.h b/plugins/MacVST/BussColors4/source/BussColors4.h index d07460e..6452555 100755 --- a/plugins/MacVST/BussColors4/source/BussColors4.h +++ b/plugins/MacVST/BussColors4/source/BussColors4.h @@ -68,11 +68,8 @@ private: double slowdynR; int gcount; - 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/BussColors4/source/BussColors4Proc.cpp b/plugins/MacVST/BussColors4/source/BussColors4Proc.cpp index 2629ee8..b1b9451 100755 --- a/plugins/MacVST/BussColors4/source/BussColors4Proc.cpp +++ b/plugins/MacVST/BussColors4/source/BussColors4Proc.cpp @@ -31,9 +31,6 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam double gain = 0.436; double outgain = 1.0; double bridgerectifier; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -795,25 +792,14 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //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; @@ -849,9 +835,6 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI double gain = 0.436; double outgain = 1.0; double bridgerectifier; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -1613,25 +1596,16 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //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; |