feat(midi): add device routing and bounded external note output (phase 101)

This commit is contained in:
Johannes Findeisen 2026-11-06 02:23:37 +01:00
commit 75dee16b6a
9 changed files with 251 additions and 15 deletions

View file

@ -13,3 +13,22 @@ All persistent preference fields are listed by the shared C schema and available
in Preferences. Existing project tempo/controller maps remain project data;
Preferences project defaults apply to New. No configuration I/O runs in an audio
callback. Tests and screenshot captures use isolated configuration paths.
## MIDI backend
xtc exposes `midi_in` and `midi_out` JACK ports. The output sends scheduled MIDI
clip notes from unmuted, solo-eligible tracks, retaining source channels and
velocities, with clipped note boundaries and notes chased after seeks/loops.
Tracks share one output; matching pitches/channels on different tracks can
conflict on receiving devices. Audio faders, effects and bus processing do not
alter external MIDI. MIDI CC automation, program changes, clock and SysEx output
are outside this note-output workflow.
Input can filter a single channel, and output can preserve or force a channel.
Optional thru forwards supported live notes, controllers and pitch bend while
transport is active. Thru defaults off to avoid accidental feedback. Callback
work and event buffers are bounded; overflow requests all-notes-off and increments
the MIDI-drop counter. Panic and stop send CC123 on all channels. Immediate stop
waits up to 100 ms for callback acknowledgement before deactivation; delivery
cannot be guaranteed after server/device loss or to devices ignoring CC123.
No device is connected unless a user chooses it or an external patchbay routes it.

View file

@ -2241,12 +2241,12 @@ Implemented: ~/.xtc.conf is loaded before project/backend creation and saved ato
Expose JACK MIDI source/destination discovery, routing, input filtering and external MIDI output with bounded callback work and panic safety.
### Tasks and acceptance criteria
- [ ] Implement and document the workflow with bounded validation and safe ownership.
- [ ] Pass meaningful core and GUI checks, including errors and persistence or undo.
- [ ] Commit this phase separately after validation.
- [x] Implement and document the workflow with bounded validation and safe ownership.
- [x] Pass meaningful core and GUI checks, including errors and persistence or undo.
- [x] Commit this phase separately after validation.
### Implementation status
Planned.
Implemented: public JACK MIDI discovery/naming/routing/options APIs, a prepared bounded note-output schedule, optional filtered live thru and output channel override. Seek/loop discontinuities chase notes; panic/stop/overflow send all-notes-off. Core and allocation-failure suites and real JACK input/thru/receiver checks passed; deterministic backend checks cover event offsets, filtering, routing, panic and seek/note-off. See MIDI_WORKFLOWS.md for shared-output, transport-active and device-loss limits.
---