fix: restore waveform symmetry about the midline, cut deck_values' link to the bank model, and unit-test the column arithmetic

The waveform column's vertical extents move to pure component_geometry so the shared
primitive stops being untested; PlaySeconds hoists into a header-only play_seconds target.
This commit is contained in:
2026-08-01 09:47:07 -04:00
parent 7f74b11dce
commit ca464397b2
17 changed files with 310 additions and 138 deletions
+18 -4
View File
@@ -38,8 +38,12 @@ static void testNormRoundTripsThroughEveryValueDomain() {
CHECK(p.trigAhd.holdFraction == 0.75);
CHECK(deckParamNorm(DeckParam::kTrigHold, p) == 0.75);
setDeckParam(DeckParam::kFilterCutoff, p, 0.5, 0);
CHECK(deckParamNorm(DeckParam::kFilterCutoff, p) == 0.5);
// Named field, not just a round trip: cutoff and morph are both normalized positions with
// the same 1.0 default, so a getter+setter pair that swapped them would round-trip cleanly.
setDeckParam(DeckParam::kFilterCutoff, p, 0.25, 0);
CHECK(p.filter.settings.cutoffNorm == 0.25f);
CHECK(p.filter.settings.morphNorm == 1.0f);
CHECK(deckParamNorm(DeckParam::kFilterCutoff, p) == 0.25);
// Bipolar: the centre detent is exact in BOTH directions, so a knob parked at centre
// persists no depth at all.
@@ -117,8 +121,10 @@ static void testInnerResetLandsOnTheExactLinearNeutral() {
CHECK(p.filter.trigEnv.decayCurve == 1.0);
}
// A reset lands on the field's own stored default, exactly — the defaults are read off a fresh
// PlaySeconds rather than from a second table.
// A reset lands on the field's own stored default, EXACTLY — the defaults are read off a fresh
// PlaySeconds and arrive through the norm round trip, so the two stage times whose defaults are
// neither 0 nor 1 are the cases that actually exercise that exactness (see resetDeckParam's
// note on what the seconds ceiling has to be for it to hold).
static void testResetLandsOnTheStoredDefaultOfEachControl() {
const PlaySeconds defaults;
PlaySeconds p;
@@ -126,16 +132,24 @@ static void testResetLandsOnTheStoredDefaultOfEachControl() {
setDeckParam(DeckParam::kTrigLength, p, 0.3, 0);
setDeckParam(DeckParam::kFilterKeyTrack, p, 0.9, 0);
setDeckParam(DeckParam::kPitchEnvDepth, p, 1.0, 0);
setDeckParam(DeckParam::kAttack, p, 0.5, 0);
setDeckParam(DeckParam::kRelease, p, 0.5, 0);
CHECK(p.adsr.attackSeconds != defaults.adsr.attackSeconds);
CHECK(p.adsr.releaseSeconds != defaults.adsr.releaseSeconds);
resetDeckParam(DeckParam::kSustain, p);
resetDeckParam(DeckParam::kTrigLength, p);
resetDeckParam(DeckParam::kFilterKeyTrack, p);
resetDeckParam(DeckParam::kPitchEnvDepth, p);
resetDeckParam(DeckParam::kAttack, p);
resetDeckParam(DeckParam::kRelease, p);
CHECK(p.adsr.sustainLevel == defaults.adsr.sustainLevel);
CHECK(p.trigger.lengthFraction == defaults.trigger.lengthFraction);
CHECK(p.filter.keyTrack == defaults.filter.keyTrack);
CHECK(p.pitchEnv.peakSemitones == defaults.pitchEnv.peakSemitones);
CHECK(p.adsr.attackSeconds == defaults.adsr.attackSeconds);
CHECK(p.adsr.releaseSeconds == defaults.adsr.releaseSeconds);
}
// One unit, everywhere, across the formatter's whole range: a sub-millisecond value keeps a