diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-02-19 08:35:31 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-02-19 08:35:31 -0500 |
commit | 83f022409ae017f4ac947430b4ec185f0196badc (patch) | |
tree | 0695ba5bdb872cd72356a62c280fbef490c5aac4 | |
parent | e5da517d26576cbae2f3bc64fc0b9733a5555815 (diff) | |
download | airwindows-lv2-port-83f022409ae017f4ac947430b4ec185f0196badc.tar.gz airwindows-lv2-port-83f022409ae017f4ac947430b4ec185f0196badc.tar.bz2 airwindows-lv2-port-83f022409ae017f4ac947430b4ec185f0196badc.zip |
DitherFloat update
15 files changed, 232 insertions, 156 deletions
diff --git a/plugins/LinuxVST/src/DitherFloat/DitherFloat.cpp b/plugins/LinuxVST/src/DitherFloat/DitherFloat.cpp index ffd9e94..05213a6 100755 --- a/plugins/LinuxVST/src/DitherFloat/DitherFloat.cpp +++ b/plugins/LinuxVST/src/DitherFloat/DitherFloat.cpp @@ -14,8 +14,7 @@ DitherFloat::DitherFloat(audioMasterCallback audioMaster) : { A = 0.0; B = 1.0; - fpNShapeL = 0.0; - fpNShapeR = 0.0; + fpd = 17; //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/LinuxVST/src/DitherFloat/DitherFloat.h b/plugins/LinuxVST/src/DitherFloat/DitherFloat.h index b8ddf51..08cce74 100755 --- a/plugins/LinuxVST/src/DitherFloat/DitherFloat.h +++ b/plugins/LinuxVST/src/DitherFloat/DitherFloat.h @@ -53,8 +53,7 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeL; - long double fpNShapeR; + uint32_t fpd; //default stuff float A; diff --git a/plugins/LinuxVST/src/DitherFloat/DitherFloatProc.cpp b/plugins/LinuxVST/src/DitherFloat/DitherFloatProc.cpp index 3c76a1a..a7121e8 100755 --- a/plugins/LinuxVST/src/DitherFloat/DitherFloatProc.cpp +++ b/plugins/LinuxVST/src/DitherFloat/DitherFloatProc.cpp @@ -67,16 +67,15 @@ void DitherFloat::processReplacing(float **inputs, float **outputs, VstInt32 sam long double inputSampleR = *in2 + (gain-1); - - //stereo 32 bit dither, made small and tidy. + + //begin stereo 32 bit floating point dither int expon; frexpf((float)inputSampleL, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; frexpf((float)inputSampleR, &expon); - dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; - //end 32 bit dither - + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; + //end stereo 32 bit floating point dither inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point @@ -154,15 +153,14 @@ void DitherFloat::processDoubleReplacing(double **inputs, double **outputs, VstI - //stereo 32 bit dither, made small and tidy. + //begin stereo 32 bit floating point dither int expon; frexpf((float)inputSampleL, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; frexpf((float)inputSampleR, &expon); - dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; - //end 32 bit dither - + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; + //end stereo 32 bit floating point dither inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point diff --git a/plugins/MacAU/DitherFloat/DitherFloat.cpp b/plugins/MacAU/DitherFloat/DitherFloat.cpp index 7939fbe..f03ca76 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.cpp +++ b/plugins/MacAU/DitherFloat/DitherFloat.cpp @@ -165,7 +165,7 @@ ComponentResult DitherFloat::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void DitherFloat::DitherFloatKernel::Reset() { - fpNShape = 0.0; + fpd = 17; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -226,26 +226,37 @@ void DitherFloat::DitherFloatKernel::Process( const Float32 *inSourceP, case 32: gain = 4294967296.0; break; } //we are directly punching in the gain values rather than calculating them + //gain *= gain; //for testing with double precision, 64 bit while (nSampleFrames-- > 0) { long double inputSample = *sourceP + (gain-1); //this offsets the float into total truncation-land. - - - //begin 32 bit floating point dither - int expon; frexpf((Float32)inputSample, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo - inputSample += (dither-fpNShape); fpNShape = dither; + int expon; frexpf((float)inputSample, &expon); + fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; + inputSample += (fpd*3.4e-36l*pow(2,expon+62) * blend); //remove 'blend' for real use, it's for the demo + //end 32 bit floating point dither + + /* copy and paste into code, fpd is a uint32_t initialized as 17 (NOT 0) + + //begin 32 bit floating point dither + int expon; frexpf((float)inputSample, &expon); + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSample += (fpd*3.4e-36l*pow(2,expon+62)); //end 32 bit floating point dither + //begin 64 bit floating point dither + int expon; frexp((double)inputSample, &expon); + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSample += (fpd*6.4e-45l*pow(2,expon+62)); + //end 64 bit floating point dither + + */ - - - inputSample = (Float32)inputSample; //equivalent of 'floor' for 32 bit floating point + inputSample = (float)inputSample; //equivalent of 'floor' for 32 bit floating point //We do that separately, we're truncating to floating point WHILE heavily offset. *destP = inputSample - (gain-1); //this de-offsets the float. diff --git a/plugins/MacAU/DitherFloat/DitherFloat.h b/plugins/MacAU/DitherFloat/DitherFloat.h index 0eea62e..f692eff 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.h +++ b/plugins/MacAU/DitherFloat/DitherFloat.h @@ -128,7 +128,7 @@ public: virtual void Reset(); private: - long double fpNShape; + uint32_t fpd; }; }; diff --git a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser index b851c08..3614dab 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser @@ -49,24 +49,44 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 569802726; - PBXWorkspaceStateSaveDate = 569802726; + PBXPerProjectTemplateStateSaveDate = 572274037; + PBXWorkspaceStateSaveDate = 572274037; }; perUserProjectItems = { + 8B6F22BF221C34010084A947 /* PBXTextBookmark */ = 8B6F22BF221C34010084A947 /* PBXTextBookmark */; + 8B6F22E7221C35D70084A947 /* PBXTextBookmark */ = 8B6F22E7221C35D70084A947 /* PBXTextBookmark */; 8BEF85AB21F6801300FEF113 /* PlistBookmark */ = 8BEF85AB21F6801300FEF113 /* PlistBookmark */; - 8BEF85AC21F6801300FEF113 /* PBXBookmark */ = 8BEF85AC21F6801300FEF113 /* PBXBookmark */; - 8BEF85AD21F6801300FEF113 /* PBXTextBookmark */ = 8BEF85AD21F6801300FEF113 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; + 8B6F22BF221C34010084A947 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; + name = "DitherFloat.cpp: 257"; + rLen = 0; + rLoc = 10887; + rType = 0; + vrLen = 1139; + vrLoc = 9739; + }; + 8B6F22E7221C35D70084A947 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; + name = "DitherFloat.cpp: 257"; + rLen = 0; + rLoc = 10887; + rType = 0; + vrLen = 1139; + vrLoc = 9739; + }; 8BA05A660720730100365D66 /* DitherFloat.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1048, 3588}}"; - sepNavSelRange = "{10182, 58}"; - sepNavVisRange = "{9784, 862}"; - sepNavWindowFrame = "{{643, 56}, {1300, 822}}"; + sepNavIntBoundsRect = "{{0, 0}, {824, 3731}}"; + sepNavSelRange = "{10887, 0}"; + sepNavVisRange = "{9739, 1139}"; + sepNavWindowFrame = "{{526, 20}, {901, 799}}"; }; }; 8BA05A690720730100365D66 /* DitherFloatVersion.h */ = { @@ -80,9 +100,9 @@ 8BC6025B073B072D006C4272 /* DitherFloat.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1253, 1794}}"; - sepNavSelRange = "{3211, 0}"; - sepNavVisRange = "{2595, 1482}"; - sepNavWindowFrame = "{{717, 56}, {1300, 822}}"; + sepNavSelRange = "{5227, 16}"; + sepNavVisRange = "{3668, 1685}"; + sepNavWindowFrame = "{{140, 56}, {1300, 822}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { @@ -109,21 +129,7 @@ ); name = /Users/christopherjohnson/Desktop/MacAU/DitherFloat/Info.plist; rLen = 0; - rLoc = 9223372036854775807; - }; - 8BEF85AC21F6801300FEF113 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; - }; - 8BEF85AD21F6801300FEF113 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* DitherFloat.cpp */; - name = "DitherFloat.cpp: 240"; - rLen = 58; - rLoc = 10182; - rType = 0; - vrLen = 862; - vrLoc = 9784; + rLoc = 9223372036854775808; }; 8D01CCC60486CAD60068D4B7 /* DitherFloat */ = { activeExec = 0; diff --git a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 index c05c55f..c26487f 100755 --- a/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 @@ -256,6 +256,8 @@ <key>Layout</key> <array> <dict> + <key>BecomeActive</key> + <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -300,7 +302,7 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>4</integer> + <integer>3</integer> <integer>2</integer> <integer>1</integer> <integer>0</integer> @@ -324,7 +326,7 @@ <real>288</real> </array> <key>RubberWindowFrame</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -335,8 +337,6 @@ <key>Dock</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXProjectModuleGUID</key> @@ -354,11 +354,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BEF85AD21F6801300FEF113</string> + <string>8B6F22E7221C35D70084A947</string> <key>history</key> <array> <string>8BEF85AB21F6801300FEF113</string> - <string>8BEF85AC21F6801300FEF113</string> + <string>8B6F22BF221C34010084A947</string> </array> </dict> <key>SplitCount</key> @@ -372,18 +372,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {531, 413}}</string> + <string>{{0, 0}, {531, 399}}</string> <key>RubberWindowFrame</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>413pt</string> + <string>399pt</string> </dict> <dict> <key>Proportion</key> - <string>195pt</string> + <string>209pt</string> <key>Tabs</key> <array> <dict> @@ -397,9 +397,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 168}}</string> + <string>{{10, 27}, {531, 182}}</string> <key>RubberWindowFrame</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -453,7 +453,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {531, 365}}</string> + <string>{{10, 27}, {531, 175}}</string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -481,11 +481,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BEF85AE21F6801300FEF113</string> + <string>8B6F22E8221C35D70084A947</string> <string>1CA23ED40692098700951B8B</string> - <string>8BEF85AF21F6801300FEF113</string> + <string>8B6F22E9221C35D70084A947</string> <string>8BD7274A1D46E5A5000176F0</string> - <string>8BEF85B021F6801300FEF113</string> + <string>8B6F22EA221C35D70084A947</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -658,7 +658,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>569802771.16773605</real> + <real>572274135.023754</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -675,10 +675,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> + <string>8B6F22EB221C35D70084A947</string> <string>/Users/christopherjohnson/Desktop/MacAU/DitherFloat/DitherFloat.xcodeproj</string> </array> <key>WindowString</key> - <string>566 208 841 654 0 0 1440 878 </string> + <string>75 187 841 654 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser index 1fc2619..e742ecf 100755 --- a/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,15 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 569801710; - PBXWorkspaceStateSaveDate = 569801710; + PBXPerProjectTemplateStateSaveDate = 572274028; + PBXWorkspaceStateSaveDate = 572274028; }; perUserProjectItems = { - 8BEF85B121F6801400FEF113 /* XCBuildMessageTextBookmark */ = 8BEF85B121F6801400FEF113 /* XCBuildMessageTextBookmark */; - 8BEF85B621F6802400FEF113 /* PBXTextBookmark */ = 8BEF85B621F6802400FEF113 /* PBXTextBookmark */; + 8B6F22ED221C35E90084A947 /* PBXBookmark */ = 8B6F22ED221C35E90084A947 /* PBXBookmark */; + 8B6F22F6221C37910084A947 /* PBXTextBookmark */ = 8B6F22F6221C37910084A947 /* PBXTextBookmark */; + 8B6F22F7221C37910084A947 /* XCBuildMessageTextBookmark */ = 8B6F22F7221C37910084A947 /* XCBuildMessageTextBookmark */; + 8B6F22F8221C37910084A947 /* PBXTextBookmark */ = 8B6F22F8221C37910084A947 /* PBXTextBookmark */; + 8B6F22FB221C37910084A947 /* PBXTextBookmark */ = 8B6F22FB221C37910084A947 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -62,34 +65,34 @@ }; 2407DEB6089929BA00EB68BF /* DitherFloat.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1664}}"; - sepNavSelRange = "{3601, 0}"; - sepNavVisRange = "{2649, 2103}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 1651}}"; + sepNavSelRange = "{496, 0}"; + sepNavVisRange = "{0, 2132}"; sepNavWindowFrame = "{{166, 47}, {895, 831}}"; }; }; 245463B80991757100464AD3 /* DitherFloat.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 845}}"; - sepNavSelRange = "{2508, 0}"; - sepNavVisRange = "{292, 2228}"; - sepNavWindowFrame = "{{20, 47}, {895, 831}}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 832}}"; + sepNavSelRange = "{2416, 0}"; + sepNavVisRange = "{268, 2219}"; + sepNavWindowFrame = "{{471, 47}, {895, 831}}"; }; }; 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {859, 20267}}"; + sepNavIntBoundsRect = "{{0, 0}, {838, 19760}}"; sepNavSelRange = "{10616, 0}"; - sepNavVisRange = "{9653, 2414}"; + sepNavVisRange = "{10459, 280}"; sepNavWindowFrame = "{{15, 42}, {895, 831}}"; }; }; 24D8286F09A914000093AEF8 /* DitherFloatProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {649, 2652}}"; - sepNavSelRange = "{569, 0}"; - sepNavVisRange = "{451, 169}"; - sepNavWindowFrame = "{{68, 47}, {895, 831}}"; + sepNavIntBoundsRect = "{{0, 0}, {848, 2431}}"; + sepNavSelRange = "{5133, 0}"; + sepNavVisRange = "{0, 1576}"; + sepNavWindowFrame = "{{64, 47}, {895, 831}}"; }; }; 8B02375E1D42B1C400E1E8C8 /* Source Control */ = { @@ -106,24 +109,48 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; - 8BEF85B121F6801400FEF113 /* XCBuildMessageTextBookmark */ = { + 8B6F22ED221C35E90084A947 /* PBXBookmark */ = { + isa = PBXBookmark; + fRef = 24D8286F09A914000093AEF8 /* DitherFloatProc.cpp */; + }; + 8B6F22F6221C37910084A947 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - comments = "Unused variable 'blend'"; fRef = 24D8286F09A914000093AEF8 /* DitherFloatProc.cpp */; + name = "DitherFloatProc.cpp: 22"; + rLen = 0; + rLoc = 569; + rType = 0; + vrLen = 139; + vrLoc = 479; + }; + 8B6F22F7221C37910084A947 /* XCBuildMessageTextBookmark */ = { + isa = PBXTextBookmark; + comments = "Deprecated conversion from string constant to 'char*'"; + fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; fallbackIsa = XCBuildMessageTextBookmark; rLen = 1; - rLoc = 21; + rLoc = 306; rType = 1; }; - 8BEF85B621F6802400FEF113 /* PBXTextBookmark */ = { + 8B6F22F8221C37910084A947 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */; + name = "audioeffectx.cpp: 307"; + rLen = 0; + rLoc = 10616; + rType = 0; + vrLen = 280; + vrLoc = 10459; + }; + 8B6F22FB221C37910084A947 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 24D8286F09A914000093AEF8 /* DitherFloatProc.cpp */; - name = "DitherFloatProc.cpp: 22"; + name = "DitherFloatProc.cpp: 164"; rLen = 0; - rLoc = 569; + rLoc = 5133; rType = 0; - vrLen = 169; - vrLoc = 451; + vrLen = 1576; + vrLoc = 0; }; 8D01CCC60486CAD60068D4B7 /* DitherFloat */ = { activeExec = 0; diff --git a/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 index 3612d29..d671f7c 100755 --- a/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/DitherFloat/DitherFloat.xcodeproj/christopherjohnson.perspectivev3 @@ -222,7 +222,48 @@ </dict> </array> <key>OpenEditors</key> - <array/> + <array> + <dict> + <key>Content</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>8B6F22F9221C37910084A947</string> + <key>PBXProjectModuleLabel</key> + <string>DitherFloatProc.cpp</string> + <key>PBXSplitModuleInNavigatorKey</key> + <dict> + <key>Split0</key> + <dict> + <key>PBXProjectModuleGUID</key> + <string>8B6F22FA221C37910084A947</string> + <key>PBXProjectModuleLabel</key> + <string>DitherFloatProc.cpp</string> + <key>_historyCapacity</key> + <integer>0</integer> + <key>bookmark</key> + <string>8B6F22FB221C37910084A947</string> + <key>history</key> + <array> + <string>8B6F22ED221C35E90084A947</string> + </array> + </dict> + <key>SplitCount</key> + <string>1</string> + </dict> + <key>StatusBarVisibility</key> + <true/> + </dict> + <key>Geometry</key> + <dict> + <key>Frame</key> + <string>{{0, 20}, {895, 734}}</string> + <key>PBXModuleWindowStatusBarHidden2</key> + <false/> + <key>RubberWindowFrame</key> + <string>64 103 895 775 0 0 1440 878 </string> + </dict> + </dict> + </array> <key>PerspectiveWidths</key> <array> <integer>810</integer> @@ -321,7 +362,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>291 285 810 487 0 0 1440 878 </string> + <string>121 270 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -337,7 +378,7 @@ <key>PBXProjectModuleGUID</key> <string>8B0237581D42B1C400E1E8C8</string> <key>PBXProjectModuleLabel</key> - <string>DitherFloatProc.cpp</string> + <string>audioeffectx.cpp</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -345,14 +386,15 @@ <key>PBXProjectModuleGUID</key> <string>8B0237591D42B1C400E1E8C8</string> <key>PBXProjectModuleLabel</key> - <string>DitherFloatProc.cpp</string> + <string>audioeffectx.cpp</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8BEF85B621F6802400FEF113</string> + <string>8B6F22F8221C37910084A947</string> <key>history</key> <array> - <string>8BEF85B121F6801400FEF113</string> + <string>8B6F22F6221C37910084A947</string> + <string>8B6F22F7221C37910084A947</string> </array> </dict> <key>SplitCount</key> @@ -366,18 +408,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 132}}</string> + <string>{{0, 0}, {603, 117}}</string> <key>RubberWindowFrame</key> - <string>291 285 810 487 0 0 1440 878 </string> + <string>121 270 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 +433,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 297}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -445,9 +487,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 282}}</string> + <string>{{10, 27}, {603, 297}}</string> <key>RubberWindowFrame</key> - <string>291 285 810 487 0 0 1440 878 </string> + <string>121 270 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -475,11 +517,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BEF853D21F67C3100FEF113</string> + <string>8B6F22CF221C35700084A947</string> <string>1CA23ED40692098700951B8B</string> - <string>8BEF853E21F67C3100FEF113</string> + <string>8B6F22D0221C35700084A947</string> <string>8B0237581D42B1C400E1E8C8</string> - <string>8BEF853F21F67C3100FEF113</string> + <string>8B6F22D1221C35700084A947</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -632,7 +674,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>569802788.52883804</real> + <real>572274577.26009297</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -649,10 +691,11 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>/Users/christopherjohnson/Desktop/DitherFloat/DitherFloat.xcodeproj</string> + <string>8B6F22F9221C37910084A947</string> + <string>/Users/christopherjohnson/Desktop/MacVST/DitherFloat/DitherFloat.xcodeproj</string> </array> <key>WindowString</key> - <string>291 285 810 487 0 0 1440 878 </string> + <string>121 270 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> diff --git a/plugins/MacVST/DitherFloat/source/DitherFloat.cpp b/plugins/MacVST/DitherFloat/source/DitherFloat.cpp index ffd9e94..05213a6 100755 --- a/plugins/MacVST/DitherFloat/source/DitherFloat.cpp +++ b/plugins/MacVST/DitherFloat/source/DitherFloat.cpp @@ -14,8 +14,7 @@ DitherFloat::DitherFloat(audioMasterCallback audioMaster) : { A = 0.0; B = 1.0; - fpNShapeL = 0.0; - fpNShapeR = 0.0; + fpd = 17; //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/DitherFloat/source/DitherFloat.h b/plugins/MacVST/DitherFloat/source/DitherFloat.h index b8ddf51..08cce74 100755 --- a/plugins/MacVST/DitherFloat/source/DitherFloat.h +++ b/plugins/MacVST/DitherFloat/source/DitherFloat.h @@ -53,8 +53,7 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeL; - long double fpNShapeR; + uint32_t fpd; //default stuff float A; diff --git a/plugins/MacVST/DitherFloat/source/DitherFloatProc.cpp b/plugins/MacVST/DitherFloat/source/DitherFloatProc.cpp index 3c76a1a..a7121e8 100755 --- a/plugins/MacVST/DitherFloat/source/DitherFloatProc.cpp +++ b/plugins/MacVST/DitherFloat/source/DitherFloatProc.cpp @@ -67,16 +67,15 @@ void DitherFloat::processReplacing(float **inputs, float **outputs, VstInt32 sam long double inputSampleR = *in2 + (gain-1); - - //stereo 32 bit dither, made small and tidy. + + //begin stereo 32 bit floating point dither int expon; frexpf((float)inputSampleL, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; frexpf((float)inputSampleR, &expon); - dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; - //end 32 bit dither - + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; + //end stereo 32 bit floating point dither inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point @@ -154,15 +153,14 @@ void DitherFloat::processDoubleReplacing(double **inputs, double **outputs, VstI - //stereo 32 bit dither, made small and tidy. + //begin stereo 32 bit floating point dither int expon; frexpf((float)inputSampleL, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; frexpf((float)inputSampleR, &expon); - dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; - //end 32 bit dither - + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; + //end stereo 32 bit floating point dither inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point diff --git a/plugins/WinVST/DitherFloat/DitherFloat.cpp b/plugins/WinVST/DitherFloat/DitherFloat.cpp index ffd9e94..05213a6 100755 --- a/plugins/WinVST/DitherFloat/DitherFloat.cpp +++ b/plugins/WinVST/DitherFloat/DitherFloat.cpp @@ -14,8 +14,7 @@ DitherFloat::DitherFloat(audioMasterCallback audioMaster) : { A = 0.0; B = 1.0; - fpNShapeL = 0.0; - fpNShapeR = 0.0; + fpd = 17; //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/WinVST/DitherFloat/DitherFloat.h b/plugins/WinVST/DitherFloat/DitherFloat.h index b8ddf51..08cce74 100755 --- a/plugins/WinVST/DitherFloat/DitherFloat.h +++ b/plugins/WinVST/DitherFloat/DitherFloat.h @@ -53,8 +53,7 @@ private: char _programName[kVstMaxProgNameLen + 1]; std::set< std::string > _canDo; - long double fpNShapeL; - long double fpNShapeR; + uint32_t fpd; //default stuff float A; diff --git a/plugins/WinVST/DitherFloat/DitherFloatProc.cpp b/plugins/WinVST/DitherFloat/DitherFloatProc.cpp index 3c76a1a..a7121e8 100755 --- a/plugins/WinVST/DitherFloat/DitherFloatProc.cpp +++ b/plugins/WinVST/DitherFloat/DitherFloatProc.cpp @@ -67,16 +67,15 @@ void DitherFloat::processReplacing(float **inputs, float **outputs, VstInt32 sam long double inputSampleR = *in2 + (gain-1); - - //stereo 32 bit dither, made small and tidy. + + //begin stereo 32 bit floating point dither int expon; frexpf((float)inputSampleL, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; frexpf((float)inputSampleR, &expon); - dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; - //end 32 bit dither - + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; + //end stereo 32 bit floating point dither inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point @@ -154,15 +153,14 @@ void DitherFloat::processDoubleReplacing(double **inputs, double **outputs, VstI - //stereo 32 bit dither, made small and tidy. + //begin stereo 32 bit floating point dither int expon; frexpf((float)inputSampleL, &expon); - long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; frexpf((float)inputSampleR, &expon); - dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62) * blend; //remove 'blend' for real use, it's for the demo; - inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; - //end 32 bit dither - + fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; + inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; + //end stereo 32 bit floating point dither inputSampleL = (float)inputSampleL; //equivalent of 'floor' for 32 bit floating point |