Skip to content

A control-panel adapter for instruments - #37

Merged
bdbarnett merged 1 commit into
mainfrom
panel-adapter
Nov 1, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
panel-adapter

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

audioinstruments.panel.PanelAdapter(inst) wraps an instrument from audioinstruments.create() in the adapter a control panel edits through: script_name, macro_labels/macro_count, sixteen macro_values on the MIDI scale, patches/patch_index, bypass, engine_ready/engine_error/engine_message, request_reload() and on_external_change(). It imports no panel.

For a MIDI path, note_cc(i, v) and note_program(i) move the instrument and tell the listeners, and note_on/note_off pass through with note_on dropped while bypassed. panel.create(name, rate, **options) remembers the options so a reload builds the same instrument; the reload keeps the patch and macros, swaps .instrument, calls on_reload(cb) with the new and old instruments, and on a failure keeps the old one and reports why.

Tests: tests/test_panel.py (poly106 and rhythm808) and tests/mpy/test_panel.py, which passes on a unix MicroPython build with audiodsp, including a check that a bypassed note allocates nothing. Docs: docs/panel.md.

@bdbarnett
bdbarnett merged commit 92b0673 into main Nov 1, 2026
1 check passed
@bdbarnett
bdbarnett deleted the panel-adapter branch November 1, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant