From 83f022409ae017f4ac947430b4ec185f0196badc Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Tue, 19 Feb 2019 08:35:31 -0500 Subject: DitherFloat update --- plugins/LinuxVST/src/DitherFloat/DitherFloat.cpp | 3 +- plugins/LinuxVST/src/DitherFloat/DitherFloat.h | 3 +- .../LinuxVST/src/DitherFloat/DitherFloatProc.cpp | 28 ++++---- plugins/MacAU/DitherFloat/DitherFloat.cpp | 31 ++++++--- plugins/MacAU/DitherFloat/DitherFloat.h | 2 +- .../christopherjohnson.pbxuser | 58 +++++++++------- .../christopherjohnson.perspectivev3 | 37 +++++----- .../christopherjohnson.pbxuser | 77 +++++++++++++------- .../christopherjohnson.perspectivev3 | 81 +++++++++++++++++----- plugins/MacVST/DitherFloat/source/DitherFloat.cpp | 3 +- plugins/MacVST/DitherFloat/source/DitherFloat.h | 3 +- .../MacVST/DitherFloat/source/DitherFloatProc.cpp | 28 ++++---- plugins/WinVST/DitherFloat/DitherFloat.cpp | 3 +- plugins/WinVST/DitherFloat/DitherFloat.h | 3 +- plugins/WinVST/DitherFloat/DitherFloatProc.cpp | 28 ++++---- 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 @@ Layout + BecomeActive + ContentConfiguration PBXBottomSmartGroupGIDs @@ -300,7 +302,7 @@ PBXSmartGroupTreeModuleOutlineStateSelectionKey - 4 + 3 2 1 0 @@ -324,7 +326,7 @@ 288 RubberWindowFrame - 566 208 841 654 0 0 1440 878 + 75 187 841 654 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -335,8 +337,6 @@ Dock - BecomeActive - ContentConfiguration PBXProjectModuleGUID @@ -354,11 +354,11 @@ _historyCapacity 0 bookmark - 8BEF85AD21F6801300FEF113 + 8B6F22E7221C35D70084A947 history 8BEF85AB21F6801300FEF113 - 8BEF85AC21F6801300FEF113 + 8B6F22BF221C34010084A947 SplitCount @@ -372,18 +372,18 @@ GeometryConfiguration Frame - {{0, 0}, {531, 413}} + {{0, 0}, {531, 399}} RubberWindowFrame - 566 208 841 654 0 0 1440 878 + 75 187 841 654 0 0 1440 878 Module PBXNavigatorGroup Proportion - 413pt + 399pt Proportion - 195pt + 209pt Tabs @@ -397,9 +397,9 @@ GeometryConfiguration Frame - {{10, 27}, {531, 168}} + {{10, 27}, {531, 182}} RubberWindowFrame - 566 208 841 654 0 0 1440 878 + 75 187 841 654 0 0 1440 878 Module XCDetailModule @@ -453,7 +453,7 @@ GeometryConfiguration Frame - {{10, 27}, {531, 365}} + {{10, 27}, {531, 175}} Module PBXBuildResultsModule @@ -481,11 +481,11 @@ TableOfContents - 8BEF85AE21F6801300FEF113 + 8B6F22E8221C35D70084A947 1CA23ED40692098700951B8B - 8BEF85AF21F6801300FEF113 + 8B6F22E9221C35D70084A947 8BD7274A1D46E5A5000176F0 - 8BEF85B021F6801300FEF113 + 8B6F22EA221C35D70084A947 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -658,7 +658,7 @@ StatusbarIsVisible TimeStamp - 569802771.16773605 + 572274135.023754 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -675,10 +675,11 @@ 5 WindowOrderList + 8B6F22EB221C35D70084A947 /Users/christopherjohnson/Desktop/MacAU/DitherFloat/DitherFloat.xcodeproj WindowString - 566 208 841 654 0 0 1440 878 + 75 187 841 654 0 0 1440 878 WindowToolsV3 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 @@ OpenEditors - + + + Content + + PBXProjectModuleGUID + 8B6F22F9221C37910084A947 + PBXProjectModuleLabel + DitherFloatProc.cpp + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 8B6F22FA221C37910084A947 + PBXProjectModuleLabel + DitherFloatProc.cpp + _historyCapacity + 0 + bookmark + 8B6F22FB221C37910084A947 + history + + 8B6F22ED221C35E90084A947 + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {895, 734}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 64 103 895 775 0 0 1440 878 + + + PerspectiveWidths 810 @@ -321,7 +362,7 @@ 185 RubberWindowFrame - 291 285 810 487 0 0 1440 878 + 121 270 810 487 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -337,7 +378,7 @@ PBXProjectModuleGUID 8B0237581D42B1C400E1E8C8 PBXProjectModuleLabel - DitherFloatProc.cpp + audioeffectx.cpp PBXSplitModuleInNavigatorKey Split0 @@ -345,14 +386,15 @@ PBXProjectModuleGUID 8B0237591D42B1C400E1E8C8 PBXProjectModuleLabel - DitherFloatProc.cpp + audioeffectx.cpp _historyCapacity 0 bookmark - 8BEF85B621F6802400FEF113 + 8B6F22F8221C37910084A947 history - 8BEF85B121F6801400FEF113 + 8B6F22F6221C37910084A947 + 8B6F22F7221C37910084A947 SplitCount @@ -366,18 +408,18 @@ GeometryConfiguration Frame - {{0, 0}, {603, 132}} + {{0, 0}, {603, 117}} RubberWindowFrame - 291 285 810 487 0 0 1440 878 + 121 270 810 487 0 0 1440 878 Module PBXNavigatorGroup Proportion - 132pt + 117pt Proportion - 309pt + 324pt Tabs @@ -391,7 +433,7 @@ GeometryConfiguration Frame - {{10, 27}, {603, 414}} + {{10, 27}, {603, 297}} Module XCDetailModule @@ -445,9 +487,9 @@ GeometryConfiguration Frame - {{10, 27}, {603, 282}} + {{10, 27}, {603, 297}} RubberWindowFrame - 291 285 810 487 0 0 1440 878 + 121 270 810 487 0 0 1440 878 Module PBXBuildResultsModule @@ -475,11 +517,11 @@ TableOfContents - 8BEF853D21F67C3100FEF113 + 8B6F22CF221C35700084A947 1CA23ED40692098700951B8B - 8BEF853E21F67C3100FEF113 + 8B6F22D0221C35700084A947 8B0237581D42B1C400E1E8C8 - 8BEF853F21F67C3100FEF113 + 8B6F22D1221C35700084A947 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -632,7 +674,7 @@ StatusbarIsVisible TimeStamp - 569802788.52883804 + 572274577.26009297 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -649,10 +691,11 @@ 5 WindowOrderList - /Users/christopherjohnson/Desktop/DitherFloat/DitherFloat.xcodeproj + 8B6F22F9221C37910084A947 + /Users/christopherjohnson/Desktop/MacVST/DitherFloat/DitherFloat.xcodeproj WindowString - 291 285 810 487 0 0 1440 878 + 121 270 810 487 0 0 1440 878 WindowToolsV3 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 -- cgit v1.2.3