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/Sidepass | |
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/Sidepass')
5 files changed, 46 insertions, 75 deletions
diff --git a/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.pbxuser index 12ff98b..92e6c81 100755 --- a/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.pbxuser @@ -49,11 +49,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528461783; - PBXWorkspaceStateSaveDate = 528461783; + PBXPerProjectTemplateStateSaveDate = 569771653; + PBXWorkspaceStateSaveDate = 569771653; }; perUserProjectItems = { - 8B9D6FCC1F7EF6A6007AB60F /* PBXTextBookmark */ = 8B9D6FCC1F7EF6A6007AB60F /* PBXTextBookmark */; + 8B793F8921F606AF006E9731 /* PBXTextBookmark */ = 8B793F8921F606AF006E9731 /* PBXTextBookmark */; 8B9D7DB21F7FB00A007AB60F /* PBXTextBookmark */ = 8B9D7DB21F7FB00A007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -62,17 +62,17 @@ }; 2407DEB6089929BA00EB68BF /* Sidepass.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1625}}"; - sepNavSelRange = "{3758, 0}"; - sepNavVisRange = "{173, 2048}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 1599}}"; + sepNavSelRange = "{542, 0}"; + sepNavVisRange = "{173, 2011}"; sepNavWindowFrame = "{{12, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Sidepass.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 897}}"; - sepNavSelRange = "{2409, 0}"; - sepNavVisRange = "{329, 2248}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 871}}"; + sepNavSelRange = "{2482, 0}"; + sepNavVisRange = "{313, 2212}"; sepNavWindowFrame = "{{20, 47}, {895, 831}}"; }; }; @@ -86,7 +86,7 @@ }; 24D8286F09A914000093AEF8 /* SidepassProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 2977}}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 2613}}"; sepNavSelRange = "{6779, 0}"; sepNavVisRange = "{0, 0}"; sepNavWindowFrame = "{{425, 47}, {895, 831}}"; @@ -106,10 +106,10 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6FCC1F7EF6A6007AB60F /* PBXTextBookmark */ = { + 8B793F8921F606AF006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* SidepassProc.cpp */; - name = "SidepassProc.cpp: 199"; + name = "SidepassProc.cpp: 190"; rLen = 0; rLoc = 6779; rType = 0; diff --git a/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.perspectivev3 index b4e2cb8..bc5c2b8 100755 --- a/plugins/MacVST/Sidepass/Sidepass.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Sidepass/Sidepass.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>8B9D7DB21F7FB00A007AB60F</string> + <string>8B793F8921F606AF006E9731</string> <key>history</key> <array> - <string>8B9D6FCC1F7EF6A6007AB60F</string> + <string>8B9D7DB21F7FB00A007AB60F</string> </array> </dict> <key>SplitCount</key> @@ -394,8 +394,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>376 351 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -449,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 382}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>376 351 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7DB31F7FB00A007AB60F</string> + <string>8B793F8A21F606AF006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7DB41F7FB00A007AB60F</string> + <string>8B793F8B21F606AF006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7DB51F7FB00A007AB60F</string> + <string>8B793F8C21F606AF006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -634,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528461834.34984702</real> + <real>569771695.78669202</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -651,7 +651,8 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7DB61F7FB00A007AB60F</string> + <string>8B793F8D21F606AF006E9731</string> + <string>8B793F8E21F606AF006E9731</string> <string>/Users/christopherjohnson/Desktop/MacVST/Sidepass/Sidepass.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/Sidepass/source/Sidepass.cpp b/plugins/MacVST/Sidepass/source/Sidepass.cpp index 98f6f3a..a28c212 100755 --- a/plugins/MacVST/Sidepass/source/Sidepass.cpp +++ b/plugins/MacVST/Sidepass/source/Sidepass.cpp @@ -16,10 +16,8 @@ Sidepass::Sidepass(audioMasterCallback audioMaster) : iirSampleA = 0.0; iirSampleB = 0.0; flip = true; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + 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/Sidepass/source/Sidepass.h b/plugins/MacVST/Sidepass/source/Sidepass.h index 0e496f5..1b31b91 100755 --- a/plugins/MacVST/Sidepass/source/Sidepass.h +++ b/plugins/MacVST/Sidepass/source/Sidepass.h @@ -55,10 +55,8 @@ private: double iirSampleA; double iirSampleB; bool flip; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/MacVST/Sidepass/source/SidepassProc.cpp b/plugins/MacVST/Sidepass/source/SidepassProc.cpp index d022df3..834ae3e 100755 --- a/plugins/MacVST/Sidepass/source/SidepassProc.cpp +++ b/plugins/MacVST/Sidepass/source/SidepassProc.cpp @@ -17,9 +17,6 @@ void Sidepass::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double iirAmount = pow(A,3)/overallscale; long double inputSampleL; long double inputSampleR; @@ -87,25 +84,14 @@ void Sidepass::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 32-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //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; @@ -127,9 +113,6 @@ void Sidepass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double iirAmount = pow(A,3)/overallscale; long double inputSampleL; long double inputSampleR; @@ -197,25 +180,16 @@ void Sidepass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (mid+side)/2.0; inputSampleR = (mid-side)/2.0; - //noise shaping to 64-bit floating point - if (flip) { - fpTemp = inputSampleL; - fpNShapeAL = (fpNShapeAL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeAL; - fpTemp = inputSampleR; - fpNShapeAR = (fpNShapeAR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeAR; - } - else { - fpTemp = inputSampleL; - fpNShapeBL = (fpNShapeBL*fpOld)+((inputSampleL-fpTemp)*fpNew); - inputSampleL += fpNShapeBL; - fpTemp = inputSampleR; - fpNShapeBR = (fpNShapeBR*fpOld)+((inputSampleR-fpTemp)*fpNew); - inputSampleR += fpNShapeBR; - } - flip = !flip; - //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; |