add per-oscillator detune (detune1); fix ASR attack handoff

This commit is contained in:
Armin 2026-09-10 02:25:20 +02:00
commit 2a79067a1c
5 changed files with 21 additions and 11 deletions

View file

@ -5,6 +5,7 @@
struct VParams
{
float osc1w = 2, osc2w = 3, detune = 8, oscMix = 52.f;
float detune1 = 0;
float fltType = 1, fltCut = 3400.f, fltRes = 0.18f, fltEnv = 52.f, fltKey = 40.f;
float ampA = 0.008f, ampD = 0.26f, ampS = 0.70f, ampR = 0.35f;
float fA = 0.02f, fD = 0.16f, fS = 0.26f, fR = 0.25f;
@ -18,6 +19,7 @@ struct VParams
{
auto get = [&] (const char* id) { return apvts.getRawParameterValue (id) -> load(); };
osc1w = get ("osc1wave"); osc2w = get ("osc2wave"); detune = get ("detune");
detune1 = get ("detune1");
oscMix = get ("oscmix");
fltType = get ("flttype"); fltCut = get ("fltcut"); fltRes = get ("fltres");
fltEnv = get ("fltenv"); fltKey = get ("fltkey");
@ -69,8 +71,11 @@ public:
switch (st)
{
case Atk:
// (1-cur)*k converges to 1.0 only asymptotically in float and can
// stall below 1.0 forever, so clamp with a tolerance to guarantee
// the attack always hands off to the decay stage.
cur += (1.0f - cur) * std::min (1.0f, (float) (attTau * srInv) * 8.0f);
if (cur >= 1.0f) { cur = 1.0f; st = Dec; }
if (cur >= 1.0f - 1.0e-4f) { cur = 1.0f; st = Dec; }
break;
case Dec:
cur = susL + (cur - susL) * std::exp (-decTau * (float) srInv);