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/DrumSlam | |
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/DrumSlam')
5 files changed, 47 insertions, 74 deletions
diff --git a/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.pbxuser index 37e894a..085419c 100755 --- a/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.pbxuser @@ -51,8 +51,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 547825371; - PBXWorkspaceStateSaveDate = 547825371; + PBXPerProjectTemplateStateSaveDate = 569734786; + PBXWorkspaceStateSaveDate = 569734786; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -60,17 +60,17 @@ }; 2407DEB6089929BA00EB68BF /* DrumSlam.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 2067}}"; - sepNavSelRange = "{4174, 11}"; - sepNavVisRange = "{3277, 2173}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 2132}}"; + sepNavSelRange = "{852, 0}"; + sepNavVisRange = "{0, 1541}"; sepNavWindowFrame = "{{12, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* DrumSlam.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 1209}}"; - sepNavSelRange = "{435, 0}"; - sepNavVisRange = "{663, 2389}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 1170}}"; + sepNavSelRange = "{2870, 0}"; + sepNavVisRange = "{655, 2346}"; sepNavWindowFrame = "{{20, 47}, {895, 831}}"; }; }; diff --git a/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.perspectivev3 index 48ceca2..d1c4f80 100755 --- a/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/DrumSlam/DrumSlam.xcodeproj/christopherjohnson.perspectivev3 @@ -256,6 +256,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -298,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>6</integer> + <integer>7</integer> <integer>4</integer> <integer>0</integer> </array> @@ -321,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>28 345 810 487 0 0 1440 878 </string> + <string>176 340 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -360,7 +362,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>28 345 810 487 0 0 1440 878 </string> + <string>176 340 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -439,7 +441,7 @@ <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> <key>RubberWindowFrame</key> - <string>28 345 810 487 0 0 1440 878 </string> + <string>176 340 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -467,11 +469,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B7E3F2420A72F9200482CB5</string> + <string>8B79390D21F576B0006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B7E3F2520A72F9200482CB5</string> + <string>8B79390E21F576B0006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B7E3F2620A72F9200482CB5</string> + <string>8B79390F21F576B0006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -644,7 +646,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>547827602.36658394</real> + <real>569734832.13053405</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -661,11 +663,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B7E3F2D20A72F9200482CB5</string> - <string>/Users/christopherjohnson/Desktop/DrumSlam/DrumSlam.xcodeproj</string> + <string>/Users/christopherjohnson/Desktop/MacVST/DrumSlam/DrumSlam.xcodeproj</string> </array> <key>WindowString</key> - <string>28 345 810 487 0 0 1440 878 </string> + <string>176 340 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/DrumSlam/source/DrumSlam.cpp b/plugins/MacVST/DrumSlam/source/DrumSlam.cpp index 8a6ae7b..5b88619 100755 --- a/plugins/MacVST/DrumSlam/source/DrumSlam.cpp +++ b/plugins/MacVST/DrumSlam/source/DrumSlam.cpp @@ -35,12 +35,9 @@ DrumSlam::DrumSlam(audioMasterCallback audioMaster) : iirSampleGR = 0.0; iirSampleHR = 0.0; lastSampleR = 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/DrumSlam/source/DrumSlam.h b/plugins/MacVST/DrumSlam/source/DrumSlam.h index 5ec2fda..418282d 100755 --- a/plugins/MacVST/DrumSlam/source/DrumSlam.h +++ b/plugins/MacVST/DrumSlam/source/DrumSlam.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 double iirSampleAL; @@ -80,7 +77,7 @@ private: double iirSampleGR; double iirSampleHR; double lastSampleR; - + bool fpFlip; float A; float B; float C; diff --git a/plugins/MacVST/DrumSlam/source/DrumSlamProc.cpp b/plugins/MacVST/DrumSlam/source/DrumSlamProc.cpp index 171b353..2e86142 100755 --- a/plugins/MacVST/DrumSlam/source/DrumSlamProc.cpp +++ b/plugins/MacVST/DrumSlam/source/DrumSlamProc.cpp @@ -25,8 +25,6 @@ void DrumSlam::processReplacing(float **inputs, float **outputs, VstInt32 sample double out = B; double wet = C; double dry = 1.0 - wet; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -125,6 +123,8 @@ void DrumSlam::processReplacing(float **inputs, float **outputs, VstInt32 sample highSampleL = inputSampleL - iirSampleHL; highSampleR = inputSampleR - iirSampleHR; } + fpFlip = !fpFlip; + //generate the tone bands we're using if (lowSampleL > 1.0) {lowSampleL = 1.0;} if (lowSampleL < -1.0) {lowSampleL = -1.0;} @@ -219,26 +219,14 @@ void DrumSlam::processReplacing(float **inputs, float **outputs, VstInt32 sample inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 32-bit floating point - float fpTemp; - 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; @@ -268,8 +256,6 @@ void DrumSlam::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double out = B; double wet = C; double dry = 1.0 - wet; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; while (--sampleFrames >= 0) { @@ -368,6 +354,8 @@ void DrumSlam::processDoubleReplacing(double **inputs, double **outputs, VstInt3 highSampleL = inputSampleL - iirSampleHL; highSampleR = inputSampleR - iirSampleHR; } + fpFlip = !fpFlip; + //generate the tone bands we're using if (lowSampleL > 1.0) {lowSampleL = 1.0;} if (lowSampleL < -1.0) {lowSampleL = -1.0;} @@ -462,26 +450,16 @@ void DrumSlam::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - //noise shaping to 64-bit floating point - double fpTemp; - 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; |