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/PurestGain | |
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/PurestGain')
15 files changed, 40 insertions, 103 deletions
diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser index 11a21ab..60f46c3 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.pbxuser @@ -2,7 +2,7 @@ { 089C1669FE841209C02AAC07 /* Project object */ = { activeBuildConfigurationName = Release; - activeTarget = 8D01CCC60486CAD60068D4B7 /* PurestGain */; + activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */; codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */; perUserDictionary = { PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { @@ -49,8 +49,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 530661522; - PBXWorkspaceStateSaveDate = 530661522; + PBXPerProjectTemplateStateSaveDate = 569771364; + PBXWorkspaceStateSaveDate = 569771364; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -82,9 +82,9 @@ }; 24D8286F09A914000093AEF8 /* PurestGainProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 4095}}"; - sepNavSelRange = "{8041, 1892}"; - sepNavVisRange = "{2228, 2390}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 3484}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{7696, 2006}"; sepNavWindowFrame = "{{488, 47}, {895, 831}}"; }; }; @@ -102,7 +102,7 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8D01CCC60486CAD60068D4B7 /* PurestGain */ = { + 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = { activeExec = 0; }; } diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 index f4f1de3..3986363 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/christopherjohnson.perspectivev3 @@ -300,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>5</integer> + <integer>6</integer> <integer>4</integer> <integer>0</integer> </array> @@ -323,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>711 333 810 487 0 0 1440 878 </string> + <string>630 333 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -362,7 +362,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>711 333 810 487 0 0 1440 878 </string> + <string>630 333 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -387,7 +387,7 @@ <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> <key>RubberWindowFrame</key> - <string>711 333 810 487 0 0 1440 878 </string> + <string>630 333 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -469,11 +469,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BA972EE1FA145A50032B992</string> + <string>8B793EDC21F6057A006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BA972EF1FA145A50032B992</string> + <string>8B793EDD21F6057A006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8BA972F01FA145A50032B992</string> + <string>8B793EDE21F6057A006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -626,7 +626,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>530662821.72906101</real> + <real>569771386.05235398</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -643,11 +643,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8BA972F11FA145A50032B992</string> <string>/Users/christopherjohnson/Desktop/MacVST/PurestGain/PurestGain.xcodeproj</string> </array> <key>WindowString</key> - <string>711 333 810 487 0 0 1440 878 </string> + <string>630 333 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.pbxproj b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.pbxproj index b89fc20..511f09f 100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.pbxproj +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.pbxproj @@ -1894,7 +1894,7 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 8D01CCC60486CAD60068D4B7 /* PurestGain */ = { + 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = { isa = PBXNativeTarget; buildConfigurationList = 24BEAAED08919AE700E695F9 /* Build configuration list for PBXNativeTarget "PurestGain" */; buildPhases = ( @@ -1947,7 +1947,7 @@ ); projectRoot = ""; targets = ( - 8D01CCC60486CAD60068D4B7 /* PurestGain */, + 8D01CCC60486CAD60068D4B7 /* AudioUnit */, ); }; /* End PBXProject section */ diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/contents.xcworkspacedata index a80c038..a80c038 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex 5c38f94..5c38f94 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/christopherjohnson.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex 314de0f..314de0f 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/project.xcworkspace/xcuserdata/spiadmin.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.mode1v3 b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.mode1v3 index c572326..c572326 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.mode1v3 +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.mode1v3 diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.pbxuser b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.pbxuser index df94780..df94780 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.pbxuser +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/spiadmin.pbxuser diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme index 8ee693f..8ee693f 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/Gain.xcscheme diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist index 5bccbcb..5bccbcb 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/christopherjohnson.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist index a7bdd62..a7bdd62 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme index 0df2de4..0df2de4 100644..100755 --- a/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme +++ b/plugins/MacVST/PurestGain/PurestGain.xcodeproj/xcuserdata/spiadmin.xcuserdatad/xcschemes/«PROJECTNAME».xcscheme diff --git a/plugins/MacVST/PurestGain/source/PurestGain.cpp b/plugins/MacVST/PurestGain/source/PurestGain.cpp index 3091a12..b1b77fe 100755 --- a/plugins/MacVST/PurestGain/source/PurestGain.cpp +++ b/plugins/MacVST/PurestGain/source/PurestGain.cpp @@ -18,11 +18,8 @@ PurestGain::PurestGain(audioMasterCallback audioMaster) : settingchase = -90.0; gainBchase = -90.0; chasespeed = 350.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/PurestGain/source/PurestGain.h b/plugins/MacVST/PurestGain/source/PurestGain.h index 7869425..9e2baea 100755 --- a/plugins/MacVST/PurestGain/source/PurestGain.h +++ b/plugins/MacVST/PurestGain/source/PurestGain.h @@ -53,11 +53,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 gainchase; double settingchase; diff --git a/plugins/MacVST/PurestGain/source/PurestGainProc.cpp b/plugins/MacVST/PurestGain/source/PurestGainProc.cpp index 38f2849..4aa6d96 100755 --- a/plugins/MacVST/PurestGain/source/PurestGainProc.cpp +++ b/plugins/MacVST/PurestGain/source/PurestGainProc.cpp @@ -43,9 +43,6 @@ void PurestGain::processReplacing(float **inputs, float **outputs, VstInt32 samp //done with slow fade controller double outputgain; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double inputSampleL; long double inputSampleR; @@ -118,45 +115,19 @@ void PurestGain::processReplacing(float **inputs, float **outputs, VstInt32 samp if (1.0 == outputgain) { - 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 *out1 = *in1; *out2 = *in2; } else { inputSampleL *= outputgain; inputSampleR *= outputgain; - 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; } @@ -204,9 +175,6 @@ void PurestGain::processDoubleReplacing(double **inputs, double **outputs, VstIn //done with slow fade controller double outputgain; - 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; @@ -273,45 +241,21 @@ void PurestGain::processDoubleReplacing(double **inputs, double **outputs, VstIn if (1.0 == outputgain) { - 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 *out1 = *in1; *out2 = *in2; } else { inputSampleL *= outputgain; inputSampleR *= outputgain; - 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 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; } |