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/ChorusEnsemble | |
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/ChorusEnsemble')
5 files changed, 80 insertions, 77 deletions
diff --git a/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.pbxuser index bd6d0eb..bad7b6e 100755 --- a/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.pbxuser @@ -51,8 +51,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528459695; - PBXWorkspaceStateSaveDate = 528459695; + PBXPerProjectTemplateStateSaveDate = 569733687; + PBXWorkspaceStateSaveDate = 569733687; + }; + perUserProjectItems = { + 8B79361421F57279006E9731 /* PBXTextBookmark */ = 8B79361421F57279006E9731 /* PBXTextBookmark */; + 8B79361521F57279006E9731 /* PBXTextBookmark */ = 8B79361521F57279006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -60,17 +64,17 @@ }; 2407DEB6089929BA00EB68BF /* ChorusEnsemble.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1976}}"; + sepNavIntBoundsRect = "{{0, 0}, {656, 2028}}"; sepNavSelRange = "{791, 0}"; - sepNavVisRange = "{0, 2026}"; + sepNavVisRange = "{687, 156}"; sepNavWindowFrame = "{{12, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* ChorusEnsemble.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 1092}}"; - sepNavSelRange = "{2712, 0}"; - sepNavVisRange = "{495, 2391}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 1053}}"; + sepNavSelRange = "{2726, 0}"; + sepNavVisRange = "{521, 2322}"; sepNavWindowFrame = "{{298, 47}, {895, 831}}"; }; }; @@ -84,9 +88,9 @@ }; 24D8286F09A914000093AEF8 /* ChorusEnsembleProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {554, 5239}}"; - sepNavSelRange = "{11270, 0}"; - sepNavVisRange = "{0, 0}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 5018}}"; + sepNavSelRange = "{3664, 0}"; + sepNavVisRange = "{212, 1846}"; sepNavWindowFrame = "{{394, 47}, {895, 831}}"; }; }; @@ -104,6 +108,26 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; + 8B79361421F57279006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2407DEB6089929BA00EB68BF /* ChorusEnsemble.cpp */; + name = "ChorusEnsemble.cpp: 30"; + rLen = 0; + rLoc = 791; + rType = 0; + vrLen = 142; + vrLoc = 687; + }; + 8B79361521F57279006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2407DEB6089929BA00EB68BF /* ChorusEnsemble.cpp */; + name = "ChorusEnsemble.cpp: 30"; + rLen = 0; + rLoc = 791; + rType = 0; + vrLen = 156; + vrLoc = 687; + }; 8D01CCC60486CAD60068D4B7 /* ChorusEnsemble */ = { activeExec = 0; }; diff --git a/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.perspectivev3 index e4970a3..0d9a5fb 100755 --- a/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj/christopherjohnson.perspectivev3 @@ -300,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>6</integer> + <integer>7</integer> <integer>4</integer> <integer>0</integer> </array> @@ -339,13 +339,23 @@ <key>PBXProjectModuleGUID</key> <string>8B0237581D42B1C400E1E8C8</string> <key>PBXProjectModuleLabel</key> - <string><No Editor></string> + <string>ChorusEnsemble.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> <dict> <key>PBXProjectModuleGUID</key> <string>8B0237591D42B1C400E1E8C8</string> + <key>PBXProjectModuleLabel</key> + <string>ChorusEnsemble.cpp</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>8B79361521F57279006E9731</string> + <key>history</key> + <array> + <string>8B79361421F57279006E9731</string> + </array> </dict> <key>SplitCount</key> <string>1</string> @@ -358,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 0}}</string> + <string>{{0, 0}, {603, 132}}</string> <key>RubberWindowFrame</key> <string>401 330 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>0pt</string> + <string>132pt</string> </dict> <dict> <key>Proportion</key> - <string>441pt</string> + <string>309pt</string> <key>Tabs</key> <array> <dict> @@ -384,8 +394,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>401 330 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -439,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 345}}</string> + <string>{{10, 27}, {603, 282}}</string> + <key>RubberWindowFrame</key> + <string>401 330 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -467,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D787D1F7FA7CE007AB60F</string> + <string>8B79361621F57279006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D787E1F7FA7CE007AB60F</string> + <string>8B79361721F57279006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D787F1F7FA7CE007AB60F</string> + <string>8B79361821F57279006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -644,7 +654,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528459726.78873903</real> + <real>569733753.83205295</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -661,7 +671,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D78801F7FA7CE007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/ChorusEnsemble/ChorusEnsemble.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.cpp b/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.cpp index b1012f9..318b678 100755 --- a/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.cpp +++ b/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.cpp @@ -27,12 +27,9 @@ ChorusEnsemble::ChorusEnsemble(audioMasterCallback audioMaster) : airEvenR = 0.0; airOddR = 0.0; airFactorR = 0.0; - - 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/ChorusEnsemble/source/ChorusEnsemble.h b/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.h index bd442ab..e7df332 100755 --- a/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.h +++ b/plugins/MacVST/ChorusEnsemble/source/ChorusEnsemble.h @@ -67,12 +67,9 @@ private: double airEvenR; double airOddR; double airFactorR; - - long double fpNShapeLA; - long double fpNShapeLB; - long double fpNShapeRA; - long double fpNShapeRB; bool fpFlip; + long double fpNShapeL; + long double fpNShapeR; //default stuff float A; diff --git a/plugins/MacVST/ChorusEnsemble/source/ChorusEnsembleProc.cpp b/plugins/MacVST/ChorusEnsemble/source/ChorusEnsembleProc.cpp index 2a783dd..1663244 100755 --- a/plugins/MacVST/ChorusEnsemble/source/ChorusEnsembleProc.cpp +++ b/plugins/MacVST/ChorusEnsemble/source/ChorusEnsembleProc.cpp @@ -17,9 +17,6 @@ void ChorusEnsemble::processReplacing(float **inputs, float **outputs, VstInt32 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 speed = pow(A,3) * 0.001; speed *= overallscale; @@ -174,27 +171,17 @@ void ChorusEnsemble::processReplacing(float **inputs, float **outputs, VstInt32 inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } + fpFlip = !fpFlip; - //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; @@ -216,9 +203,6 @@ void ChorusEnsemble::processDoubleReplacing(double **inputs, double **outputs, V double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; double speed = pow(A,3) * 0.001; speed *= overallscale; @@ -373,27 +357,19 @@ void ChorusEnsemble::processDoubleReplacing(double **inputs, double **outputs, V inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } + fpFlip = !fpFlip; - //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; |