Increase VA envelopes to 16 or 32 segments? #46

Closed
opened 2026-08-30 15:23:14 +00:00 by bcox · 1 comment
Owner

This could give us a montage-style motion sequence.

This could give us a montage-style motion sequence.
Author
Owner

Done in 9a1c914 — SegmentEnvelope::kMaxSegments is 32.

Step curves were already here (Segment::jump, minor 38), so this was length only. Modal and waveguide take the longer envelopes too, since the constant is shared and their destination maps don't scale with it.

This is a breaking format change. The VA map numbers a time lane and a level lane per segment per envelope, so kDestinationCount went 169 → 409 — past what a one-byte destination index can address. ModEntry::destination and the wire format both widen to 16 bits, and a matrix entry is 12 bytes now (source, via, two-byte destination, mode, a reserved zero, amount). That, plus the fixed envelope block growing 184 → 664 bytes, are changes an older reader must refuse rather than skip — so the format is major 3. The minor deliberately continues to 42: every minor >= N gate in the readers still admits exactly the records its own history entry describes, and restarting the count would flip all of them false.

Two live bugs fell out of the widening and are fixed here:

  • the VA default patch's four gate-target routes were truncating 407 to 151 through a static_cast<std::uint8_t>, so every VA layer the editor creates would have shipped with its vactrol routes aimed at LFO lanes;
  • the partial engine's prose still claimed a 121-partial ceiling that the byte no longer imposes.

Cost, measured rather than derived: sizeof(VaLayerType) 6576 → 8592 (1920 of it the matrix's two Sample arrays over 240 further destinations, 32 the touched_ bitmap, 64 touched_list_ at two bytes an entry); sizeof(Layer) 8992 → 9008; sizeof(VoiceType) 663704 → 663896. The VA alternative is still not the variant's largest, so the pool grows only by the wider index reaching every engine's matrix.

Default, --config=opt, --config=asan and --config=ubsan all 102/102; --config=tsan //plugin:preset_race_test passes. render_golden_test did not move, which is the evidence that nothing about the renderer changed.

Decisions taken while building that the plan did not anticipate — the reserved byte, the non-resetting minor, why kHandleLimit still is not carried into the VA envelope view — are in docs/superpowers/ledgers/2026-09-10-va-32-segments.md.

Done in `9a1c914` — `SegmentEnvelope::kMaxSegments` is 32. Step curves were already here (`Segment::jump`, minor 38), so this was length only. Modal and waveguide take the longer envelopes too, since the constant is shared and their destination maps don't scale with it. **This is a breaking format change.** The VA map numbers a time lane and a level lane per segment per envelope, so `kDestinationCount` went 169 → 409 — past what a one-byte destination index can address. `ModEntry::destination` and the wire format both widen to 16 bits, and a matrix entry is 12 bytes now (source, via, two-byte destination, mode, a reserved zero, amount). That, plus the fixed envelope block growing 184 → 664 bytes, are changes an older reader must refuse rather than skip — so the format is **major 3**. The minor deliberately continues to 42: every `minor >= N` gate in the readers still admits exactly the records its own history entry describes, and restarting the count would flip all of them false. Two live bugs fell out of the widening and are fixed here: - the VA default patch's four gate-target routes were truncating 407 to 151 through a `static_cast<std::uint8_t>`, so every VA layer the editor creates would have shipped with its vactrol routes aimed at LFO lanes; - the partial engine's prose still claimed a 121-partial ceiling that the byte no longer imposes. Cost, measured rather than derived: `sizeof(VaLayerType)` 6576 → 8592 (1920 of it the matrix's two Sample arrays over 240 further destinations, 32 the touched_ bitmap, 64 touched_list_ at two bytes an entry); `sizeof(Layer)` 8992 → 9008; `sizeof(VoiceType)` 663704 → 663896. The VA alternative is still not the variant's largest, so the pool grows only by the wider index reaching every engine's matrix. Default, `--config=opt`, `--config=asan` and `--config=ubsan` all 102/102; `--config=tsan //plugin:preset_race_test` passes. `render_golden_test` did not move, which is the evidence that nothing about the renderer changed. Decisions taken while building that the plan did not anticipate — the reserved byte, the non-resetting minor, why `kHandleLimit` still is not carried into the VA envelope view — are in `docs/superpowers/ledgers/2026-09-10-va-32-segments.md`.
bcox closed this issue 2026-09-11 00:27:06 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bcox/tymbal#46
No description provided.