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/Distance2 | |
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/Distance2')
3 files changed, 59 insertions, 68 deletions
diff --git a/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.pbxuser index 2fb0369..8e41741 100755 --- a/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 547768347; - PBXWorkspaceStateSaveDate = 547768347; + PBXPerProjectTemplateStateSaveDate = 569734535; + PBXWorkspaceStateSaveDate = 569734535; }; perUserProjectItems = { - 8B7E3D4B20A6500200482CB5 /* PBXBookmark */ = 8B7E3D4B20A6500200482CB5 /* PBXBookmark */; - 8B7E3D5420A6501D00482CB5 /* XCBuildMessageTextBookmark */ = 8B7E3D5420A6501D00482CB5 /* XCBuildMessageTextBookmark */; + 8B79383921F57592006E9731 /* PBXTextBookmark */ = 8B79383921F57592006E9731 /* PBXTextBookmark */; + 8B79383D21F57592006E9731 /* PBXTextBookmark */ = 8B79383D21F57592006E9731 /* PBXTextBookmark */; 8B7E3D5520A6501D00482CB5 /* PBXTextBookmark */ = 8B7E3D5520A6501D00482CB5 /* PBXTextBookmark */; 8B7E3D5B20A6501D00482CB5 /* PBXTextBookmark */ = 8B7E3D5B20A6501D00482CB5 /* PBXTextBookmark */; }; @@ -80,15 +80,15 @@ }; 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {838, 19747}}"; + sepNavIntBoundsRect = "{{0, 0}, {838, 19877}}"; sepNavSelRange = "{10616, 0}"; - sepNavVisRange = "{10459, 399}"; + sepNavVisRange = "{10459, 280}"; sepNavWindowFrame = "{{15, 42}, {895, 831}}"; }; }; 24D8286F09A914000093AEF8 /* Distance2Proc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 7605}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 7371}}"; sepNavSelRange = "{21129, 0}"; sepNavVisRange = "{8249, 1763}"; sepNavWindowFrame = "{{0, 47}, {895, 831}}"; @@ -108,18 +108,25 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B7E3D4B20A6500200482CB5 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 24D8286F09A914000093AEF8 /* Distance2Proc.cpp */; - }; - 8B7E3D5420A6501D00482CB5 /* XCBuildMessageTextBookmark */ = { + 8B79383921F57592006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - comments = "Deprecated conversion from string constant to 'char*'"; fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; - fallbackIsa = XCBuildMessageTextBookmark; - rLen = 1; - rLoc = 306; - rType = 1; + name = "audioeffectx.cpp: 307"; + rLen = 0; + rLoc = 10616; + rType = 0; + vrLen = 280; + vrLoc = 10459; + }; + 8B79383D21F57592006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24D8286F09A914000093AEF8 /* Distance2Proc.cpp */; + name = "Distance2Proc.cpp: 553"; + rLen = 0; + rLoc = 21129; + rType = 0; + vrLen = 1763; + vrLoc = 8249; }; 8B7E3D5520A6501D00482CB5 /* PBXTextBookmark */ = { isa = PBXTextBookmark; diff --git a/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.perspectivev3 index 0268d65..7b0ef13 100755 --- a/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Distance2/Distance2.xcodeproj/christopherjohnson.perspectivev3 @@ -241,10 +241,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B7E3D5B20A6501D00482CB5</string> + <string>8B79383D21F57592006E9731</string> <key>history</key> <array> - <string>8B7E3D4B20A6500200482CB5</string> + <string>8B7E3D5B20A6501D00482CB5</string> </array> </dict> <key>SplitCount</key> @@ -297,6 +297,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -390,10 +392,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B7E3D5520A6501D00482CB5</string> + <string>8B79383921F57592006E9731</string> <key>history</key> <array> - <string>8B7E3D5420A6501D00482CB5</string> + <string>8B7E3D5520A6501D00482CB5</string> </array> </dict> <key>SplitCount</key> @@ -407,18 +409,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 132}}</string> + <string>{{0, 0}, {603, 117}}</string> <key>RubberWindowFrame</key> <string>20 288 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> @@ -432,7 +434,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 297}}</string> + <key>RubberWindowFrame</key> + <string>20 288 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -487,8 +491,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 282}}</string> - <key>RubberWindowFrame</key> - <string>20 288 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -516,11 +518,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B7E3D5620A6501D00482CB5</string> + <string>8B79383A21F57592006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B7E3D5720A6501D00482CB5</string> + <string>8B79383B21F57592006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B7E3D5820A6501D00482CB5</string> + <string>8B79383C21F57592006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -673,7 +675,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>547770397.97323096</real> + <real>569734546.43575704</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -691,7 +693,7 @@ <key>WindowOrderList</key> <array> <string>8B7E3D5920A6501D00482CB5</string> - <string>/Users/christopherjohnson/Desktop/Distance2/Distance2.xcodeproj</string> + <string>/Users/christopherjohnson/Desktop/MacVST/Distance2/Distance2.xcodeproj</string> </array> <key>WindowString</key> <string>20 288 810 487 0 0 1440 878 </string> diff --git a/plugins/MacVST/Distance2/source/Distance2Proc.cpp b/plugins/MacVST/Distance2/source/Distance2Proc.cpp index ef5bf5b..473f3c8 100755 --- a/plugins/MacVST/Distance2/source/Distance2Proc.cpp +++ b/plugins/MacVST/Distance2/source/Distance2Proc.cpp @@ -266,18 +266,14 @@ void Distance2::processReplacing(float **inputs, float **outputs, VstInt32 sampl inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //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; @@ -287,12 +283,6 @@ void Distance2::processReplacing(float **inputs, float **outputs, VstInt32 sampl *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } void Distance2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -554,18 +544,16 @@ void Distance2::processDoubleReplacing(double **inputs, double **outputs, VstInt inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp = inputSampleL; - fpNShapeL += (inputSampleL-fpTemp); - inputSampleL += fpNShapeL; - //if this confuses you look at the wordlength for fpTemp :) - fpTemp = inputSampleR; - fpNShapeR += (inputSampleR-fpTemp); - inputSampleR += fpNShapeR; - //for deeper space and warmth, we try a non-oscillating noise shaping - //that is kind of ruthless: it will forever retain the rounding errors - //except we'll dial it back a hair at the end of every buffer processed - //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; @@ -575,10 +563,4 @@ void Distance2::processDoubleReplacing(double **inputs, double **outputs, VstInt *out1++; *out2++; } - fpNShapeL *= 0.999999; - fpNShapeR *= 0.999999; - //we will just delicately dial back the FP noise shaping, not even every sample - //this is a good place to put subtle 'no runaway' calculations, though bear in mind - //that it will be called more often when you use shorter sample buffers in the DAW. - //So, very low latency operation will call these calculations more often. } |