Skip to content

Preserve unchanged delay histories across graph rebuilds - #1213

Open
jiri-god wants to merge 2 commits into
kushview:mainfrom
jiri-god:fix/graph-continuity
Open

jiri-god wants to merge 2 commits into
kushview:mainfrom
jiri-god:fix/graph-continuity

Conversation

@jiri-god

@jiri-god jiri-god commented Oct 29, 2026 •

Copy link
Copy Markdown

An unrelated graph rebuild currently resets every latency-compensation delay line. Even adding an unconnected node can briefly drop a delayed signal to zero. Graph scratch storage is also resized/allocated while publishing a new rendering sequence, and changing device block lengths can resize graph output storage in the callback.

This preserves delay histories for matching source/destination node IDs, ports and delay length (not temporary scratch-buffer indices). History transfer and publication are protected by the existing render lock. New scratch audio/MIDI storage is allocated before acquiring publication locks, and old storage is destroyed afterward. Graph output capacity is prepared ahead of time and reused for smaller variable blocks; device input scratch and MIDI buffers are reserved during preparation.

The MIDI reserve is 64 KiB, not an allocation-free guarantee for arbitrary SysEx traffic or plugin output. Graph publication still uses locks, and history matching is O(new operations × old operations); this does not promise glitch-free arbitrary live graph editing.

Validation on Apple Silicon macOS, RelWithDebInfo:

  • GraphContinuityTests mixes two constant sources with a 257-sample latency difference. On unmodified d0226686, adding an unconnected node drops all 128 samples in the next block from 0.75 to 0.5.
  • The regression also covers varying smaller block lengths and verifies that a changed delay length starts a new history rather than inheriting the old ring.
  • With this patch: all 59 CTest suites pass (3.63 s).

Based directly on main and independent of #1211/#1212. Linux/Windows validation is pending CI.

Combined validation: the four independent branches (#1211–#1214) merge without conflicts and all 62 CTest suites pass together on Apple Silicon macOS (4.06 s). Upstream Build/REUSE runs currently report action_required pending maintainer approval for this fork; no cross-platform CI success is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant