fix: close round-2 review findings — Critical silent-note bug plus majors/minors

Fixes the 2-point spline-EG early-free bug causing silent fade-ins, the pitch/filter enable-toggle Trigger-forcing hole, the contour-node/marker pixel shadow, missing deck-residue test coverage, and stale comments in knob_deck and spline_edit.
This commit is contained in:
2026-07-31 23:12:08 -04:00
parent d8ffd860d1
commit c3d67bc3da
12 changed files with 150 additions and 30 deletions
+6 -1
View File
@@ -185,7 +185,6 @@ void ReaSamplerEditor::applyControl(int id, PlaySeconds& play, double value,
case ParamControl::kPitchEnvMode: play.pitchSpline.mode = m; break;
default: play.filterSpline.mode = m; break;
}
if (splineActive(play)) play.playMode = PlayMode::Trigger;
break;
}
case ParamControl::kPitchEngine:
@@ -271,6 +270,12 @@ void ReaSamplerEditor::applyControl(int id, PlaySeconds& play, double value,
play.filter.trigEnv.decayCurve = util::curveFromKnobNorm(value); break;
default: break;
}
// ONE normalization point for every control that can flip splineActive — a mode toggle
// (above) or an enable toggle (kPitchEnvEnable/kFilterEnable), whose enabling can make an
// already-Spline pitch/filter envelope newly active. Applying it once here, rather than at
// each site that could cause the flip, is what keeps a future such control from reopening
// the same hole.
if (splineActive(play)) play.playMode = PlayMode::Trigger;
}
double ReaSamplerEditor::liveSampleRate() const {
+11 -10
View File
@@ -31,11 +31,6 @@ bool ReaSamplerEditor::mouseDownWaveform(const FaceLayout& fl, int x, int y) {
if (frames <= 0) return false;
const OverlayArea overlay = waveformOverlayArea(fl.bands.waveform);
// A drawn EG's contour is evaluated below, AFTER the markers: pointAtPixel's pick radius
// has no box check of its own, so a coincident contour node would otherwise shadow a
// marker's own dedicated grab rect (the loop-crossfade tab most sharply, since it is the
// ONLY affordance at zero crossfade) — marker reachability wins on any pixel overlap. The
// staged envelope-node pass just below is unaffected (its own, longer-standing ordering).
const DeckEnableState gates = deckEnableState();
const bool splineLive = overlayIsSpline() && overlayEnvEnabled(overlayEnv_, gates);
const SplineGesture gesture = (GetKeyState(VK_CONTROL) & 0x8000) != 0
@@ -64,6 +59,17 @@ bool ReaSamplerEditor::mouseDownWaveform(const FaceLayout& fl, int x, int y) {
return true; // node moves once the cursor drags
}
}
// An existing contour node's grab/toggle/delete runs BEFORE the markers — mirroring
// markerHandleRect's tab-vs-column split (below): a coincident pixel (the default contour
// endpoint sits at the same x as the default start marker) is resolved by asking the
// NARROWER target first. pointAtPixel's pick radius is a small box around the node's own
// (x, y), not a full-height column, so this claims only genuine node hits — the marker's
// column stays grabbable at every other y along the same x. Never add here (kAdd is only
// tried once the markers have also passed on the click, below).
if (splineLive && splineOverlayClick(overlay, x, y, gesture, /*addOnEmptySpace=*/false)) {
return true;
}
const SetupMarkers m = pickedMarkers(frames);
// The crossfade handle first, and only when there IS a loop to fade: at a zero fade it
// sits exactly on the loop start, so it can only stay reachable by owning the top strip
@@ -82,11 +88,6 @@ bool ReaSamplerEditor::mouseDownWaveform(const FaceLayout& fl, int x, int y) {
beginMarkerDrag(static_cast<WaveMarker>(hit), m, frames, x);
return true;
}
// No marker wanted the click: a drawn EG's own node grab/toggle (never add — empty space is
// tried last, below).
if (splineLive && splineOverlayClick(overlay, x, y, gesture, /*addOnEmptySpace=*/false)) {
return true;
}
// Nothing else wanted the click: now the drawn contour may take the empty space.
if (splineLive) return splineOverlayClick(overlay, x, y, gesture, /*addOnEmptySpace=*/true);
return false;
+5 -1
View File
@@ -69,10 +69,14 @@ StageEnvelope ReaSamplerEditor::packEnvelope(OverlayEnv which, const PlaySeconds
// post-start span, since it keeps running after a Trigger one-shot's amplitude has ended.
const std::int64_t playLen =
triggerPlayLength(play.trigger.lengthFraction, frames, startFrame);
const double playSpan = rate > 0.0 ? static_cast<double>(playLen) / rate : 0.0;
const double fullSpan =
rate > 0.0 ? static_cast<double>((std::max)(std::int64_t{0}, frames - startFrame)) / rate
: 0.0;
// Voice::start makes kTrigLength inert while any spline EG is active (trigSpan == postStart,
// not the %-length) — the overlay's amp/filter AHD must read the SAME span the engine plays,
// or its drawn shape and node drags cover only a fraction of what the note actually does.
const double playSpan =
splineActive(play) ? fullSpan : (rate > 0.0 ? static_cast<double>(playLen) / rate : 0.0);
const bool trigger = (play.playMode == PlayMode::Trigger);
switch (which) {
case OverlayEnv::kPitch: