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/IronOxideClassic | |
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/IronOxideClassic')
6 files changed, 48 insertions, 79 deletions
diff --git a/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.pbxuser index 9ecb7a4..45dee94 100755 --- a/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.pbxuser @@ -2,7 +2,7 @@ { 089C1669FE841209C02AAC07 /* Project object */ = { activeBuildConfigurationName = Release; - activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */; + activeTarget = 8D01CCC60486CAD60068D4B7 /* IronOxideClassic */; codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */; perUserDictionary = { PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { @@ -49,8 +49,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528460860; - PBXWorkspaceStateSaveDate = 528460860; + PBXPerProjectTemplateStateSaveDate = 569769189; + PBXWorkspaceStateSaveDate = 569769189; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -58,17 +58,17 @@ }; 2407DEB6089929BA00EB68BF /* IronOxideClassic.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1911}}"; - sepNavSelRange = "{4912, 0}"; - sepNavVisRange = "{3304, 2335}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 1885}}"; + sepNavSelRange = "{822, 0}"; + sepNavVisRange = "{0, 2130}"; sepNavWindowFrame = "{{530, 43}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* IronOxideClassic.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 1144}}"; - sepNavSelRange = "{2736, 0}"; - sepNavVisRange = "{475, 2394}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 1105}}"; + sepNavSelRange = "{2766, 0}"; + sepNavVisRange = "{642, 2241}"; sepNavWindowFrame = "{{541, 47}, {895, 831}}"; }; }; @@ -102,7 +102,7 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = { + 8D01CCC60486CAD60068D4B7 /* IronOxideClassic */ = { activeExec = 0; }; } diff --git a/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.perspectivev3 index d4487c2..2960170 100755 --- a/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/christopherjohnson.perspectivev3 @@ -300,7 +300,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>6</integer> + <integer>5</integer> <integer>4</integer> <integer>0</integer> </array> @@ -360,18 +360,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 13}}</string> + <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> <string>415 94 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> @@ -385,9 +385,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 401}}</string> - <key>RubberWindowFrame</key> - <string>415 94 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 414}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -441,7 +439,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 363}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>415 94 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -469,11 +469,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D7B4C1F7FAC58007AB60F</string> + <string>8B793C3A21F5FF8A006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D7B4D1F7FAC58007AB60F</string> + <string>8B793C3B21F5FF8A006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B9D7B4E1F7FAC58007AB60F</string> + <string>8B793C3C21F5FF8A006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -626,7 +626,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528460888.62616801</real> + <real>569769866.66388798</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -643,7 +643,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D7B4F1F7FAC58007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj</string> </array> <key>WindowString</key> diff --git a/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/project.pbxproj b/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/project.pbxproj index 2863d6b..80d9369 100755 --- a/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/project.pbxproj +++ b/plugins/MacVST/IronOxideClassic/IronOxideClassic.xcodeproj/project.pbxproj @@ -1894,7 +1894,7 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = { + 8D01CCC60486CAD60068D4B7 /* IronOxideClassic */ = { isa = PBXNativeTarget; buildConfigurationList = 24BEAAED08919AE700E695F9 /* Build configuration list for PBXNativeTarget "IronOxideClassic" */; buildPhases = ( @@ -1947,7 +1947,7 @@ ); projectRoot = ""; targets = ( - 8D01CCC60486CAD60068D4B7 /* AudioUnit */, + 8D01CCC60486CAD60068D4B7 /* IronOxideClassic */, ); }; /* End PBXProject section */ diff --git a/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.cpp b/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.cpp index 012d8a3..8ce7103 100755 --- a/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.cpp +++ b/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.cpp @@ -22,12 +22,9 @@ IronOxideClassic::IronOxideClassic(audioMasterCallback audioMaster) : iirSampleAL = iirSampleBL = 0.0; fastIIRAR = fastIIRBR = slowIIRAR = slowIIRBR = 0.0; iirSampleAR = iirSampleBR = 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/IronOxideClassic/source/IronOxideClassic.h b/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.h index b7f8bfa..bafb457 100755 --- a/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.h +++ b/plugins/MacVST/IronOxideClassic/source/IronOxideClassic.h @@ -71,12 +71,9 @@ private: double slowIIRBR; int gcount; - - 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/IronOxideClassic/source/IronOxideClassicProc.cpp b/plugins/MacVST/IronOxideClassic/source/IronOxideClassicProc.cpp index c245166..97bbaca 100755 --- a/plugins/MacVST/IronOxideClassic/source/IronOxideClassicProc.cpp +++ b/plugins/MacVST/IronOxideClassic/source/IronOxideClassicProc.cpp @@ -17,9 +17,6 @@ void IronOxideClassic::processReplacing(float **inputs, float **outputs, VstInt3 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 inputgain = pow(10.0,((A*36.0)-18.0)/20.0); double outputgain = pow(10.0,((C*36.0)-18.0)/20.0); @@ -343,26 +340,16 @@ void IronOxideClassic::processReplacing(float **inputs, float **outputs, VstInt3 inputSampleL *= outputgain; 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; @@ -384,9 +371,6 @@ void IronOxideClassic::processDoubleReplacing(double **inputs, double **outputs, 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 inputgain = pow(10.0,((A*36.0)-18.0)/20.0); double outputgain = pow(10.0,((C*36.0)-18.0)/20.0); @@ -710,26 +694,18 @@ void IronOxideClassic::processDoubleReplacing(double **inputs, double **outputs, inputSampleL *= outputgain; 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; |