Fix filter env: restore unipolar modulation so all env knobs are responsive

Reverts the sustain-relative modulation that made F.ENV SUS and the
cutoff knob feel dead while a note was held. The envelope now modulates
up from the base cutoff; at env amount 0 the cutoff equals the knob, and
lowering env amount darkens the held tone as expected.

Also extends the filter to 24/48 dB modes (extra TPT stages), adds the
matching combobox options, gives knobs a real blurred drop shadow, and
updates the AGENTS.md filterType choice count.
This commit is contained in:
Armin 2026-08-13 14:15:41 +02:00
commit a1cd68b6b3
5 changed files with 38 additions and 18 deletions

View file

@ -129,13 +129,12 @@ public:
right *= noteVelocity * envSample;
// Filter cutoff with env + keytrack.
// Modulate RELATIVE to the envelope's sustain level so the held
// (sustain) cutoff always equals the base cutoff knob regardless of
// env amount — the envelope only opens above (attack) and closes
// below (release) that centre. This keeps the cutoff knob audible
// at any env amount instead of collapsing when env amt is lowered.
float modCutoff = filterCutoff * std::pow(2.0f,
(fEnvSample - filterEnvSustain) * filterEnvAmount * 4.0f);
// Unipolar modulation UP from the base cutoff: the envelope (0..1)
// multiplied by env amount adds brightness on top of the cutoff
// knob, never going below it. Every env knob (attack/decay/
// sustain/release) shapes the response, and at env amount 0 the
// cutoff equals the knob.
float modCutoff = filterCutoff * std::pow(2.0f, fEnvSample * filterEnvAmount * 4.0f);
float keyTrackFactor = std::pow(2.0f, (static_cast<float>(currentMidiNote) - 60.0f) / 12.0f * keyTrack);
modCutoff *= keyTrackFactor;
@ -197,7 +196,6 @@ public:
filterResonance = res;
filterType = ft;
filterEnvAmount = fEnvAmt;
filterEnvSustain = fSus;
keyTrack = kTrack;
pan = p;
drive = std::max(drv, 1.001f);
@ -252,7 +250,6 @@ private:
float filterResonance = 0.7f;
FilterType filterType = FilterType::LowPass12;
float filterEnvAmount = 0.0f;
float filterEnvSustain = 0.5f;
float keyTrack = 0.5f;
float pan = 0.0f;
float drive = 1.5f;