From 6e0febe954289baac253c2b432d1dc4dec403c30 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 14 Jun 2020 21:15:05 -0400 Subject: Dark Redux --- .../Dark/Dark.xcodeproj/christopherjohnson.pbxuser | 72 ++++++++++++++++++---- .../christopherjohnson.perspectivev3 | 45 ++++++++------ plugins/MacVST/Dark/source/Dark.cpp | 8 +++ plugins/MacVST/Dark/source/Dark.h | 4 +- plugins/MacVST/Dark/source/DarkProc.cpp | 50 +++++++-------- 5 files changed, 119 insertions(+), 60 deletions(-) (limited to 'plugins/MacVST') diff --git a/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.pbxuser index 7b8c21e..ab4e77f 100755 --- a/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.pbxuser @@ -49,8 +49,14 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 612640564; - PBXWorkspaceStateSaveDate = 612640564; + PBXPerProjectTemplateStateSaveDate = 613785687; + PBXWorkspaceStateSaveDate = 613785687; + }; + perUserProjectItems = { + 8BD150E724956DDF00B025B9 /* PBXTextBookmark */ = 8BD150E724956DDF00B025B9 /* PBXTextBookmark */; + 8BD150E824956DDF00B025B9 /* PBXTextBookmark */ = 8BD150E824956DDF00B025B9 /* PBXTextBookmark */; + 8BD150EA24956DDF00B025B9 /* PBXTextBookmark */ = 8BD150EA24956DDF00B025B9 /* PBXTextBookmark */; + 8BD151602495A6F400B025B9 /* PBXTextBookmark */ = 8BD151602495A6F400B025B9 /* PBXTextBookmark */; }; sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */; userBuildSettings = { @@ -58,18 +64,18 @@ }; 2407DEB6089929BA00EB68BF /* Dark.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 1651}}"; - sepNavSelRange = "{3769, 0}"; - sepNavVisRange = "{2555, 1974}"; - sepNavWindowFrame = "{{560, 57}, {895, 821}}"; + sepNavIntBoundsRect = "{{0, 0}, {740, 1807}}"; + sepNavSelRange = "{4061, 0}"; + sepNavVisRange = "{1333, 920}"; + sepNavWindowFrame = "{{559, 57}, {895, 821}}"; }; }; 245463B80991757100464AD3 /* Dark.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {866, 832}}"; - sepNavSelRange = "{2354, 50}"; - sepNavVisRange = "{264, 2197}"; - sepNavWindowFrame = "{{556, 57}, {895, 821}}"; + sepNavIntBoundsRect = "{{0, 0}, {866, 858}}"; + sepNavSelRange = "{2475, 0}"; + sepNavVisRange = "{204, 390}"; + sepNavWindowFrame = "{{545, 57}, {895, 821}}"; }; }; 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = { @@ -82,9 +88,9 @@ }; 24D8286F09A914000093AEF8 /* DarkProc.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 3094}}"; - sepNavSelRange = "{7600, 0}"; - sepNavVisRange = "{6302, 1549}"; + sepNavIntBoundsRect = "{{0, 0}, {656, 3146}}"; + sepNavSelRange = "{4768, 0}"; + sepNavVisRange = "{4380, 807}"; sepNavWindowFrame = "{{531, 57}, {895, 821}}"; }; }; @@ -102,6 +108,46 @@ isa = PBXCodeSenseManager; indexTemplatePath = ""; }; + 8BD150E724956DDF00B025B9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 245463B80991757100464AD3 /* Dark.h */; + name = "Dark.h: 62"; + rLen = 0; + rLoc = 2475; + rType = 0; + vrLen = 390; + vrLoc = 204; + }; + 8BD150E824956DDF00B025B9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 2407DEB6089929BA00EB68BF /* Dark.cpp */; + name = "Dark.cpp: 110"; + rLen = 0; + rLoc = 4061; + rType = 0; + vrLen = 920; + vrLoc = 1333; + }; + 8BD150EA24956DDF00B025B9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24D8286F09A914000093AEF8 /* DarkProc.cpp */; + name = "DarkProc.cpp: 143"; + rLen = 0; + rLoc = 4770; + rType = 0; + vrLen = 881; + vrLoc = 642; + }; + 8BD151602495A6F400B025B9 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 24D8286F09A914000093AEF8 /* DarkProc.cpp */; + name = "DarkProc.cpp: 142"; + rLen = 0; + rLoc = 4768; + rType = 0; + vrLen = 807; + vrLoc = 4380; + }; 8D01CCC60486CAD60068D4B7 /* Dark */ = { activeExec = 0; }; diff --git a/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 index a0a4b05..0626f1d 100755 --- a/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacVST/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -323,7 +321,7 @@ 185 RubberWindowFrame - 629 373 810 487 0 0 1440 878 + 625 378 810 487 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -334,12 +332,14 @@ Dock + BecomeActive + ContentConfiguration PBXProjectModuleGUID 8B0237581D42B1C400E1E8C8 PBXProjectModuleLabel - Gain.h + DarkProc.cpp PBXSplitModuleInNavigatorKey Split0 @@ -347,7 +347,17 @@ PBXProjectModuleGUID 8B0237591D42B1C400E1E8C8 PBXProjectModuleLabel - Gain.h + DarkProc.cpp + _historyCapacity + 0 + bookmark + 8BD151602495A6F400B025B9 + history + + 8BD150E724956DDF00B025B9 + 8BD150E824956DDF00B025B9 + 8BD150EA24956DDF00B025B9 + SplitCount 1 @@ -360,18 +370,18 @@ GeometryConfiguration Frame - {{0, 0}, {603, 0}} + {{0, 0}, {603, 334}} RubberWindowFrame - 629 373 810 487 0 0 1440 878 + 625 378 810 487 0 0 1440 878 Module PBXNavigatorGroup Proportion - 0pt + 334pt Proportion - 441pt + 107pt Tabs @@ -385,9 +395,9 @@ GeometryConfiguration Frame - {{10, 27}, {603, 414}} + {{10, 27}, {603, 80}} RubberWindowFrame - 629 373 810 487 0 0 1440 878 + 625 378 810 487 0 0 1440 878 Module XCDetailModule @@ -469,11 +479,11 @@ TableOfContents - 8BD14F722484432D00B025B9 + 8BD151612495A6F400B025B9 1CA23ED40692098700951B8B - 8BD14F732484432D00B025B9 + 8BD151622495A6F400B025B9 8B0237581D42B1C400E1E8C8 - 8BD14F742484432D00B025B9 + 8BD151632495A6F400B025B9 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -626,7 +636,7 @@ StatusbarIsVisible TimeStamp - 612647725.27764106 + 613787380.50059402 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -643,11 +653,10 @@ 5 WindowOrderList - 8BD14F752484432D00B025B9 - /Users/christopherjohnson/Desktop/Dark/Dark.xcodeproj + /Users/christopherjohnson/Desktop/Dithers/MacVST/Dark/Dark.xcodeproj WindowString - 629 373 810 487 0 0 1440 878 + 625 378 810 487 0 0 1440 878 WindowToolsV3 diff --git a/plugins/MacVST/Dark/source/Dark.cpp b/plugins/MacVST/Dark/source/Dark.cpp index 0f9721c..bae0428 100755 --- a/plugins/MacVST/Dark/source/Dark.cpp +++ b/plugins/MacVST/Dark/source/Dark.cpp @@ -13,6 +13,7 @@ Dark::Dark(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { A = 1.0; + B = 0.0; for(int count = 0; count < 99; count++) { lastSampleL[count] = 0; lastSampleR[count] = 0; @@ -50,6 +51,7 @@ VstInt32 Dark::getChunk (void** data, bool isPreset) { float *chunkData = (float *)calloc(kNumParameters, sizeof(float)); chunkData[0] = A; + chunkData[1] = B; /* Note: The way this is set up, it will break if you manage to save settings on an Intel machine and load them on a PPC Mac. However, it's fine if you stick to the machine you started with. */ @@ -62,6 +64,7 @@ VstInt32 Dark::setChunk (void* data, VstInt32 byteSize, bool isPreset) { float *chunkData = (float *)data; A = pinParameter(chunkData[0]); + B = pinParameter(chunkData[1]); /* We're ignoring byteSize as we found it to be a filthy liar */ /* calculate any other fields you need here - you could copy in @@ -72,6 +75,7 @@ VstInt32 Dark::setChunk (void* data, VstInt32 byteSize, bool isPreset) void Dark::setParameter(VstInt32 index, float value) { switch (index) { case kParamA: A = value; break; + case kParamB: B = value; break; default: throw; // unknown parameter, shouldn't happen! } } @@ -79,6 +83,7 @@ void Dark::setParameter(VstInt32 index, float value) { float Dark::getParameter(VstInt32 index) { switch (index) { case kParamA: return A; break; + case kParamB: return B; break; default: break; // unknown parameter, shouldn't happen! } return 0.0; //we only need to update the relevant name, this is simple to manage } @@ -86,6 +91,7 @@ float Dark::getParameter(VstInt32 index) { void Dark::getParameterName(VstInt32 index, char *text) { switch (index) { case kParamA: vst_strncpy (text, "Quant", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "DeRez", kVstMaxParamStrLen); break; default: break; // unknown parameter, shouldn't happen! } //this is our labels for displaying in the VST host } @@ -97,6 +103,7 @@ void Dark::getParameterDisplay(VstInt32 index, char *text) { case 1: vst_strncpy (text, "HD 24", kVstMaxParamStrLen); break; default: break; // unknown parameter, shouldn't happen! } break; //completed consoletype 'popup' parameter, exit + case kParamB: float2string (B, text, kVstMaxParamStrLen); break; default: break; // unknown parameter, shouldn't happen! } //this displays the values and handles 'popups' where it's discrete choices } @@ -104,6 +111,7 @@ void Dark::getParameterDisplay(VstInt32 index, char *text) { void Dark::getParameterLabel(VstInt32 index, char *text) { switch (index) { case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break; default: break; // unknown parameter, shouldn't happen! } } diff --git a/plugins/MacVST/Dark/source/Dark.h b/plugins/MacVST/Dark/source/Dark.h index a54d31b..df557e8 100755 --- a/plugins/MacVST/Dark/source/Dark.h +++ b/plugins/MacVST/Dark/source/Dark.h @@ -17,7 +17,8 @@ enum { kParamA = 0, - kNumParameters = 1 + kParamB = 1, + kNumParameters = 2 }; // const int kNumPrograms = 0; @@ -58,6 +59,7 @@ private: //default stuff float A; + float B; }; #endif diff --git a/plugins/MacVST/Dark/source/DarkProc.cpp b/plugins/MacVST/Dark/source/DarkProc.cpp index 672d8e0..2aa85c4 100755 --- a/plugins/MacVST/Dark/source/DarkProc.cpp +++ b/plugins/MacVST/Dark/source/DarkProc.cpp @@ -22,6 +22,12 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram if (depth > 98) depth = 98; bool highres = false; if (processing == 1) highres = true; + float scaleFactor; + if (highres) scaleFactor = 8388608.0; + else scaleFactor = 32768.0; + float derez = B; + if (derez > 0.0) scaleFactor *= pow(1.0-derez,6); + if (scaleFactor < 0.0001) scaleFactor = 0.0001; while (--sampleFrames >= 0) { @@ -32,14 +38,10 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; - if (highres) { - inputSampleL *= 8388608.0; - inputSampleR *= 8388608.0; - } else { - inputSampleL *= 32768.0; - inputSampleR *= 32768.0; - } + inputSampleL *= scaleFactor; + inputSampleR *= scaleFactor; //0-1 is now one bit, now we dither + //We are doing it first Left, then Right, because the loops may run faster if //they aren't too jammed full of variables. This means re-running code. @@ -103,13 +105,8 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram lastSampleR[0] = inputSampleR; //end right - if (highres) { - inputSampleL /= 8388608.0; - inputSampleR /= 8388608.0; - } else { - inputSampleL /= 32768.0; - inputSampleR /= 32768.0; - } + inputSampleL /= scaleFactor; + inputSampleR /= scaleFactor; *out1 = inputSampleL; *out2 = inputSampleR; @@ -137,6 +134,12 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa if (depth > 98) depth = 98; bool highres = false; if (processing == 1) highres = true; + float scaleFactor; + if (highres) scaleFactor = 8388608.0; + else scaleFactor = 32768.0; + float derez = B; + if (derez > 0.0) scaleFactor *= pow(1.0-derez,6); + if (scaleFactor < 1.0) scaleFactor = 1.0; while (--sampleFrames >= 0) { @@ -147,14 +150,10 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; - if (highres) { - inputSampleL *= 8388608.0; - inputSampleR *= 8388608.0; - } else { - inputSampleL *= 32768.0; - inputSampleR *= 32768.0; - } + inputSampleL *= scaleFactor; + inputSampleR *= scaleFactor; //0-1 is now one bit, now we dither + //We are doing it first Left, then Right, because the loops may run faster if //they aren't too jammed full of variables. This means re-running code. @@ -218,13 +217,8 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa lastSampleR[0] = inputSampleR; //end right - if (highres) { - inputSampleL /= 8388608.0; - inputSampleR /= 8388608.0; - } else { - inputSampleL /= 32768.0; - inputSampleR /= 32768.0; - } + inputSampleL /= scaleFactor; + inputSampleR /= scaleFactor; *out1 = inputSampleL; *out2 = inputSampleR; -- cgit v1.2.3