Repository navigation
Closed as not planned
Description
Part of #2.
Wire the plugin up to window.feedBack.midiInput (core's midi-input capability domain) instead of calling navigator.requestMIDIAccess() directly. This is the shared device-access boundary already used by plugins/input_setup and plugins/drum_highway_3d — one permission prompt, one source list, works uniformly across a MIDI keyboard, a generic pad controller, or an e-kit module (Web MIDI abstracts them identically at this layer).
API to use (confirmed from plugins/input_setup/screen.js and plugins/drum_highway_3d/screen.js):
mi.discover()— the permission boundary; recordsdenied/unavailableoutcomes.mi.listSources()—{ sourceId, logicalSourceKey, label, kind, availability, selected }[].mi.select(logicalSourceKey)/mi.open({ requester, logicalSourceKey })→{ handle }.handle.addListener(cb)/handle.removeListener(cb)—cb(data)receives raw MIDI bytes; note-on is(data[0] & 0xf0) === 0x90 && data[2] > 0, note number indata[1], velocity indata[2].mi.close({ requester, logicalSourceKey })when done. Close on every exit path (teardown, screen change), mirroringinput_setup's_activeCleanup.- Subscribe to
midi-input:sources-changed(viawindow.feedBack.on) for device replug/unplug, mirroringdrum_highway_3d's_midiStateSubpattern — reconnect the saved device on recovery, no fallback-switch on a transient unplug. - Support multiple simultaneous open sources merged into one logical input stream (e.g. a kick pedal on one device, pads on another), tagging each captured event with its
logicalSourceKeyso the calibration step can disambiguate.
Gate on domain presence, not browser API presence — midiAvailable = !!(mi && mi.version === 1), exactly as input_setup does, so a non-Web-MIDI native provider registered with the domain isn't hidden.
Acceptance:
- Plugin requests
midi-inputcapability inplugin.json(roles: ["requester"],requests: ["discover", "list-sources", "select-source", "open-source", "close-source"],compatibility: "degrade-noop",ownership: "requester-only",safety: "sensitive"— mirrorinput_setup's declaration). - Works with the domain absent (fail-soft empty state, no crash).
- Device list refreshes on replug without a page reload.
Metadata
Metadata
Assignees
Labels
No labels
Activity
pullfrog commentedon Oct 4, 2026
pullfrog commentedon Oct 5, 2026
PR: #10
Adds the
midi-drumsplugin: it scans for input devices throughwindow.feedBack.midiInput, opens several at once, and merges their note-ons into one stream tagged bylogicalSourceKey. Ticked keys persist server-side viaroutes.py.Key decisions, and why:
mi && mi.version === 1), never onnavigator.requestMIDIAccess. Gating on the browser API would hide a usable non-Web-MIDI provider beforediscover()had ever run, and would claim a Host was capable when its domain is absent.discover()is the permission boundary, called only once the screen is active so the prompt never appears on someone else's screen. A denied result is recorded but never latched — Rescan retries it.logicalSourceKeys, never labels, and a missing device is never silently substituted. It keeps its tick and reopens on return.getSelected()is an optional optimisation, since a Host may implement only what the manifest declares.A pre-commit self-review surfaced four more genuine bugs, all fixed: an
open()racing past the screen going inactive (stranding a session nothing would close), an unguardedgetSelected()that could freeze the UI on a conforming Host, a one-shot bus subscription that silently killed replug recovery whenwindow.feedBackappeared late, and overlapping POSTs that could roll the saved selection back.Verification: 89 jsdom checks and 27 FastAPI route checks against throwaway harnesses outside the tree (the repo has no build, lint, or test tooling), plus
node --checkandpy_compile. The plugin has not been exercised against a real Host build with hardware attached — that manual pass is still outstanding, and the PR body says so.Settings UI and kit profiles remain in the epic (#2) as separate sub-issues.
Task list (2/8 completed)
big-pickle(free) | 𝕏