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
+24
View File
@@ -321,6 +321,29 @@ static void testAContourReplaysProportionallyOnADifferentLengthSample() {
CHECK(a[shortLen / 2] > a[10] + 0.2);
}
// --- Regression: a 2-point contour starting at 0 is not a terminus at frame 0 -----------
//
// onFinalSegment() (seg_+2==n_) is trivially true for a 2-point contour. Gating the amp
// spline's early-free on that alone reads a contour's OWN opening value as the note's end,
// so the simplest fade-in (left knot dragged to the box floor) went silent at frame 0. The
// fix requires the TERMINAL value (the segment's right endpoint) to be 0, not just the
// segment index.
static void testTwoPointContourRisingFromZeroSoundsForItsFullSpan() {
const VelocityCurve contour =
VelocityCurve::fromPoints({{kVelMin, 0.0}, {kVelMax, 1.0}}, CurveDomain::Unipolar);
const std::size_t frames = 1000;
const SampleData s = splineAmpSample(frames, contour);
Voice v;
v.start(60, 100, s);
CHECK(v.soundingNote()); // fresh note: sounding before anything is rendered
const double y0 = v.renderFrame();
CHECK(near(y0, 0.0, 1e-9)); // the contour's own value at phase 0 IS 0 ...
CHECK(v.soundingNote()); // ...but the note itself must not be over yet
for (std::size_t i = 1; i < frames / 2; ++i) v.renderFrame();
CHECK(v.soundingNote()); // still sounding at the midpoint, rising toward 1
}
// --- 9. A fresh spline EG opens on the smooth y = 1 - x ----------------------
static void testAFreshSplineEgDefaultsToTheSmoothDownwardSlope() {
@@ -467,6 +490,7 @@ int main() {
testStagedAndSplineStatesBothSurviveAFlipAndASaveReload();
testAV12PayloadLoadsWithoutLoss();
testAContourReplaysProportionallyOnADifferentLengthSample();
testTwoPointContourRisingFromZeroSoundsForItsFullSpan();
testAFreshSplineEgDefaultsToTheSmoothDownwardSlope();
testGateIsUnavailableWhileASplineEgIsActiveAndReturnsAfterwards();
testTheVelocityAmpCurveGainsTheToggleAndKeepsItsDelete();