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/EQ | |
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/EQ')
-rwxr-xr-x | plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.pbxuser | 27 | ||||
-rwxr-xr-x | plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.perspectivev3 | 29 | ||||
-rwxr-xr-x | plugins/MacVST/EQ/source/EQ.cpp | 7 | ||||
-rwxr-xr-x | plugins/MacVST/EQ/source/EQ.h | 7 | ||||
-rwxr-xr-x | plugins/MacVST/EQ/source/EQProc.cpp | 62 |
5 files changed, 51 insertions, 81 deletions
diff --git a/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.pbxuser index a376012..b00c262 100755 --- a/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 541887553; - PBXWorkspaceStateSaveDate = 541887553; + PBXPerProjectTemplateStateSaveDate = 569735191; + PBXWorkspaceStateSaveDate = 569735191; }; perUserProjectItems = { - 8B181AF7204C941100516BEE /* XCBuildMessageTextBookmark */ = 8B181AF7204C941100516BEE /* XCBuildMessageTextBookmark */; 8B181AF8204C941100516BEE /* PBXTextBookmark */ = 8B181AF8204C941100516BEE /* PBXTextBookmark */; + 8B793A0321F57823006E9731 /* PBXTextBookmark */ = 8B793A0321F57823006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -78,9 +78,9 @@ }; 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {838, 19747}}"; + sepNavIntBoundsRect = "{{0, 0}, {838, 19877}}"; sepNavSelRange = "{10616, 0}"; - sepNavVisRange = "{10459, 399}"; + sepNavVisRange = "{10459, 280}"; sepNavWindowFrame = "{{15, 42}, {895, 831}}"; }; }; @@ -106,23 +106,24 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8B181AF7204C941100516BEE /* XCBuildMessageTextBookmark */ = { + 8B181AF8204C941100516BEE /* PBXTextBookmark */ = { isa = PBXTextBookmark; - comments = "Deprecated conversion from string constant to 'char*'"; fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; - fallbackIsa = XCBuildMessageTextBookmark; - rLen = 1; - rLoc = 306; - rType = 1; + name = "audioeffectx.cpp: 307"; + rLen = 0; + rLoc = 10616; + rType = 0; + vrLen = 399; + vrLoc = 10459; }; - 8B181AF8204C941100516BEE /* PBXTextBookmark */ = { + 8B793A0321F57823006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; name = "audioeffectx.cpp: 307"; rLen = 0; rLoc = 10616; rType = 0; - vrLen = 399; + vrLen = 280; vrLoc = 10459; }; 8D01CCC60486CAD60068D4B7 /* EQ */ = { diff --git a/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.perspectivev3 index b6f9507..708c37d 100755 --- a/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/EQ/EQ.xcodeproj/christopherjohnson.perspectivev3 @@ -256,6 +256,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -349,10 +351,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B181AF8204C941100516BEE</string> + <string>8B793A0321F57823006E9731</string> <key>history</key> <array> - <string>8B181AF7204C941100516BEE</string> + <string>8B181AF8204C941100516BEE</string> </array> </dict> <key>SplitCount</key> @@ -366,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 132}}</string> + <string>{{0, 0}, {603, 117}}</string> <key>RubberWindowFrame</key> <string>15 373 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>132pt</string> + <string>117pt</string> </dict> <dict> <key>Proportion</key> - <string>309pt</string> + <string>324pt</string> <key>Tabs</key> <array> <dict> @@ -391,7 +393,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 297}}</string> + <key>RubberWindowFrame</key> + <string>15 373 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -446,8 +450,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 282}}</string> - <key>RubberWindowFrame</key> - <string>15 373 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -475,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B181AAB204C8C4800516BEE</string> + <string>8B793A0421F57823006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B181AAC204C8C4800516BEE</string> + <string>8B793A0521F57823006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B181AAD204C8C4800516BEE</string> + <string>8B793A0621F57823006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -632,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>541889553.15927601</real> + <real>569735203.85904706</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -649,8 +651,7 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B181AF9204C941100516BEE</string> - <string>/Users/christopherjohnson/Desktop/EQ/EQ.xcodeproj</string> + <string>/Users/christopherjohnson/Desktop/MacVST/EQ/EQ.xcodeproj</string> </array> <key>WindowString</key> <string>15 373 810 487 0 0 1440 878 </string> diff --git a/plugins/MacVST/EQ/source/EQ.cpp b/plugins/MacVST/EQ/source/EQ.cpp index ebdadaa..f2e4e01 100755 --- a/plugins/MacVST/EQ/source/EQ.cpp +++ b/plugins/MacVST/EQ/source/EQ.cpp @@ -111,11 +111,8 @@ EQ::EQ(audioMasterCallback audioMaster) : flip = false; flipthree = 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/EQ/source/EQ.h b/plugins/MacVST/EQ/source/EQ.h index 4317a2d..26fade4 100755 --- a/plugins/MacVST/EQ/source/EQ.h +++ b/plugins/MacVST/EQ/source/EQ.h @@ -59,11 +59,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 lastSampleL; diff --git a/plugins/MacVST/EQ/source/EQProc.cpp b/plugins/MacVST/EQ/source/EQProc.cpp index 6d994a9..917dc7e 100755 --- a/plugins/MacVST/EQ/source/EQProc.cpp +++ b/plugins/MacVST/EQ/source/EQProc.cpp @@ -20,9 +20,6 @@ void EQ::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -434,25 +431,14 @@ void EQ::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames inputSampleR *= outputgain; } - //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; @@ -477,9 +463,6 @@ void EQ::processDoubleReplacing(double **inputs, double **outputs, VstInt32 samp overallscale = getSampleRate(); compscale = compscale * overallscale; //compscale is the one that's 1 or something like 2.2 for 96K rates - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -891,25 +874,16 @@ void EQ::processDoubleReplacing(double **inputs, double **outputs, VstInt32 samp inputSampleR *= outputgain; } - //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; |