From 32e2e4d41d8926b684329b508c576b640c547959 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 19 Apr 2020 20:15:15 -0400 Subject: Tape Redux Modifications to allow for a Bump control that enables level setting on the head bump --- plugins/LinuxVST/src/Tape/Tape.cpp | 8 ++++++++ plugins/LinuxVST/src/Tape/Tape.h | 4 +++- plugins/LinuxVST/src/Tape/TapeProc.cpp | 10 ++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'plugins/LinuxVST/src') diff --git a/plugins/LinuxVST/src/Tape/Tape.cpp b/plugins/LinuxVST/src/Tape/Tape.cpp index eb3712c..a34d8b7 100755 --- a/plugins/LinuxVST/src/Tape/Tape.cpp +++ b/plugins/LinuxVST/src/Tape/Tape.cpp @@ -13,6 +13,7 @@ Tape::Tape(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParameters) { A = 0.5; + B = 0.5; iirMidRollerAL = 0.0; iirMidRollerBL = 0.0; iirHeadBumpAL = 0.0; @@ -61,6 +62,7 @@ VstInt32 Tape::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. */ @@ -73,6 +75,7 @@ VstInt32 Tape::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 @@ -83,6 +86,7 @@ VstInt32 Tape::setChunk (void* data, VstInt32 byteSize, bool isPreset) void Tape::setParameter(VstInt32 index, float value) { switch (index) { case kParamA: A = value; break; + case kParamB: B = value; break; default: throw; // unknown parameter, shouldn't happen! } } @@ -90,6 +94,7 @@ void Tape::setParameter(VstInt32 index, float value) { float Tape::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 } @@ -97,6 +102,7 @@ float Tape::getParameter(VstInt32 index) { void Tape::getParameterName(VstInt32 index, char *text) { switch (index) { case kParamA: vst_strncpy (text, "Slam", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "Bump", kVstMaxParamStrLen); break; default: break; // unknown parameter, shouldn't happen! } //this is our labels for displaying in the VST host } @@ -104,6 +110,7 @@ void Tape::getParameterName(VstInt32 index, char *text) { void Tape::getParameterDisplay(VstInt32 index, char *text) { switch (index) { case kParamA: float2string ((A-0.5)*24.0, text, kVstMaxParamStrLen); break; + 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 } @@ -111,6 +118,7 @@ void Tape::getParameterDisplay(VstInt32 index, char *text) { void Tape::getParameterLabel(VstInt32 index, char *text) { switch (index) { case kParamA: vst_strncpy (text, "dB", kVstMaxParamStrLen); break; + case kParamB: vst_strncpy (text, "", kVstMaxParamStrLen); break; default: break; // unknown parameter, shouldn't happen! } } diff --git a/plugins/LinuxVST/src/Tape/Tape.h b/plugins/LinuxVST/src/Tape/Tape.h index 6c1dc00..932247b 100755 --- a/plugins/LinuxVST/src/Tape/Tape.h +++ b/plugins/LinuxVST/src/Tape/Tape.h @@ -17,7 +17,8 @@ enum { kParamA = 0, - kNumParameters = 1 + kParamB = 1, + kNumParameters = 2 }; // const int kNumPrograms = 0; @@ -80,6 +81,7 @@ private: //default stuff float A; + float B; }; #endif diff --git a/plugins/LinuxVST/src/Tape/TapeProc.cpp b/plugins/LinuxVST/src/Tape/TapeProc.cpp index e29f71a..d1ecb27 100755 --- a/plugins/LinuxVST/src/Tape/TapeProc.cpp +++ b/plugins/LinuxVST/src/Tape/TapeProc.cpp @@ -19,6 +19,7 @@ void Tape::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram overallscale *= getSampleRate(); double inputgain = pow(10.0,((A-0.5)*24.0)/20.0); + double bumpgain = B*0.1; double HeadBumpFreq = 0.12/overallscale; double softness = 0.618033988749894848204586; double RollAmount = (1.0 - softness) / overallscale; @@ -205,8 +206,8 @@ void Tape::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram inputSampleL += groundSampleL; //apply UnBox processing inputSampleR += groundSampleR; //apply UnBox processing - inputSampleL += ((iirHeadBumpAL + iirHeadBumpBL) * 0.1);//and head bump - inputSampleR += ((iirHeadBumpAR + iirHeadBumpBR) * 0.1);//and head bump + inputSampleL += ((iirHeadBumpAL + iirHeadBumpBL) * bumpgain);//and head bump + inputSampleR += ((iirHeadBumpAR + iirHeadBumpBR) * bumpgain);//and head bump if (lastSampleL >= 0.99) { @@ -297,6 +298,7 @@ void Tape::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa overallscale *= getSampleRate(); double inputgain = pow(10.0,((A-0.5)*24.0)/20.0); + double bumpgain = B*0.1; double HeadBumpFreq = 0.12/overallscale; double softness = 0.618033988749894848204586; double RollAmount = (1.0 - softness) / overallscale; @@ -489,8 +491,8 @@ void Tape::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa inputSampleL += groundSampleL; //apply UnBox processing inputSampleR += groundSampleR; //apply UnBox processing - inputSampleL += ((iirHeadBumpAL + iirHeadBumpBL) * 0.1);//and head bump - inputSampleR += ((iirHeadBumpAR + iirHeadBumpBR) * 0.1);//and head bump + inputSampleL += ((iirHeadBumpAL + iirHeadBumpBL) * bumpgain);//and head bump + inputSampleR += ((iirHeadBumpAR + iirHeadBumpBR) * bumpgain);//and head bump if (lastSampleL >= 0.99) { -- cgit v1.2.3