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:
@@ -229,11 +229,16 @@ public:
|
||||
}
|
||||
void clear() { pts_ = nullptr; n_ = 0; }
|
||||
bool active() const { return n_ >= 2; }
|
||||
// True once the cursor has settled on the contour's LAST segment: past this point there is
|
||||
// no further point to rise into, so a value read here that reaches 0 is a genuine permanent
|
||||
// terminus (Voice::tickAmplitude's early-free), unlike a 0 touched mid-contour, which a
|
||||
// later segment may still rise out of (the spline is deliberately not globally monotone).
|
||||
// True once the cursor has settled on the contour's LAST segment. On its own this does NOT
|
||||
// make a 0 read here a terminus: the final segment's LEFT endpoint can also be 0 (a 2-point
|
||||
// contour is nothing but a single "final" segment starting at frame 0), which would read 0
|
||||
// while about to rise. Voice::tickAmplitude pairs this with terminalValue() == 0 — the
|
||||
// segment's RIGHT endpoint, i.e. the whole contour's true end — before calling a 0 read the
|
||||
// note's genuine permanent terminus.
|
||||
bool onFinalSegment() const { return seg_ + 2 == n_; }
|
||||
// The current segment's right endpoint — the whole contour's terminal Y only when paired
|
||||
// with onFinalSegment() (see there).
|
||||
double terminalValue() const { return y1_; }
|
||||
|
||||
// `phase` is normalized position over the contour's whole span, [0,1]; out-of-range clamps
|
||||
// to the terminal values (a note past its span holds the contour's last level).
|
||||
|
||||
@@ -186,12 +186,18 @@ private:
|
||||
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
|
||||
// that flatlines at 0 across its FINAL segment is a permanent terminus (no later
|
||||
// segment to rise out of), so that case frees early too, the spline analogue of a
|
||||
// staged AHD's finished() — mid-contour dips do not, since the spline is deliberately
|
||||
// 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.
|
||||
amp = ampSplineCur_.eval(splinePhase());
|
||||
if (amp == 0.0 && ampSplineCur_.onFinalSegment()) amplitudeDone_ = true;
|
||||
if (amp == 0.0 && ampSplineCur_.onFinalSegment() &&
|
||||
ampSplineCur_.terminalValue() == 0.0) {
|
||||
amplitudeDone_ = true;
|
||||
}
|
||||
} else if (playMode_ == PlayMode::Gate) {
|
||||
amp = env_.tick();
|
||||
if (env_.finished()) amplitudeDone_ = true;
|
||||
|
||||
@@ -180,11 +180,12 @@ DeckHit hitTestDeck(const DeckLayout& layout, int x, int y) {
|
||||
return {DeckHitKind::RowToggle, g.rowToggle.id, 1};
|
||||
}
|
||||
for (const DeckCellLayout& c : g.cells) {
|
||||
if (c.id >= 0 && contains(c.cell, x, y)) {
|
||||
// Every entry here already has a real id — a reserve yields no DeckCellLayout at all.
|
||||
if (contains(c.cell, x, y)) {
|
||||
return {DeckHitKind::Knob, c.id, -1, contains(c.inner, x, y)};
|
||||
}
|
||||
}
|
||||
return {}; // inside the box but on fence/padding/blank — a miss (groups never overlap)
|
||||
return {}; // inside the box but on fence/padding — a miss (groups never overlap)
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ struct DeckGroupDesc {
|
||||
// first is absent) — why this exists rather than a rowToggle is recorded once, at this
|
||||
// module's CLAUDE.md bullet.
|
||||
DeckToggleDesc captionToggle2;
|
||||
std::vector<int> cellIds; // knob cells; -1 = blank reserve
|
||||
std::vector<int> cellIds; // knob cells; -1 reserves width only, no cell (see above)
|
||||
DeckToggleDesc rowToggle; // in the knob row after the cells; id -1 = none
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// spline_edit.h — THE point-editing grammar, and the one place it is written down. Both spline
|
||||
// consumers route their mouse-down through it — the velocity-curve popup and the spline EG
|
||||
// overlay — so the two cannot drift into two grammars. Mirror of envelope_edit: decision logic
|
||||
// only, no host types, no drawing.
|
||||
// spline_edit.h — the point-editing grammar's CLICK resolution: add/grab/delete/toggle from a
|
||||
// single (x, y). Both spline consumers — the velocity-curve popup and the spline EG overlay —
|
||||
// route their mouse-down through it, so the two cannot drift into two click grammars. Two more
|
||||
// gesture rules complete the grammar but live in the shell (see the note near the bottom of this
|
||||
// file). Mirror of envelope_edit otherwise: decision logic only, no host types, no drawing.
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -39,4 +40,15 @@ SplineEdit resolveSplineEdit(const VelocityCurve& curve, const VelocityCurve::Bo
|
||||
// waveform beneath it. Takes the overlay (not a lane) — see waveform_view.h's overlay contract.
|
||||
VelocityCurve::Box splineOverlayBox(const OverlayArea& area);
|
||||
|
||||
// Two more rules complete the grammar. Both are enforced in the shell — mouse-tracking / drag
|
||||
// state has no home in a pure module — and recorded here as their one home rather than restated
|
||||
// at each call site:
|
||||
// - DRAG-OFF DELETE: releasing a grabbed node well outside its box deletes it (endpoints exempt,
|
||||
// per deletePoint's own refusal) — editor_input.cpp's onMouseUp, shared verbatim by the popup
|
||||
// and the overlay.
|
||||
// - THE OVERLAY'S OUTSIDE-BOX EXCEPTION: resolveSplineEdit's own outside-box grab/toggle/delete
|
||||
// allowance (above) is meant for the popup's inset ring; the overlay narrows it back to
|
||||
// strictly in-box, since splineOverlayBox has no inset — editor_input_waveform.cpp's
|
||||
// splineOverlayClick.
|
||||
|
||||
} // namespace reasampler::instrument::ui
|
||||
|
||||
Reference in New Issue
Block a user