fix: close round-3 review findings — smallest-target-first, residue test fix, extraction

Waveform overlay now resolves node/tab/marker click collisions by target area instead of check order; residue test now uses a distinguishing fixture; Gate-unavailable-while-drawn logic extracted to one pure helper shared by resolvePlay and applyControl.
This commit is contained in:
2026-07-31 23:44:05 -04:00
parent c3d67bc3da
commit 757e1585d6
11 changed files with 255 additions and 87 deletions
+3 -10
View File
@@ -184,18 +184,11 @@ private:
// entirely — release() then has no envelope to end, and an active sustain loop rings
// forever.
if (ampSplineCur_.active() && playMode_ == PlayMode::Trigger) {
// A contour covers the sample end to end, so the head leaving the span IS the end of
// the note — the exhaustion path in advanceFrame is what frees the voice. A contour
// whose TERMINAL value (the final segment's right endpoint) is 0 reaches a genuine
// permanent terminus early, the spline analogue of a staged AHD's finished(). Gating
// on the terminal value, not just the segment index, matters because a 2-point
// contour IS a single "final" segment from frame 0 — checking onFinalSegment() alone
// would call a contour that STARTS at 0 (e.g. a fade-in) over before it ever rises.
// Mid-contour dips through 0 still don't free early, since the spline is deliberately
// not globally monotone.
// Early-free at a genuine permanent terminus (the spline analogue of a staged AHD's
// finished()) — onFinalSegment()/segmentEndValue()'s own doc comments own the why.
amp = ampSplineCur_.eval(splinePhase());
if (amp == 0.0 && ampSplineCur_.onFinalSegment() &&
ampSplineCur_.terminalValue() == 0.0) {
ampSplineCur_.segmentEndValue() == 0.0) {
amplitudeDone_ = true;
}
} else if (playMode_ == PlayMode::Gate) {