@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
#include "ChowDSP.hpp" | #include "ChowDSP.hpp" | ||||
@@ -1,4 +1,6 @@ | |||||
#pragma once | #pragma once | ||||
#include <rack.hpp> | |||||
namespace chowdsp { | namespace chowdsp { | ||||
// code taken from https://github.com/jatinchowdhury18/ChowDSP-VCV/blob/master/src/shared/, commit 21701fb | // code taken from https://github.com/jatinchowdhury18/ChowDSP-VCV/blob/master/src/shared/, commit 21701fb | ||||
@@ -417,4 +419,4 @@ private: | |||||
BaseOversampling* oss[NumOS] = { &os0, &os1, &os2, &os3, &os4 }; | BaseOversampling* oss[NumOS] = { &os0, &os1, &os2, &os3, &os4 }; | ||||
}; | }; | ||||
} | |||||
} // namespace chowdsp |
@@ -1,112 +0,0 @@ | |||||
#pragma once | |||||
#include <rack.hpp> | |||||
#include <dsp/common.hpp> | |||||
struct BefacoTinyKnobRed : app::SvgKnob { | |||||
BefacoTinyKnobRed() { | |||||
minAngle = -0.8 * M_PI; | |||||
maxAngle = 0.8 * M_PI; | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoTinyKnobWhite : app::SvgKnob { | |||||
BefacoTinyKnobWhite() { | |||||
minAngle = -0.8 * M_PI; | |||||
maxAngle = 0.8 * M_PI; | |||||
setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoTinyKnobGrey : app::SvgKnob { | |||||
BefacoTinyKnobGrey() { | |||||
minAngle = -0.8 * M_PI; | |||||
maxAngle = 0.8 * M_PI; | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobGrey.svg"))); | |||||
} | |||||
}; | |||||
struct Davies1900hLargeGreyKnob : Davies1900hKnob { | |||||
Davies1900hLargeGreyKnob() { | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hLargeGrey.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoOutputPort : app::SvgPort { | |||||
BefacoOutputPort() { | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoInputPort : app::SvgPort { | |||||
BefacoInputPort() { | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoInputPort.svg"))); | |||||
} | |||||
}; | |||||
template <typename T> | |||||
T sin2pi_pade_05_5_4(T x) { | |||||
x -= 0.5f; | |||||
return (T(-6.283185307) * x + T(33.19863968) * simd::pow(x, 3) - T(32.44191367) * simd::pow(x, 5)) | |||||
/ (1 + T(1.296008659) * simd::pow(x, 2) + T(0.7028072946) * simd::pow(x, 4)); | |||||
} | |||||
template <typename T> | |||||
T tanh_pade(T x) { | |||||
T x2 = x * x; | |||||
T q = 12.f + x2; | |||||
return 12.f * x * q / (36.f * x2 + q * q); | |||||
} | |||||
struct ADEnvelope { | |||||
enum Stage { | |||||
STAGE_OFF, | |||||
STAGE_ATTACK, | |||||
STAGE_DECAY | |||||
}; | |||||
Stage stage = STAGE_OFF; | |||||
float env = 0.f; | |||||
float attackTime = 0.1, decayTime = 0.1; | |||||
float attackShape = 1.0, decayShape = 1.0; | |||||
ADEnvelope() { }; | |||||
void process(const float& sampleTime) { | |||||
if (stage == STAGE_OFF) { | |||||
env = envLinear = 0.0f; | |||||
} | |||||
else if (stage == STAGE_ATTACK) { | |||||
envLinear += sampleTime / attackTime; | |||||
env = std::pow(envLinear, attackShape); | |||||
} | |||||
else if (stage == STAGE_DECAY) { | |||||
envLinear -= sampleTime / decayTime; | |||||
env = std::pow(envLinear, decayShape); | |||||
} | |||||
if (envLinear >= 1.0f) { | |||||
stage = STAGE_DECAY; | |||||
env = envLinear = 1.0f; | |||||
} | |||||
else if (envLinear <= 0.0f) { | |||||
stage = STAGE_OFF; | |||||
env = envLinear = 0.0f; | |||||
} | |||||
} | |||||
void trigger() { | |||||
stage = ADEnvelope::STAGE_ATTACK; | |||||
// non-linear envelopes won't retrigger at the correct starting point if | |||||
// attackShape != decayShape, so we advance the linear envelope | |||||
envLinear = std::pow(env, 1.0f / attackShape); | |||||
} | |||||
private: | |||||
float envLinear = 0.f; | |||||
}; |
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
struct DualAtenuverter : Module { | struct DualAtenuverter : Module { | ||||
enum ParamIds { | enum ParamIds { | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
#include "ChowDSP.hpp" | #include "ChowDSP.hpp" | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,11 +1,9 @@ | |||||
#pragma once | #pragma once | ||||
#include "rack.hpp" | |||||
#include <rack.hpp> | |||||
/** When triggered, holds a high value for a specified time before going low again */ | /** When triggered, holds a high value for a specified time before going low again */ | ||||
struct PulseGenerator_4 { | struct PulseGenerator_4 { | ||||
simd::float_4 remaining = simd::float_4::zero(); | simd::float_4 remaining = simd::float_4::zero(); | ||||
/** Immediately disables the pulse */ | /** Immediately disables the pulse */ | ||||
@@ -29,4 +27,3 @@ struct PulseGenerator_4 { | |||||
remaining = ifelse(mask & (duration_4 > remaining), duration_4, remaining); | remaining = ifelse(mask & (duration_4 > remaining), duration_4, remaining); | ||||
} | } | ||||
}; | }; | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
#include "PulseGenerator_4.hpp" | #include "PulseGenerator_4.hpp" | ||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,5 +1,4 @@ | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "Common.hpp" | |||||
using simd::float_4; | using simd::float_4; | ||||
@@ -1,7 +1,5 @@ | |||||
#include <string.h> | |||||
#include "plugin.hpp" | #include "plugin.hpp" | ||||
#include "pffft.h" | |||||
#include "Common.hpp" | |||||
#include <pffft.h> | |||||
BINARY(src_SpringReverbIR_pcm); | BINARY(src_SpringReverbIR_pcm); | ||||
@@ -1,4 +1,4 @@ | |||||
#include "rack.hpp" | |||||
#include <rack.hpp> | |||||
using namespace rack; | using namespace rack; | ||||
@@ -18,6 +18,7 @@ extern Model *modelHexmixVCA; | |||||
extern Model *modelChoppingKinky; | extern Model *modelChoppingKinky; | ||||
extern Model *modelKickall; | extern Model *modelKickall; | ||||
struct Knurlie : SvgScrew { | struct Knurlie : SvgScrew { | ||||
Knurlie() { | Knurlie() { | ||||
sw->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/Knurlie.svg")); | sw->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/Knurlie.svg")); | ||||
@@ -25,3 +26,109 @@ struct Knurlie : SvgScrew { | |||||
box.size = sw->box.size; | box.size = sw->box.size; | ||||
} | } | ||||
}; | }; | ||||
struct BefacoTinyKnobRed : app::SvgKnob { | |||||
BefacoTinyKnobRed() { | |||||
minAngle = -0.8 * M_PI; | |||||
maxAngle = 0.8 * M_PI; | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobRed.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoTinyKnobWhite : app::SvgKnob { | |||||
BefacoTinyKnobWhite() { | |||||
minAngle = -0.8 * M_PI; | |||||
maxAngle = 0.8 * M_PI; | |||||
setSvg(APP->window->loadSvg(asset::system("res/ComponentLibrary/BefacoTinyKnob.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoTinyKnobGrey : app::SvgKnob { | |||||
BefacoTinyKnobGrey() { | |||||
minAngle = -0.8 * M_PI; | |||||
maxAngle = 0.8 * M_PI; | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoTinyKnobGrey.svg"))); | |||||
} | |||||
}; | |||||
struct Davies1900hLargeGreyKnob : Davies1900hKnob { | |||||
Davies1900hLargeGreyKnob() { | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Davies1900hLargeGrey.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoOutputPort : app::SvgPort { | |||||
BefacoOutputPort() { | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoOutputPort.svg"))); | |||||
} | |||||
}; | |||||
struct BefacoInputPort : app::SvgPort { | |||||
BefacoInputPort() { | |||||
setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/BefacoInputPort.svg"))); | |||||
} | |||||
}; | |||||
template <typename T> | |||||
T sin2pi_pade_05_5_4(T x) { | |||||
x -= 0.5f; | |||||
return (T(-6.283185307) * x + T(33.19863968) * simd::pow(x, 3) - T(32.44191367) * simd::pow(x, 5)) | |||||
/ (1 + T(1.296008659) * simd::pow(x, 2) + T(0.7028072946) * simd::pow(x, 4)); | |||||
} | |||||
template <typename T> | |||||
T tanh_pade(T x) { | |||||
T x2 = x * x; | |||||
T q = 12.f + x2; | |||||
return 12.f * x * q / (36.f * x2 + q * q); | |||||
} | |||||
struct ADEnvelope { | |||||
enum Stage { | |||||
STAGE_OFF, | |||||
STAGE_ATTACK, | |||||
STAGE_DECAY | |||||
}; | |||||
Stage stage = STAGE_OFF; | |||||
float env = 0.f; | |||||
float attackTime = 0.1, decayTime = 0.1; | |||||
float attackShape = 1.0, decayShape = 1.0; | |||||
ADEnvelope() { }; | |||||
void process(const float& sampleTime) { | |||||
if (stage == STAGE_OFF) { | |||||
env = envLinear = 0.0f; | |||||
} | |||||
else if (stage == STAGE_ATTACK) { | |||||
envLinear += sampleTime / attackTime; | |||||
env = std::pow(envLinear, attackShape); | |||||
} | |||||
else if (stage == STAGE_DECAY) { | |||||
envLinear -= sampleTime / decayTime; | |||||
env = std::pow(envLinear, decayShape); | |||||
} | |||||
if (envLinear >= 1.0f) { | |||||
stage = STAGE_DECAY; | |||||
env = envLinear = 1.0f; | |||||
} | |||||
else if (envLinear <= 0.0f) { | |||||
stage = STAGE_OFF; | |||||
env = envLinear = 0.0f; | |||||
} | |||||
} | |||||
void trigger() { | |||||
stage = ADEnvelope::STAGE_ATTACK; | |||||
// non-linear envelopes won't retrigger at the correct starting point if | |||||
// attackShape != decayShape, so we advance the linear envelope | |||||
envLinear = std::pow(env, 1.0f / attackShape); | |||||
} | |||||
private: | |||||
float envLinear = 0.f; | |||||
}; |