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/C5RawBuss | |
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/C5RawBuss')
5 files changed, 39 insertions, 69 deletions
diff --git a/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.pbxuser index c0464d7..32a7430 100755 --- a/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.pbxuser @@ -49,8 +49,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 538698967; - PBXWorkspaceStateSaveDate = 538698967; + PBXPerProjectTemplateStateSaveDate = 569733207; + PBXWorkspaceStateSaveDate = 569733207; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -82,9 +82,9 @@ }; 24D8286F09A914000093AEF8 /* C5RawBussProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 3744}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 3250}}"; sepNavSelRange = "{9641, 0}"; - sepNavVisRange = "{4872, 1806}"; + sepNavVisRange = "{3352, 1921}"; sepNavWindowFrame = "{{9, 47}, {895, 831}}"; }; }; diff --git a/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.perspectivev3 index 672431d..05bb702 100755 --- a/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/C5RawBuss/C5RawBuss.xcodeproj/christopherjohnson.perspectivev3 @@ -256,6 +256,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -321,7 +323,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>21 469 688 404 0 0 1440 878 </string> + <string>488 410 688 404 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -360,7 +362,7 @@ <key>Frame</key> <string>{{0, 0}, {481, 0}}</string> <key>RubberWindowFrame</key> - <string>21 469 688 404 0 0 1440 878 </string> + <string>488 410 688 404 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -384,6 +386,8 @@ <dict> <key>Frame</key> <string>{{10, 27}, {481, 331}}</string> + <key>RubberWindowFrame</key> + <string>488 410 688 404 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -438,8 +442,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {481, 331}}</string> - <key>RubberWindowFrame</key> - <string>21 469 688 404 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -467,11 +469,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B4E5763201BE4DB00B5DC2A</string> + <string>8B79351E21F57085006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B4E5764201BE4DB00B5DC2A</string> + <string>8B79351F21F57085006E9731</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8B4E5765201BE4DB00B5DC2A</string> + <string>8B79352021F57085006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -624,7 +626,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>538701942.76463199</real> + <real>569733253.24398398</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -641,11 +643,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B4E57C7201BF07600B5DC2A</string> - <string>/Users/christopherjohnson/Desktop/C5RawBuss/C5RawBuss.xcodeproj</string> + <string>8B79352121F57085006E9731</string> + <string>/Users/christopherjohnson/Desktop/MacVST/C5RawBuss/C5RawBuss.xcodeproj</string> </array> <key>WindowString</key> - <string>21 469 688 404 0 0 1440 878 </string> + <string>488 410 688 404 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/C5RawBuss/source/C5RawBuss.cpp b/plugins/MacVST/C5RawBuss/source/C5RawBuss.cpp index 14b4dc5..8fba0ef 100755 --- a/plugins/MacVST/C5RawBuss/source/C5RawBuss.cpp +++ b/plugins/MacVST/C5RawBuss/source/C5RawBuss.cpp @@ -17,11 +17,8 @@ C5RawBuss::C5RawBuss(audioMasterCallback audioMaster) : lastSampleBussL = 0.0; lastFXBussR = 0.0; lastSampleBussR = 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/C5RawBuss/source/C5RawBuss.h b/plugins/MacVST/C5RawBuss/source/C5RawBuss.h index 5a409bc..f4d01fe 100755 --- a/plugins/MacVST/C5RawBuss/source/C5RawBuss.h +++ b/plugins/MacVST/C5RawBuss/source/C5RawBuss.h @@ -52,11 +52,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 lastFXBussL; double lastSampleBussL; diff --git a/plugins/MacVST/C5RawBuss/source/C5RawBussProc.cpp b/plugins/MacVST/C5RawBuss/source/C5RawBussProc.cpp index 1bf5eec..fab4612 100755 --- a/plugins/MacVST/C5RawBuss/source/C5RawBussProc.cpp +++ b/plugins/MacVST/C5RawBuss/source/C5RawBussProc.cpp @@ -14,9 +14,6 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl float* out1 = outputs[0]; float* out2 = outputs[1]; - float fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double centering = A * 0.5; centering = 1.0 - pow(centering,5); @@ -111,25 +108,14 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl //build new signal off what was present in output last time //slew aspect - //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; @@ -148,9 +134,6 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt double* out1 = outputs[0]; double* out2 = outputs[1]; - double fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; long double centering = A * 0.5; centering = 1.0 - pow(centering,5); @@ -245,25 +228,16 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt //build new signal off what was present in output last time //slew aspect - //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; |