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/EdIsDim | |
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/EdIsDim')
5 files changed, 36 insertions, 69 deletions
diff --git a/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser index 594376e..83c37d0 100755 --- a/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.pbxuser @@ -49,11 +49,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528460458; - PBXWorkspaceStateSaveDate = 528460458; + PBXPerProjectTemplateStateSaveDate = 569735013; + PBXWorkspaceStateSaveDate = 569735013; }; perUserProjectItems = { - 8B9D6BE11F7EE521007AB60F /* PBXTextBookmark */ = 8B9D6BE11F7EE521007AB60F /* PBXTextBookmark */; + 8B79398121F57771006E9731 /* PBXTextBookmark */ = 8B79398121F57771006E9731 /* PBXTextBookmark */; 8B9D79F01F7FAAB9007AB60F /* PBXTextBookmark */ = 8B9D79F01F7FAAB9007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -106,7 +106,7 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6BE11F7EE521007AB60F /* PBXTextBookmark */ = { + 8B79398121F57771006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; name = "audioeffectx.cpp: 307"; diff --git a/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3 index cf4c5fa..0d8290a 100755 --- a/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/EdIsDim/EdIsDim.xcodeproj/christopherjohnson.perspectivev3 @@ -323,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>108 310 810 487 0 0 1440 878 </string> + <string>267 298 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>8B9D79F01F7FAAB9007AB60F</string> + <string>8B79398121F57771006E9731</string> <key>history</key> <array> - <string>8B9D6BE11F7EE521007AB60F</string> + <string>8B9D79F01F7FAAB9007AB60F</string> </array> </dict> <key>SplitCount</key> @@ -370,7 +370,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>108 310 810 487 0 0 1440 878 </string> + <string>267 298 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -395,7 +395,7 @@ <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> <key>RubberWindowFrame</key> - <string>108 310 810 487 0 0 1440 878 </string> + <string>267 298 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D79F11F7FAAB9007AB60F</string> + <string>8B79398221F57771006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D79F21F7FAAB9007AB60F</string> + <string>8B79398321F57771006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D79F31F7FAAB9007AB60F</string> + <string>8B79398421F57771006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -634,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528460473.03459197</real> + <real>569735025.80681503</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -651,11 +651,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D79F41F7FAAB9007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/EdIsDim/EdIsDim.xcodeproj</string> </array> <key>WindowString</key> - <string>108 310 810 487 0 0 1440 878 </string> + <string>267 298 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/EdIsDim/source/EdIsDim.cpp b/plugins/MacVST/EdIsDim/source/EdIsDim.cpp index 6af5dd4..eb6abd3 100755 --- a/plugins/MacVST/EdIsDim/source/EdIsDim.cpp +++ b/plugins/MacVST/EdIsDim/source/EdIsDim.cpp @@ -13,11 +13,8 @@ EdIsDim::EdIsDim(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { A = 0.5; - 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/EdIsDim/source/EdIsDim.h b/plugins/MacVST/EdIsDim/source/EdIsDim.h index 8c51883..4f62705 100755 --- a/plugins/MacVST/EdIsDim/source/EdIsDim.h +++ b/plugins/MacVST/EdIsDim/source/EdIsDim.h @@ -52,11 +52,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 float A; diff --git a/plugins/MacVST/EdIsDim/source/EdIsDimProc.cpp b/plugins/MacVST/EdIsDim/source/EdIsDimProc.cpp index 8ee927d..0d033eb 100755 --- a/plugins/MacVST/EdIsDim/source/EdIsDimProc.cpp +++ b/plugins/MacVST/EdIsDim/source/EdIsDimProc.cpp @@ -14,9 +14,6 @@ void EdIsDim::processReplacing(float **inputs, float **outputs, VstInt32 sampleF float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -75,25 +72,14 @@ void EdIsDim::processReplacing(float **inputs, float **outputs, VstInt32 sampleF mid = (inputSampleL+inputSampleR)/2.0; side = (inputSampleL-inputSampleR)/2.0; - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = mid; - fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLA; - fpTemp = side; - fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRA; - } - else { - fpTemp = mid; - fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLB; - fpTemp = side; - fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 bit output + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)mid, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + mid += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)side, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + side += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = mid; *out2 = side; @@ -112,9 +98,6 @@ void EdIsDim::processDoubleReplacing(double **inputs, double **outputs, VstInt32 double* out1 = outputs[0]; double* out2 = outputs[1]; - 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; @@ -174,25 +157,16 @@ void EdIsDim::processDoubleReplacing(double **inputs, double **outputs, VstInt32 mid = (inputSampleL+inputSampleR)/2.0; side = (inputSampleL-inputSampleR)/2.0; - //noise shaping to 64-bit floating point - if (fpFlip) { - fpTemp = mid; - fpNShapeLA = (fpNShapeLA*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLA; - fpTemp = side; - fpNShapeRA = (fpNShapeRA*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRA; - } - else { - fpTemp = mid; - fpNShapeLB = (fpNShapeLB*fpOld)+((mid-fpTemp)*fpNew); - mid += fpNShapeLB; - fpTemp = side; - fpNShapeRB = (fpNShapeRB*fpOld)+((side-fpTemp)*fpNew); - side += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 64 bit output + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)mid, &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 + mid += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)side, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + side += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither *out1 = mid; *out2 = side; |