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/BitGlitter | |
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/BitGlitter')
5 files changed, 51 insertions, 24 deletions
diff --git a/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.pbxuser index 04c5006..eadf6da 100755 --- a/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.pbxuser @@ -51,8 +51,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 553994307; - PBXWorkspaceStateSaveDate = 553994307; + PBXPerProjectTemplateStateSaveDate = 569718310; + PBXWorkspaceStateSaveDate = 569718310; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -60,17 +60,17 @@ }; 2407DEB6089929BA00EB68BF /* BitGlitter.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 2249}}"; - sepNavSelRange = "{842, 0}"; - sepNavVisRange = "{1388, 1919}"; - sepNavWindowFrame = "{{891, 27}, {895, 831}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 2158}}"; + sepNavSelRange = "{533, 0}"; + sepNavVisRange = "{0, 1600}"; + sepNavWindowFrame = "{{333, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* BitGlitter.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 1118}}"; - sepNavSelRange = "{2943, 0}"; - sepNavVisRange = "{652, 2357}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 1157}}"; + sepNavSelRange = "{2511, 0}"; + sepNavVisRange = "{652, 2399}"; sepNavWindowFrame = "{{20, 47}, {895, 831}}"; }; }; @@ -84,10 +84,10 @@ }; 24D8286F09A914000093AEF8 /* BitGlitterProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 5200}}"; - sepNavSelRange = "{7162, 0}"; - sepNavVisRange = "{6302, 1605}"; - sepNavWindowFrame = "{{37, 33}, {895, 831}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 5902}}"; + sepNavSelRange = "{13421, 0}"; + sepNavVisRange = "{11871, 1722}"; + sepNavWindowFrame = "{{169, 47}, {895, 831}}"; }; }; 8B02375E1D42B1C400E1E8C8 /* Source Control */ = { diff --git a/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.perspectivev3 index 9b744d3..b2c5d8c 100755 --- a/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/BitGlitter/BitGlitter.xcodeproj/christopherjohnson.perspectivev3 @@ -256,6 +256,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -298,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>5</integer> + <integer>6</integer> <integer>4</integer> <integer>0</integer> </array> @@ -321,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>129 148 810 487 0 0 1440 878 </string> + <string>144 271 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -360,7 +362,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>129 148 810 487 0 0 1440 878 </string> + <string>144 271 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -384,6 +386,8 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>144 271 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -438,8 +442,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>129 148 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -467,11 +469,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BBD19152105484B0015A233</string> + <string>8B79347521F5371F006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BBD19162105484B0015A233</string> + <string>8B79347621F5371F006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8BBD19172105484B0015A233</string> + <string>8B79347721F5371F006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -644,7 +646,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>553998201.254879</real> + <real>569718559.741974</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -661,10 +663,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>/Users/christopherjohnson/Desktop/BitGlitter/BitGlitter.xcodeproj</string> + <string>/Users/christopherjohnson/Desktop/MacVST/BitGlitter/BitGlitter.xcodeproj</string> </array> <key>WindowString</key> - <string>129 148 810 487 0 0 1440 878 </string> + <string>144 271 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/BitGlitter/source/BitGlitter.cpp b/plugins/MacVST/BitGlitter/source/BitGlitter.cpp index 7e9cfdb..a1e1a9b 100755 --- a/plugins/MacVST/BitGlitter/source/BitGlitter.cpp +++ b/plugins/MacVST/BitGlitter/source/BitGlitter.cpp @@ -17,6 +17,9 @@ BitGlitter::BitGlitter(audioMasterCallback audioMaster) : C = 0.5; D = 1.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; + ataLastSampleL = 0.0; ataHalfwaySampleL = 0.0; lastSampleL = 0.0; diff --git a/plugins/MacVST/BitGlitter/source/BitGlitter.h b/plugins/MacVST/BitGlitter/source/BitGlitter.h index d87e277..4f108cd 100755 --- a/plugins/MacVST/BitGlitter/source/BitGlitter.h +++ b/plugins/MacVST/BitGlitter/source/BitGlitter.h @@ -55,6 +55,9 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; + long double fpNShapeL; + long double fpNShapeR; + double ataLastSampleL; double ataHalfwaySampleL; double ataDrySampleL; diff --git a/plugins/MacVST/BitGlitter/source/BitGlitterProc.cpp b/plugins/MacVST/BitGlitter/source/BitGlitterProc.cpp index 321d0b6..ff2968c 100755 --- a/plugins/MacVST/BitGlitter/source/BitGlitterProc.cpp +++ b/plugins/MacVST/BitGlitter/source/BitGlitterProc.cpp @@ -202,6 +202,14 @@ void BitGlitter::processReplacing(float **inputs, float **outputs, VstInt32 samp outputSampleL = (drySampleL * (1.0-wet)) + (outputSampleL * wet); outputSampleR = (drySampleR * (1.0-wet)) + (outputSampleR * wet); } + //stereo 32 bit dither, made small and tidy. + int expon; frexpf((float)outputSampleL, &expon); + long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + outputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexpf((float)outputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + outputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 32 bit dither *out1 = outputSampleL; *out2 = outputSampleR; @@ -408,6 +416,17 @@ void BitGlitter::processDoubleReplacing(double **inputs, double **outputs, VstIn outputSampleR = (drySampleR * (1.0-wet)) + (outputSampleR * wet); } + //stereo 64 bit dither, made small and tidy. + int expon; frexp((double)outputSampleL, &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 + outputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + frexp((double)outputSampleR, &expon); + dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); + dither /= 536870912.0; //needs this to scale to 64 bit zone + outputSampleR += (dither-fpNShapeR); fpNShapeR = dither; + //end 64 bit dither + *out1 = outputSampleL; *out2 = outputSampleR; |