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/PowerSag | |
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/PowerSag')
5 files changed, 38 insertions, 71 deletions
diff --git a/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser index 7297e69..f09d1b9 100755 --- a/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser @@ -49,11 +49,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528461548; - PBXWorkspaceStateSaveDate = 528461548; + PBXPerProjectTemplateStateSaveDate = 569771002; + PBXWorkspaceStateSaveDate = 569771002; }; perUserProjectItems = { - 8B9D6F151F7EF53E007AB60F /* PBXTextBookmark */ = 8B9D6F151F7EF53E007AB60F /* PBXTextBookmark */; + 8B793E1921F60406006E9731 /* PBXTextBookmark */ = 8B793E1921F60406006E9731 /* PBXTextBookmark */; 8B9D7CF61F7FAF1B007AB60F /* PBXTextBookmark */ = 8B9D7CF61F7FAF1B007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -94,7 +94,7 @@ }; 24D8286F09A914000093AEF8 /* PowerSagProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {691, 3679}}"; + sepNavIntBoundsRect = "{{0, 0}, {677, 3497}}"; sepNavSelRange = "{6117, 1892}"; sepNavVisRange = "{0, 0}"; sepNavWindowFrame = "{{373, 47}, {895, 831}}"; @@ -114,10 +114,10 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6F151F7EF53E007AB60F /* PBXTextBookmark */ = { + 8B793E1921F60406006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* PowerSagProc.cpp */; - name = "PowerSagProc.cpp: 182"; + name = "PowerSagProc.cpp: 171"; rLen = 1892; rLoc = 6117; rType = 0; diff --git a/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3 index ae6f413..bfea37c 100755 --- a/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3 @@ -351,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D7CF61F7FAF1B007AB60F</string> + <string>8B793E1921F60406006E9731</string> <key>history</key> <array> - <string>8B9D6F151F7EF53E007AB60F</string> + <string>8B9D7CF61F7FAF1B007AB60F</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>260 312 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,7 +393,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 401}}</string> + <string>{{10, 27}, {603, 414}}</string> <key>RubberWindowFrame</key> <string>260 312 810 487 0 0 1440 878 </string> </dict> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7CF71F7FAF1B007AB60F</string> + <string>8B793E1A21F60406006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7CF81F7FAF1B007AB60F</string> + <string>8B793E1B21F60406006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7CF91F7FAF1B007AB60F</string> + <string>8B793E1C21F60406006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -634,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528461595.073053</real> + <real>569771014.65125096</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -651,7 +651,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7CFA1F7FAF1B007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/PowerSag/PowerSag.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/PowerSag/source/PowerSag.cpp b/plugins/MacVST/PowerSag/source/PowerSag.cpp index 0218186..d1d0745 100755 --- a/plugins/MacVST/PowerSag/source/PowerSag.cpp +++ b/plugins/MacVST/PowerSag/source/PowerSag.cpp @@ -18,11 +18,8 @@ PowerSag::PowerSag(audioMasterCallback audioMaster) : gcount = 0; A = 0.0; B = 0.3; - fpNShapeLA = 0.0; - fpNShapeLB = 0.0; - fpNShapeRA = 0.0; - fpNShapeRB = 0.0; - fpFlip = true; + 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/PowerSag/source/PowerSag.h b/plugins/MacVST/PowerSag/source/PowerSag.h index 930f05b..38839b6 100755 --- a/plugins/MacVST/PowerSag/source/PowerSag.h +++ b/plugins/MacVST/PowerSag/source/PowerSag.h @@ -53,11 +53,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 double dL[9000]; double dR[9000]; diff --git a/plugins/MacVST/PowerSag/source/PowerSagProc.cpp b/plugins/MacVST/PowerSag/source/PowerSagProc.cpp index d1afa31..de43be6 100755 --- a/plugins/MacVST/PowerSag/source/PowerSagProc.cpp +++ b/plugins/MacVST/PowerSag/source/PowerSagProc.cpp @@ -22,9 +22,6 @@ void PowerSag::processReplacing(float **inputs, float **outputs, VstInt32 sample double out; double bridgerectifier; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -123,25 +120,14 @@ void PowerSag::processReplacing(float **inputs, float **outputs, VstInt32 sample gcount--; - //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; @@ -168,9 +154,6 @@ void PowerSag::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double out; double bridgerectifier; - 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; @@ -269,25 +252,16 @@ void PowerSag::processDoubleReplacing(double **inputs, double **outputs, VstInt3 gcount--; - //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; |