From 6e0febe954289baac253c2b432d1dc4dec403c30 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 14 Jun 2020 21:15:05 -0400 Subject: Dark Redux --- plugins/LinuxVST/src/Dark/Dark.cpp | 8 +++ plugins/LinuxVST/src/Dark/Dark.h | 4 +- plugins/LinuxVST/src/Dark/DarkProc.cpp | 50 +++++++------- plugins/MacAU/Dark/Dark.cpp | 24 +++++-- plugins/MacAU/Dark/Dark.h | 7 +- .../Dark/Dark.xcodeproj/christopherjohnson.pbxuser | 60 ++++++++--------- .../christopherjohnson.perspectivev3 | 34 +++++----- .../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 +++++++------- plugins/WinVST/Dark/.vs/VSTProject/v14/.suo | Bin 22528 -> 22528 bytes plugins/WinVST/Dark/Dark.cpp | 8 +++ plugins/WinVST/Dark/Dark.h | 4 +- plugins/WinVST/Dark/DarkProc.cpp | 50 +++++++------- 16 files changed, 255 insertions(+), 173 deletions(-) diff --git a/plugins/LinuxVST/src/Dark/Dark.cpp b/plugins/LinuxVST/src/Dark/Dark.cpp index 0f9721c..bae0428 100755 --- a/plugins/LinuxVST/src/Dark/Dark.cpp +++ b/plugins/LinuxVST/src/Dark/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/LinuxVST/src/Dark/Dark.h b/plugins/LinuxVST/src/Dark/Dark.h index a54d31b..df557e8 100755 --- a/plugins/LinuxVST/src/Dark/Dark.h +++ b/plugins/LinuxVST/src/Dark/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/LinuxVST/src/Dark/DarkProc.cpp b/plugins/LinuxVST/src/Dark/DarkProc.cpp index 672d8e0..2aa85c4 100755 --- a/plugins/LinuxVST/src/Dark/DarkProc.cpp +++ b/plugins/LinuxVST/src/Dark/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; diff --git a/plugins/MacAU/Dark/Dark.cpp b/plugins/MacAU/Dark/Dark.cpp index 11380b4..5f24cd4 100755 --- a/plugins/MacAU/Dark/Dark.cpp +++ b/plugins/MacAU/Dark/Dark.cpp @@ -60,6 +60,7 @@ Dark::Dark(AudioUnit component) CreateElements(); Globals()->UseIndexedParameters(kNumberOfParameters); SetParameter(kParam_One, kDefaultValue_ParamOne ); + SetParameter(kParam_Two, kDefaultValue_ParamTwo ); #if AU_DEBUG_DISPATCHER mDebugDispatcher = new AUDebugDispatcher (this); @@ -117,6 +118,13 @@ ComponentResult Dark::GetParameterInfo(AudioUnitScope inScope, outParameterInfo.minValue = kCD; outParameterInfo.maxValue = kHD; outParameterInfo.defaultValue = kDefaultValue_ParamOne; + break; + case kParam_Two: + AUBase::FillInParameterName (outParameterInfo, kParameterTwoName, false); + outParameterInfo.unit = kAudioUnitParameterUnit_Generic; + outParameterInfo.minValue = 0.0; + outParameterInfo.maxValue = 1.0; + outParameterInfo.defaultValue = kDefaultValue_ParamTwo; break; default: result = kAudioUnitErr_InvalidParameter; @@ -197,14 +205,19 @@ void Dark::DarkKernel::Process( const Float32 *inSourceP, if (depth > 98) depth = 98; bool highres = false; if (GetParameter( kParam_One ) == 1) highres = true; + Float32 scaleFactor; + if (highres) scaleFactor = 8388608.0; + else scaleFactor = 32768.0; + Float32 derez = GetParameter( kParam_Two ); + if (derez > 0.0) scaleFactor *= pow(1.0-derez,6); + if (scaleFactor < 1.0) scaleFactor = 1.0; while (nSampleFrames-- > 0) { Float32 inputSample = *sourceP; if (fabs(inputSample)<1.18e-37) inputSample = fpd * 1.18e-37; fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; - if (highres) inputSample *= 8388608.0; - else inputSample *= 32768.0; + inputSample *= scaleFactor; //0-1 is now one bit, now we dither int quantA = floor(inputSample); @@ -221,8 +234,8 @@ void Dark::DarkKernel::Process( const Float32 *inSourceP, //we are doing that to voice the thing down into the upper mids a bit //it mustn't just soften the brightest treble, it must smooth high mids too - float testA = fabs((lastSample[0] - quantA) - expectedSlew); - float testB = fabs((lastSample[0] - quantB) - expectedSlew); + Float32 testA = fabs((lastSample[0] - quantA) - expectedSlew); + Float32 testB = fabs((lastSample[0] - quantB) - expectedSlew); if (testA < testB) inputSample = quantA; else inputSample = quantB; @@ -235,8 +248,7 @@ void Dark::DarkKernel::Process( const Float32 *inSourceP, } lastSample[0] = inputSample; - if (highres) inputSample /= 8388608.0; - else inputSample /= 32768.0; + inputSample /= scaleFactor; *destP = inputSample; diff --git a/plugins/MacAU/Dark/Dark.h b/plugins/MacAU/Dark/Dark.h index daef9e0..acb68d9 100755 --- a/plugins/MacAU/Dark/Dark.h +++ b/plugins/MacAU/Dark/Dark.h @@ -58,14 +58,17 @@ static CFStringRef kParameterOneName = CFSTR("Quantizer"); static const int kCD = 0; static const int kHD = 1; static const int kDefaultValue_ParamOne = kHD; - static CFStringRef kMenuItem_CD = CFSTR ("CD 16 bit"); static CFStringRef kMenuItem_HD = CFSTR ("HD 24 bit"); +static CFStringRef kParameterTwoName = CFSTR("DeRez"); +static const float kDefaultValue_ParamTwo = 0.0; + enum { kParam_One = 0, + kParam_Two = 1, //Add your parameters here... - kNumberOfParameters=1 + kNumberOfParameters=2 }; #pragma mark ____Dark diff --git a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser index 60e6725..f8a4499 100755 --- a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.pbxuser @@ -49,15 +49,15 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 612641477; - PBXWorkspaceStateSaveDate = 612641477; + PBXPerProjectTemplateStateSaveDate = 613790145; + PBXWorkspaceStateSaveDate = 613790145; }; perUserProjectItems = { 8BD14F0224842AB600B025B9 /* PlistBookmark */ = 8BD14F0224842AB600B025B9 /* PlistBookmark */; 8BD14F0324842AB600B025B9 /* PBXTextBookmark */ = 8BD14F0324842AB600B025B9 /* PBXTextBookmark */; - 8BD14F0424842AB600B025B9 /* PBXTextBookmark */ = 8BD14F0424842AB600B025B9 /* PBXTextBookmark */; - 8BD14F3A24843ADE00B025B9 /* PBXTextBookmark */ = 8BD14F3A24843ADE00B025B9 /* PBXTextBookmark */; - 8BD14F3B24843ADE00B025B9 /* PBXTextBookmark */ = 8BD14F3B24843ADE00B025B9 /* PBXTextBookmark */; + 8BD150CD24956DA100B025B9 /* PBXTextBookmark */ = 8BD150CD24956DA100B025B9 /* PBXTextBookmark */; + 8BD1515C2495A6F200B025B9 /* PBXTextBookmark */ = 8BD1515C2495A6F200B025B9 /* PBXTextBookmark */; + 8BD151A22495B1D300B025B9 /* PBXTextBookmark */ = 8BD151A22495B1D300B025B9 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -65,9 +65,9 @@ }; 8BA05A660720730100365D66 /* Dark.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {824, 3146}}"; - sepNavSelRange = "{10085, 0}"; - sepNavVisRange = "{9189, 955}"; + sepNavIntBoundsRect = "{{0, 0}, {656, 3536}}"; + sepNavSelRange = "{10164, 0}"; + sepNavVisRange = "{9020, 1552}"; sepNavWindowFrame = "{{6, 57}, {790, 821}}"; }; }; @@ -81,10 +81,10 @@ }; 8BC6025B073B072D006C4272 /* Dark.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1781}}"; - sepNavSelRange = "{5054, 0}"; - sepNavVisRange = "{2743, 647}"; - sepNavWindowFrame = "{{26, 57}, {790, 821}}"; + sepNavIntBoundsRect = "{{0, 0}, {824, 1716}}"; + sepNavSelRange = "{5175, 0}"; + sepNavVisRange = "{2696, 815}"; + sepNavWindowFrame = "{{28, 47}, {790, 821}}"; }; }; 8BD14F0224842AB600B025B9 /* PlistBookmark */ = { @@ -109,35 +109,35 @@ vrLen = 1283; vrLoc = 1638; }; - 8BD14F0424842AB600B025B9 /* PBXTextBookmark */ = { + 8BD150CD24956DA100B025B9 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BA05A660720730100365D66 /* Dark.cpp */; - name = "Dark.cpp: 176"; - rLen = 66; - rLoc = 7490; + fRef = 8BC6025B073B072D006C4272 /* Dark.h */; + name = "Dark.h: 130"; + rLen = 0; + rLoc = 5175; rType = 0; - vrLen = 1240; - vrLoc = 6908; + vrLen = 815; + vrLoc = 2696; }; - 8BD14F3A24843ADE00B025B9 /* PBXTextBookmark */ = { + 8BD1515C2495A6F200B025B9 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 8BC6025B073B072D006C4272 /* Dark.h */; - name = "Dark.h: 127"; + fRef = 8BA05A660720730100365D66 /* Dark.cpp */; + name = "Dark.cpp: 213"; rLen = 0; - rLoc = 5054; + rLoc = 9186; rType = 0; - vrLen = 647; - vrLoc = 2743; + vrLen = 1424; + vrLoc = 8513; }; - 8BD14F3B24843ADE00B025B9 /* PBXTextBookmark */ = { + 8BD151A22495B1D300B025B9 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Dark.cpp */; - name = "Dark.cpp: 242"; + name = "Dark.cpp: 238"; rLen = 0; - rLoc = 10085; + rLoc = 10164; rType = 0; - vrLen = 955; - vrLoc = 9189; + vrLen = 1552; + vrLoc = 9020; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { isa = PBXSourceControlManager; diff --git a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 index 4caf832..1848996 100755 --- a/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Dark/Dark.xcodeproj/christopherjohnson.perspectivev3 @@ -324,7 +324,7 @@ 288 RubberWindowFrame - 590 222 841 654 0 0 1440 878 + 7 216 841 654 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -354,13 +354,13 @@ _historyCapacity 0 bookmark - 8BD14F3B24843ADE00B025B9 + 8BD151A22495B1D300B025B9 history 8BD14F0224842AB600B025B9 8BD14F0324842AB600B025B9 - 8BD14F3A24843ADE00B025B9 - 8BD14F0424842AB600B025B9 + 8BD150CD24956DA100B025B9 + 8BD1515C2495A6F200B025B9 SplitCount @@ -374,18 +374,18 @@ GeometryConfiguration Frame - {{0, 0}, {531, 417}} + {{0, 0}, {531, 514}} RubberWindowFrame - 590 222 841 654 0 0 1440 878 + 7 216 841 654 0 0 1440 878 Module PBXNavigatorGroup Proportion - 417pt + 514pt Proportion - 191pt + 94pt Tabs @@ -399,9 +399,9 @@ GeometryConfiguration Frame - {{10, 27}, {531, 164}} + {{10, 27}, {531, 67}} RubberWindowFrame - 590 222 841 654 0 0 1440 878 + 7 216 841 654 0 0 1440 878 Module XCDetailModule @@ -455,7 +455,7 @@ GeometryConfiguration Frame - {{10, 27}, {531, 339}} + {{10, 27}, {531, 61}} Module PBXBuildResultsModule @@ -483,11 +483,11 @@ TableOfContents - 8BD14F3C24843ADE00B025B9 + 8BD151A32495B1D300B025B9 1CA23ED40692098700951B8B - 8BD14F3D24843ADE00B025B9 + 8BD151A42495B1D300B025B9 8BD7274A1D46E5A5000176F0 - 8BD14F3E24843ADE00B025B9 + 8BD151A52495B1D300B025B9 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -660,7 +660,7 @@ StatusbarIsVisible TimeStamp - 612645598.50175905 + 613790163.86573398 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -677,10 +677,10 @@ 5 WindowOrderList - /Users/christopherjohnson/Desktop/Plugins/MacAU/Dark/Dark.xcodeproj + /Users/christopherjohnson/Desktop/Dithers/MacAU/Dark/Dark.xcodeproj WindowString - 590 222 841 654 0 0 1440 878 + 7 216 841 654 0 0 1440 878 WindowToolsV3 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; diff --git a/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo b/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo index 8d56aa4..54d92ad 100755 Binary files a/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo and b/plugins/WinVST/Dark/.vs/VSTProject/v14/.suo differ diff --git a/plugins/WinVST/Dark/Dark.cpp b/plugins/WinVST/Dark/Dark.cpp index 0f9721c..bae0428 100755 --- a/plugins/WinVST/Dark/Dark.cpp +++ b/plugins/WinVST/Dark/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/WinVST/Dark/Dark.h b/plugins/WinVST/Dark/Dark.h index a54d31b..df557e8 100755 --- a/plugins/WinVST/Dark/Dark.h +++ b/plugins/WinVST/Dark/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/WinVST/Dark/DarkProc.cpp b/plugins/WinVST/Dark/DarkProc.cpp index 672d8e0..2aa85c4 100755 --- a/plugins/WinVST/Dark/DarkProc.cpp +++ b/plugins/WinVST/Dark/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