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/Highpass | |
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/Highpass')
5 files changed, 54 insertions, 88 deletions
diff --git a/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.pbxuser index 41bc4e3..6a621d4 100755 --- a/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.pbxuser @@ -49,11 +49,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528460765; - PBXWorkspaceStateSaveDate = 528460765; + PBXPerProjectTemplateStateSaveDate = 569768258; + PBXWorkspaceStateSaveDate = 569768258; }; perUserProjectItems = { - 8B9D6D1C1F7EEAA7007AB60F /* PBXTextBookmark */ = 8B9D6D1C1F7EEAA7007AB60F /* PBXTextBookmark */; + 8B793BD921F5FB42006E9731 /* PBXTextBookmark */ = 8B793BD921F5FB42006E9731 /* PBXTextBookmark */; 8B9D7AED1F7FABEE007AB60F /* PBXTextBookmark */ = 8B9D7AED1F7FABEE007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -62,17 +62,17 @@ }; 2407DEB6089929BA00EB68BF /* Highpass.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 2015}}"; - sepNavSelRange = "{470, 0}"; - sepNavVisRange = "{0, 1934}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 1976}}"; + sepNavSelRange = "{605, 0}"; + sepNavVisRange = "{0, 1964}"; sepNavWindowFrame = "{{545, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Highpass.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 975}}"; - sepNavSelRange = "{2665, 0}"; - sepNavVisRange = "{373, 2298}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 936}}"; + sepNavSelRange = "{2612, 0}"; + sepNavVisRange = "{366, 2258}"; sepNavWindowFrame = "{{545, 45}, {895, 831}}"; }; }; @@ -86,8 +86,8 @@ }; 24D8286F09A914000093AEF8 /* HighpassProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 3861}}"; - sepNavSelRange = "{10302, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 3549}}"; + sepNavSelRange = "{9802, 0}"; sepNavVisRange = "{0, 0}"; sepNavWindowFrame = "{{325, 47}, {895, 831}}"; }; @@ -106,12 +106,12 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6D1C1F7EEAA7007AB60F /* PBXTextBookmark */ = { + 8B793BD921F5FB42006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* HighpassProc.cpp */; - name = "HighpassProc.cpp: 297"; + name = "HighpassProc.cpp: 270"; rLen = 0; - rLoc = 10302; + rLoc = 9802; rType = 0; vrLen = 0; vrLoc = 0; @@ -121,7 +121,7 @@ fRef = 24D8286F09A914000093AEF8 /* HighpassProc.cpp */; name = "HighpassProc.cpp: 297"; rLen = 0; - rLoc = 10302; + rLoc = 9802; rType = 0; vrLen = 0; vrLoc = 0; diff --git a/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.perspectivev3 index 9d76d95..e1cb811 100755 --- a/plugins/MacVST/Highpass/Highpass.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Highpass/Highpass.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>8B9D7AED1F7FABEE007AB60F</string> + <string>8B793BD921F5FB42006E9731</string> <key>history</key> <array> - <string>8B9D6D1C1F7EEAA7007AB60F</string> + <string>8B9D7AED1F7FABEE007AB60F</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>369 207 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>369 207 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, 282}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>369 207 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7AEE1F7FABEE007AB60F</string> + <string>8B793BDA21F5FB42006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7AEF1F7FABEE007AB60F</string> + <string>8B793BDB21F5FB42006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7AF01F7FABEE007AB60F</string> + <string>8B793BDC21F5FB42006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -634,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528460782.88018203</real> + <real>569768770.42441106</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -651,7 +651,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7AF11F7FABEE007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/Highpass/Highpass.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/Highpass/source/Highpass.cpp b/plugins/MacVST/Highpass/source/Highpass.cpp index ed43f9d..86ebe24 100755 --- a/plugins/MacVST/Highpass/source/Highpass.cpp +++ b/plugins/MacVST/Highpass/source/Highpass.cpp @@ -19,10 +19,8 @@ Highpass::Highpass(audioMasterCallback audioMaster) : iirSampleBL = 0.0; iirSampleAR = 0.0; iirSampleBR = 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/Highpass/source/Highpass.h b/plugins/MacVST/Highpass/source/Highpass.h index 03d8609..673f951 100755 --- a/plugins/MacVST/Highpass/source/Highpass.h +++ b/plugins/MacVST/Highpass/source/Highpass.h @@ -54,11 +54,8 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; - bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; @@ -68,7 +65,7 @@ private: double iirSampleBL; double iirSampleAR; double iirSampleBR; - + bool fpFlip; }; #endif diff --git a/plugins/MacVST/Highpass/source/HighpassProc.cpp b/plugins/MacVST/Highpass/source/HighpassProc.cpp index b1e7de9..371ed57 100755 --- a/plugins/MacVST/Highpass/source/HighpassProc.cpp +++ b/plugins/MacVST/Highpass/source/HighpassProc.cpp @@ -26,9 +26,6 @@ void Highpass::processReplacing(float **inputs, float **outputs, VstInt32 sample double inputSampleR; double outputSampleL; double outputSampleR; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; iirAmount += (iirAmount * tight * tight); if (tight > 0) tight /= 1.5; @@ -114,33 +111,21 @@ void Highpass::processReplacing(float **inputs, float **outputs, VstInt32 sample iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount)); outputSampleR = outputSampleR - iirSampleBR; } + fpFlip = !fpFlip; if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry); if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = outputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLA; - - fpTemp = outputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRA; - } - else { - fpTemp = outputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLB; - - fpTemp = outputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += 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 = outputSampleL; *out2 = outputSampleR; @@ -171,9 +156,6 @@ void Highpass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double inputSampleR; double outputSampleL; double outputSampleR; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; iirAmount += (iirAmount * tight * tight); if (tight > 0) tight /= 1.5; @@ -259,33 +241,23 @@ void Highpass::processDoubleReplacing(double **inputs, double **outputs, VstInt3 iirSampleBR = (iirSampleBR * (1 - (offset * iirAmount))) + (inputSampleR * (offset * iirAmount)); outputSampleR = outputSampleR - iirSampleBR; } + fpFlip = !fpFlip; if (wet < 1.0) outputSampleL = (outputSampleL * wet) + (inputSampleL * dry); if (wet < 1.0) outputSampleR = (outputSampleR * wet) + (inputSampleR * dry); - //noise shaping to 32-bit floating point - if (fpFlip) { - fpTemp = outputSampleL; - fpNShapeLA = (fpNShapeLA*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLA; - - fpTemp = outputSampleR; - fpNShapeRA = (fpNShapeRA*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRA; - } - else { - fpTemp = outputSampleL; - fpNShapeLB = (fpNShapeLB*fpOld)+((outputSampleL-fpTemp)*fpNew); - outputSampleL += fpNShapeLB; - - fpTemp = outputSampleR; - fpNShapeRB = (fpNShapeRB*fpOld)+((outputSampleR-fpTemp)*fpNew); - outputSampleR += fpNShapeRB; - } - fpFlip = !fpFlip; - //end noise shaping on 32 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 = outputSampleL; *out2 = outputSampleR; |