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/CStrip | |
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/CStrip')
5 files changed, 46 insertions, 76 deletions
diff --git a/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser index 6f086f0..84d9838 100755 --- a/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser @@ -49,13 +49,13 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 541888518; - PBXWorkspaceStateSaveDate = 541888518; + PBXPerProjectTemplateStateSaveDate = 569734170; + PBXWorkspaceStateSaveDate = 569734170; }; perUserProjectItems = { 8B181AD0204C900D00516BEE /* PBXTextBookmark */ = 8B181AD0204C900D00516BEE /* PBXTextBookmark */; 8B181AEB204C93FE00516BEE /* PBXTextBookmark */ = 8B181AEB204C93FE00516BEE /* PBXTextBookmark */; - 8B8E3C051FC2409000F10C24 /* PBXTextBookmark */ = 8B8E3C051FC2409000F10C24 /* PBXTextBookmark */; + 8B79373621F57427006E9731 /* PBXTextBookmark */ = 8B79373621F57427006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -87,9 +87,9 @@ }; 24D8286F09A914000093AEF8 /* CStripProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {761, 19695}}"; + sepNavIntBoundsRect = "{{0, 0}, {635, 19565}}"; sepNavSelRange = "{27530, 0}"; - sepNavVisRange = "{6438, 114}"; + sepNavVisRange = "{6540, 22}"; sepNavWindowFrame = "{{533, 46}, {895, 831}}"; }; }; @@ -127,15 +127,15 @@ vrLen = 114; vrLoc = 6438; }; - 8B8E3C051FC2409000F10C24 /* PBXTextBookmark */ = { + 8B79373621F57427006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* CStripProc.cpp */; - name = "CStripProc.cpp: 139"; + name = "CStripProc.cpp: 761"; rLen = 0; rLoc = 27530; rType = 0; - vrLen = 436; - vrLoc = 6443; + vrLen = 22; + vrLoc = 6540; }; 8D01CCC60486CAD60068D4B7 /* CStrip */ = { activeExec = 0; diff --git a/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3 index d37c29c..90086a5 100755 --- a/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3 @@ -323,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>628 335 810 487 0 0 1440 878 </string> + <string>568 285 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -351,11 +351,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B181AEB204C93FE00516BEE</string> + <string>8B79373621F57427006E9731</string> <key>history</key> <array> <string>8B181AD0204C900D00516BEE</string> - <string>8B8E3C051FC2409000F10C24</string> + <string>8B181AEB204C93FE00516BEE</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 69}}</string> + <string>{{0, 0}, {603, 51}}</string> <key>RubberWindowFrame</key> - <string>628 335 810 487 0 0 1440 878 </string> + <string>568 285 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>69pt</string> + <string>51pt</string> </dict> <dict> <key>Proportion</key> - <string>372pt</string> + <string>390pt</string> <key>Tabs</key> <array> <dict> @@ -394,9 +394,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 345}}</string> + <string>{{10, 27}, {603, 363}}</string> <key>RubberWindowFrame</key> - <string>628 335 810 487 0 0 1440 878 </string> + <string>568 285 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -478,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B181AD2204C900D00516BEE</string> + <string>8B79373721F57427006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B181AD3204C900D00516BEE</string> + <string>8B79373821F57427006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B181AD4204C900D00516BEE</string> + <string>8B79373921F57427006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>541889534.51824105</real> + <real>569734183.18676102</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -655,7 +655,7 @@ <string>/Users/christopherjohnson/Desktop/MacVST/CStrip/CStrip.xcodeproj</string> </array> <key>WindowString</key> - <string>628 335 810 487 0 0 1440 878 </string> + <string>568 285 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/CStrip/source/CStrip.cpp b/plugins/MacVST/CStrip/source/CStrip.cpp index 1c24d1b..2049ab8 100755 --- a/plugins/MacVST/CStrip/source/CStrip.cpp +++ b/plugins/MacVST/CStrip/source/CStrip.cpp @@ -153,11 +153,8 @@ CStrip::CStrip(audioMasterCallback audioMaster) : nvgRA = nvgRB = 0.0; //end ButterComp - 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/CStrip/source/CStrip.h b/plugins/MacVST/CStrip/source/CStrip.h index 10f6729..cc9f722 100755 --- a/plugins/MacVST/CStrip/source/CStrip.h +++ b/plugins/MacVST/CStrip/source/CStrip.h @@ -63,11 +63,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 lastSampleL; diff --git a/plugins/MacVST/CStrip/source/CStripProc.cpp b/plugins/MacVST/CStrip/source/CStripProc.cpp index 272b9b6..60ce59c 100755 --- a/plugins/MacVST/CStrip/source/CStripProc.cpp +++ b/plugins/MacVST/CStrip/source/CStripProc.cpp @@ -20,10 +20,8 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - float fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - + long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -728,25 +726,14 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr inputSampleR *= outputgain; } - //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; @@ -771,10 +758,8 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32 overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - double fpTemp; long double fpOld = 0.618033988749894848204586; //golden ratio! long double fpNew = 1.0 - fpOld; - long double inputSampleL; long double inputSampleR; @@ -1479,25 +1464,16 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32 inputSampleR *= outputgain; } - //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; |