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/AtmosphereBuss | |
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/AtmosphereBuss')
3 files changed, 44 insertions, 64 deletions
diff --git a/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.pbxuser index e6a5761..5640742 100755 --- a/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 546567340; - PBXWorkspaceStateSaveDate = 546567340; + PBXPerProjectTemplateStateSaveDate = 569718087; + PBXWorkspaceStateSaveDate = 569718087; }; perUserProjectItems = { + 8B7933A421F53550006E9731 /* PBXTextBookmark */ = 8B7933A421F53550006E9731 /* PBXTextBookmark */; 8BC5CF342093F49F0058B257 /* PBXTextBookmark */ = 8BC5CF342093F49F0058B257 /* PBXTextBookmark */; - 8BC5CF692093F4CF0058B257 /* PBXTextBookmark */ = 8BC5CF692093F4CF0058B257 /* PBXTextBookmark */; 8BC5CF6A2093F4CF0058B257 /* PBXTextBookmark */ = 8BC5CF6A2093F4CF0058B257 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -87,9 +87,9 @@ }; 24D8286F09A914000093AEF8 /* AtmosphereBussProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {670, 7397}}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 6929}}"; sepNavSelRange = "{13569, 0}"; - sepNavVisRange = "{1515, 154}"; + sepNavVisRange = "{1538, 131}"; sepNavWindowFrame = "{{15, 47}, {895, 831}}"; }; }; @@ -107,6 +107,16 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; + 8B7933A421F53550006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24D8286F09A914000093AEF8 /* AtmosphereBussProc.cpp */; + name = "AtmosphereBussProc.cpp: 378"; + rLen = 0; + rLoc = 13569; + rType = 0; + vrLen = 131; + vrLoc = 1538; + }; 8BC5CF342093F49F0058B257 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 2407DEB6089929BA00EB68BF /* AtmosphereBuss.cpp */; @@ -117,16 +127,6 @@ vrLen = 421; vrLoc = 2085; }; - 8BC5CF692093F4CF0058B257 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 24D8286F09A914000093AEF8 /* AtmosphereBussProc.cpp */; - name = "AtmosphereBussProc.cpp: 379"; - rLen = 0; - rLoc = 13569; - rType = 0; - vrLen = 154; - vrLoc = 1515; - }; 8BC5CF6A2093F4CF0058B257 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* AtmosphereBussProc.cpp */; diff --git a/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.perspectivev3 index 9bbfe98..16bcc2b 100755 --- a/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj/christopherjohnson.perspectivev3 @@ -349,11 +349,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BC5CF6A2093F4CF0058B257</string> + <string>8B7933A421F53550006E9731</string> <key>history</key> <array> <string>8BC5CF342093F49F0058B257</string> - <string>8BC5CF692093F4CF0058B257</string> + <string>8BC5CF6A2093F4CF0058B257</string> </array> </dict> <key>SplitCount</key> @@ -367,18 +367,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 117}}</string> + <string>{{0, 0}, {603, 102}}</string> <key>RubberWindowFrame</key> <string>11 221 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>117pt</string> + <string>102pt</string> </dict> <dict> <key>Proportion</key> - <string>324pt</string> + <string>339pt</string> <key>Tabs</key> <array> <dict> @@ -394,7 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 297}}</string> + <string>{{10, 27}, {603, 312}}</string> <key>RubberWindowFrame</key> <string>11 221 810 487 0 0 1440 878 </string> </dict> @@ -478,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BC5CF6B2093F4CF0058B257</string> + <string>8B7933A521F53550006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BC5CF6C2093F4CF0058B257</string> + <string>8B7933A621F53550006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8BC5CF6D2093F4CF0058B257</string> + <string>8B7933A721F53550006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>546567375.58979297</real> + <real>569718096.20929098</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,7 +652,7 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>/Users/christopherjohnson/Desktop/AtmosphereBuss/AtmosphereBuss.xcodeproj</string> + <string>/Users/christopherjohnson/Desktop/MacVST/AtmosphereBuss/AtmosphereBuss.xcodeproj</string> </array> <key>WindowString</key> <string>11 221 810 487 0 0 1440 878 </string> diff --git a/plugins/MacVST/AtmosphereBuss/source/AtmosphereBussProc.cpp b/plugins/MacVST/AtmosphereBuss/source/AtmosphereBussProc.cpp index 6530a7e..16d7a31 100755 --- a/plugins/MacVST/AtmosphereBuss/source/AtmosphereBussProc.cpp +++ b/plugins/MacVST/AtmosphereBuss/source/AtmosphereBussProc.cpp @@ -13,7 +13,6 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32 float* in2 = inputs[1]; float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); @@ -250,18 +249,14 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32 lastSampleAR = drySampleR; //store the raw R input sample again for use next time - //noise shaping to 32-bit floating point - 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; @@ -271,12 +266,6 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32 *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 AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) @@ -285,7 +274,6 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V double* in2 = inputs[1]; double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); @@ -522,18 +510,16 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V lastSampleAR = drySampleR; //store the raw R input sample again for use next time - //noise shaping to 64-bit floating point - 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; @@ -543,10 +529,4 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V *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. }
\ No newline at end of file |