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/Point | |
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/Point')
-rwxr-xr-x | plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.pbxuser | 26 | ||||
-rwxr-xr-x | plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.perspectivev3 | 29 | ||||
-rwxr-xr-x | plugins/MacVST/Point/source/Point.cpp | 6 | ||||
-rwxr-xr-x | plugins/MacVST/Point/source/Point.h | 6 | ||||
-rwxr-xr-x | plugins/MacVST/Point/source/PointProc.cpp | 64 |
5 files changed, 51 insertions, 80 deletions
diff --git a/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.pbxuser index 1e91a67..5dc4070 100755 --- a/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.pbxuser @@ -51,11 +51,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528461517; - PBXWorkspaceStateSaveDate = 528461517; + PBXPerProjectTemplateStateSaveDate = 569770893; + PBXWorkspaceStateSaveDate = 569770893; }; perUserProjectItems = { - 8B9D6EEE1F7EF3E2007AB60F /* PBXTextBookmark */ = 8B9D6EEE1F7EF3E2007AB60F /* PBXTextBookmark */; + 8B793DE421F603B1006E9731 /* PBXTextBookmark */ = 8B793DE421F603B1006E9731 /* PBXTextBookmark */; 8B9D7CCC1F7FAEE4007AB60F /* PBXTextBookmark */ = 8B9D7CCC1F7FAEE4007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -64,17 +64,17 @@ }; 2407DEB6089929BA00EB68BF /* Point.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1924}}"; - sepNavSelRange = "{4284, 0}"; - sepNavVisRange = "{3036, 2173}"; - sepNavWindowFrame = "{{63, 36}, {895, 831}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 1963}}"; + sepNavSelRange = "{618, 0}"; + sepNavVisRange = "{0, 1832}"; + sepNavWindowFrame = "{{63, 39}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Point.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 949}}"; - sepNavSelRange = "{2638, 0}"; - sepNavVisRange = "{268, 2297}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 988}}"; + sepNavSelRange = "{2450, 0}"; + sepNavVisRange = "{389, 2251}"; sepNavWindowFrame = "{{8, 41}, {895, 831}}"; }; }; @@ -88,7 +88,7 @@ }; 24D8286F09A914000093AEF8 /* PointProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 4030}}"; + sepNavIntBoundsRect = "{{0, 0}, {670, 3783}}"; sepNavSelRange = "{5732, 0}"; sepNavVisRange = "{0, 0}"; sepNavWindowFrame = "{{458, 47}, {895, 831}}"; @@ -108,10 +108,10 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6EEE1F7EF3E2007AB60F /* PBXTextBookmark */ = { + 8B793DE421F603B1006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* PointProc.cpp */; - name = "PointProc.cpp: 187"; + name = "PointProc.cpp: 181"; rLen = 0; rLoc = 5732; rType = 0; diff --git a/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.perspectivev3 index f8109c7..384a575 100755 --- a/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Point/Point.xcodeproj/christopherjohnson.perspectivev3 @@ -300,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>6</integer> + <integer>5</integer> <integer>4</integer> <integer>0</integer> </array> @@ -351,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D7CCC1F7FAEE4007AB60F</string> + <string>8B793DE421F603B1006E9731</string> <key>history</key> <array> - <string>8B9D6EEE1F7EF3E2007AB60F</string> + <string>8B9D7CCC1F7FAEE4007AB60F</string> </array> </dict> <key>SplitCount</key> @@ -368,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 13}}</string> + <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> <string>304 344 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>13pt</string> + <string>0pt</string> </dict> <dict> <key>Proportion</key> - <string>428pt</string> + <string>441pt</string> <key>Tabs</key> <array> <dict> @@ -393,9 +393,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 401}}</string> - <key>RubberWindowFrame</key> - <string>304 344 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 414}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -449,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 363}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>304 344 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7CCD1F7FAEE4007AB60F</string> + <string>8B793DE521F603B1006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7CCE1F7FAEE4007AB60F</string> + <string>8B793DE621F603B1006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7CCF1F7FAEE4007AB60F</string> + <string>8B793DE721F603B1006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -654,7 +654,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528461540.135059</real> + <real>569770929.49119902</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -671,7 +671,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7CD01F7FAEE4007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/Point/Point.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/Point/source/Point.cpp b/plugins/MacVST/Point/source/Point.cpp index 22885b5..f795470 100755 --- a/plugins/MacVST/Point/source/Point.cpp +++ b/plugins/MacVST/Point/source/Point.cpp @@ -24,10 +24,8 @@ Point::Point(audioMasterCallback audioMaster) : nibBR = 0.0; nobBR = 0.0; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; fpFlip = true; //this is reset: values being initialized only once. Startup values, whatever they are. diff --git a/plugins/MacVST/Point/source/Point.h b/plugins/MacVST/Point/source/Point.h index 12c8001..ff898cb 100755 --- a/plugins/MacVST/Point/source/Point.h +++ b/plugins/MacVST/Point/source/Point.h @@ -54,10 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; + long double fpNShapeL; + long double fpNShapeR; bool fpFlip; //default stuff double nibAL; diff --git a/plugins/MacVST/Point/source/PointProc.cpp b/plugins/MacVST/Point/source/PointProc.cpp index a00263d..a3bbe3c 100755 --- a/plugins/MacVST/Point/source/PointProc.cpp +++ b/plugins/MacVST/Point/source/PointProc.cpp @@ -27,9 +27,6 @@ void Point::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra double nibnobFactor = 0.0; //start with the fallthrough value, why not double absolute; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -128,26 +125,16 @@ void Point::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra } } inputSampleR *= nibnobFactor; - - //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; @@ -179,9 +166,6 @@ void Point::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s double nibnobFactor = 0.0; //start with the fallthrough value, why not double absolute; - 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; @@ -280,26 +264,18 @@ void Point::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s } } inputSampleR *= nibnobFactor; - - //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; |