From 83f022409ae017f4ac947430b4ec185f0196badc Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Tue, 19 Feb 2019 08:35:31 -0500 Subject: DitherFloat update --- .../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 ++++---- 5 files changed, 129 insertions(+), 63 deletions(-) (limited to 'plugins/MacVST/DitherFloat') 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 -- cgit v1.2.3