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/Pressure4 | |
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/Pressure4')
5 files changed, 49 insertions, 84 deletions
diff --git a/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser index 3c1525b..37f6135 100755 --- a/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.pbxuser @@ -49,13 +49,13 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528461605; - PBXWorkspaceStateSaveDate = 528461605; + PBXPerProjectTemplateStateSaveDate = 569771037; + PBXWorkspaceStateSaveDate = 569771037; }; perUserProjectItems = { 8B2E04191D8381D1001B9E01 /* PBXTextBookmark */ = 8B2E04191D8381D1001B9E01 /* PBXTextBookmark */; - 8B9D6F2A1F7EF568007AB60F /* PBXTextBookmark */ = 8B9D6F2A1F7EF568007AB60F /* PBXTextBookmark */; - 8B9D7D161F7FAF5A007AB60F /* PBXTextBookmark */ = 8B9D7D161F7FAF5A007AB60F /* PBXTextBookmark */; + 8B793E3721F60423006E9731 /* PBXTextBookmark */ = 8B793E3721F60423006E9731 /* PBXTextBookmark */; + 8B793E3C21F60454006E9731 /* PBXTextBookmark */ = 8B793E3C21F60454006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -63,15 +63,15 @@ }; 2407DEB6089929BA00EB68BF /* Pressure4.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 2184}}"; - sepNavSelRange = "{4340, 0}"; - sepNavVisRange = "{0, 1911}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 2158}}"; + sepNavSelRange = "{527, 0}"; + sepNavVisRange = "{0, 1930}"; sepNavWindowFrame = "{{535, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Pressure4.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 1170}}"; + sepNavIntBoundsRect = "{{0, 0}, {600, 1105}}"; sepNavSelRange = "{453, 0}"; sepNavVisRange = "{419, 41}"; sepNavWindowFrame = "{{530, 47}, {895, 831}}"; @@ -112,22 +112,22 @@ fRef = 2407DEB6089929BA00EB68BF /* Pressure4.cpp */; name = "Pressure4.cpp: 52"; rLen = 0; - rLoc = 1865; + rLoc = 1825; rType = 0; vrLen = 312; vrLoc = 44; }; - 8B9D6F2A1F7EF568007AB60F /* PBXTextBookmark */ = { + 8B793E3721F60423006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 245463B80991757100464AD3 /* Pressure4.h */; name = "Pressure4.h: 23"; rLen = 0; rLoc = 453; rType = 0; - vrLen = 69; - vrLoc = 391; + vrLen = 41; + vrLoc = 419; }; - 8B9D7D161F7FAF5A007AB60F /* PBXTextBookmark */ = { + 8B793E3C21F60454006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 245463B80991757100464AD3 /* Pressure4.h */; name = "Pressure4.h: 23"; diff --git a/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3 index 3f05d07..a83121a 100755 --- a/plugins/MacVST/Pressure4/Pressure4.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Pressure4/Pressure4.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,11 +351,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D7D161F7FAF5A007AB60F</string> + <string>8B793E3C21F60454006E9731</string> <key>history</key> <array> <string>8B2E04191D8381D1001B9E01</string> - <string>8B9D6F2A1F7EF568007AB60F</string> + <string>8B793E3721F60423006E9731</string> </array> </dict> <key>SplitCount</key> @@ -369,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 69}}</string> + <string>{{0, 0}, {603, 51}}</string> <key>RubberWindowFrame</key> <string>630 371 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>69pt</string> + <string>51pt</string> </dict> <dict> <key>Proportion</key> - <string>372pt</string> + <string>390pt</string> <key>Tabs</key> <array> <dict> @@ -394,9 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 345}}</string> - <key>RubberWindowFrame</key> - <string>630 371 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 363}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -450,7 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 282}}</string> + <string>{{10, 27}, {603, 363}}</string> + <key>RubberWindowFrame</key> + <string>630 371 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -478,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7D171F7FAF5A007AB60F</string> + <string>8B793E3D21F60454006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7D181F7FAF5A007AB60F</string> + <string>8B793E3E21F60454006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7D191F7FAF5A007AB60F</string> + <string>8B793E3F21F60454006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -635,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528461658.22323</real> + <real>569771092.74144006</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -652,7 +652,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7D1A1F7FAF5A007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/Pressure4/Pressure4.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/Pressure4/source/Pressure4.cpp b/plugins/MacVST/Pressure4/source/Pressure4.cpp index 8ae2adc..10ed5fa 100755 --- a/plugins/MacVST/Pressure4/source/Pressure4.cpp +++ b/plugins/MacVST/Pressure4/source/Pressure4.cpp @@ -16,10 +16,8 @@ Pressure4::Pressure4(audioMasterCallback audioMaster) : B = 0.2; C = 1.0; D = 1.0; - fpNShapeAL = 0.0; - fpNShapeBL = 0.0; - fpNShapeAR = 0.0; - fpNShapeBR = 0.0; + fpNShapeL = 0.0; + fpNShapeR = 0.0; muSpeedA = 10000; muSpeedB = 10000; muCoefficientA = 1; diff --git a/plugins/MacVST/Pressure4/source/Pressure4.h b/plugins/MacVST/Pressure4/source/Pressure4.h index 29d20eb..6cf3448 100755 --- a/plugins/MacVST/Pressure4/source/Pressure4.h +++ b/plugins/MacVST/Pressure4/source/Pressure4.h @@ -62,10 +62,8 @@ private: double muSpeedB; double muCoefficientA; double muCoefficientB; - long double fpNShapeAL; - long double fpNShapeBL; - long double fpNShapeAR; - long double fpNShapeBR; + long double fpNShapeL; + long double fpNShapeR; bool flip; float A; diff --git a/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp b/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp index 02b8a78..7e285df 100755 --- a/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp +++ b/plugins/MacVST/Pressure4/source/Pressure4Proc.cpp @@ -43,9 +43,6 @@ void Pressure4::processReplacing(float **inputs, float **outputs, VstInt32 sampl unmewiness = 1.0-mewiness; } // µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~ - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -195,27 +192,14 @@ void Pressure4::processReplacing(float **inputs, float **outputs, VstInt32 sampl else {inputSampleR = -bridgerectifier;} //second stage of overdrive to prevent overs and allow bloody loud extremeness - //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 *outputL = inputSampleL; *outputR = inputSampleR; @@ -263,9 +247,6 @@ void Pressure4::processDoubleReplacing(double **inputs, double **outputs, VstInt unmewiness = 1.0-mewiness; } // µ µ µ µ µ µ µ µ µ µ µ µ is the kitten song o/~ - 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; @@ -416,27 +397,16 @@ void Pressure4::processDoubleReplacing(double **inputs, double **outputs, VstInt else {inputSampleR = -bridgerectifier;} //second stage of overdrive to prevent overs and allow bloody loud extremeness - //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 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 *outputL = inputSampleL; *outputR = inputSampleR; |