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/Logical4 | |
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/Logical4')
5 files changed, 54 insertions, 80 deletions
diff --git a/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser index 7177e0c..12e473a 100755 --- a/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.pbxuser @@ -51,11 +51,11 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528460946; - PBXWorkspaceStateSaveDate = 528460946; + PBXPerProjectTemplateStateSaveDate = 569769890; + PBXWorkspaceStateSaveDate = 569769890; }; perUserProjectItems = { - 8B9D6D9A1F7EF21C007AB60F /* PBXTextBookmark */ = 8B9D6D9A1F7EF21C007AB60F /* PBXTextBookmark */; + 8B793C5C21F60027006E9731 /* PBXTextBookmark */ = 8B793C5C21F60027006E9731 /* PBXTextBookmark */; 8B9D7B751F7FACB8007AB60F /* PBXTextBookmark */ = 8B9D7B751F7FACB8007AB60F /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; @@ -64,23 +64,23 @@ }; 2407DEB6089929BA00EB68BF /* Logical4.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {964, 3081}}"; - sepNavSelRange = "{506, 0}"; - sepNavVisRange = "{0, 1213}"; + sepNavIntBoundsRect = "{{0, 0}, {964, 2990}}"; + sepNavSelRange = "{1872, 0}"; + sepNavVisRange = "{917, 1644}"; sepNavWindowFrame = "{{101, 39}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* Logical4.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 2093}}"; - sepNavSelRange = "{4156, 0}"; - sepNavVisRange = "{44, 2353}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 2002}}"; + sepNavSelRange = "{4021, 0}"; + sepNavVisRange = "{3285, 841}"; sepNavWindowFrame = "{{20, 47}, {895, 831}}"; }; }; 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {747, 19864}}"; + sepNavIntBoundsRect = "{{0, 0}, {747, 19877}}"; sepNavSelRange = "{10616, 0}"; sepNavVisRange = "{0, 0}"; sepNavWindowFrame = "{{15, 42}, {895, 831}}"; @@ -88,9 +88,9 @@ }; 24D8286F09A914000093AEF8 /* Logical4Proc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 23621}}"; + sepNavIntBoundsRect = "{{0, 0}, {950, 23504}}"; sepNavSelRange = "{36787, 1892}"; - sepNavVisRange = "{2824, 2189}"; + sepNavVisRange = "{9422, 1935}"; sepNavWindowFrame = "{{446, 47}, {895, 831}}"; }; }; @@ -108,7 +108,7 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B9D6D9A1F7EF21C007AB60F /* PBXTextBookmark */ = { + 8B793C5C21F60027006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; name = "audioeffectx.cpp: 307"; diff --git a/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 index 053aa48..4d9ff5b 100755 --- a/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Logical4/Logical4.xcodeproj/christopherjohnson.perspectivev3 @@ -351,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D7B751F7FACB8007AB60F</string> + <string>8B793C5C21F60027006E9731</string> <key>history</key> <array> - <string>8B9D6D9A1F7EF21C007AB60F</string> + <string>8B9D7B751F7FACB8007AB60F</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>307 326 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>307 326 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, 345}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>307 326 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -477,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7B761F7FACB8007AB60F</string> + <string>8B793C5D21F60027006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7B771F7FACB8007AB60F</string> + <string>8B793C5E21F60027006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7B781F7FACB8007AB60F</string> + <string>8B793C5F21F60027006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -654,7 +654,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528460984.74037701</real> + <real>569770023.37923205</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -671,7 +671,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7B791F7FACB8007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/Logical4/Logical4.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/Logical4/source/Logical4.cpp b/plugins/MacVST/Logical4/source/Logical4.cpp index b17cc55..15d185b 100755 --- a/plugins/MacVST/Logical4/source/Logical4.cpp +++ b/plugins/MacVST/Logical4/source/Logical4.cpp @@ -77,12 +77,9 @@ Logical4::Logical4(audioMasterCallback audioMaster) : gcount = 0; //end Power Sags - - 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/Logical4/source/Logical4.h b/plugins/MacVST/Logical4/source/Logical4.h index 71e118e..fd802c8 100755 --- a/plugins/MacVST/Logical4/source/Logical4.h +++ b/plugins/MacVST/Logical4/source/Logical4.h @@ -143,10 +143,8 @@ private: int gcount; - double fpNShapeLA; - double fpNShapeLB; - double fpNShapeRA; - double fpNShapeRB; + double fpNShapeL; + double fpNShapeR; bool fpFlip; //default stuff diff --git a/plugins/MacVST/Logical4/source/Logical4Proc.cpp b/plugins/MacVST/Logical4/source/Logical4Proc.cpp index 0d09fcf..5d079f3 100755 --- a/plugins/MacVST/Logical4/source/Logical4Proc.cpp +++ b/plugins/MacVST/Logical4/source/Logical4Proc.cpp @@ -17,9 +17,8 @@ void Logical4::processReplacing(float **inputs, float **outputs, VstInt32 sample double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - float fpTemp; - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; + long double fpOld = 0.618033988749894848204586; //golden ratio! + long double fpNew = 1.0 - fpOld; float drySampleL; float drySampleR; @@ -869,27 +868,17 @@ void Logical4::processReplacing(float **inputs, float **outputs, VstInt32 sample 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; @@ -911,9 +900,8 @@ void Logical4::processDoubleReplacing(double **inputs, double **outputs, VstInt3 double overallscale = 1.0; overallscale /= 44100.0; overallscale *= getSampleRate(); - double fpTemp; //this is different from singlereplacing - double fpOld = 0.618033988749894848204586; //golden ratio! - double fpNew = 1.0 - fpOld; + long double fpOld = 0.618033988749894848204586; //golden ratio! + long double fpNew = 1.0 - fpOld; float drySampleL; float drySampleR; @@ -1762,26 +1750,18 @@ void Logical4::processDoubleReplacing(double **inputs, double **outputs, VstInt3 inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } - - //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; |