Add amy_config.midi_thru: echo MIDI in to MIDI out (#738)#739
Open
bwhitman wants to merge 1 commit into
Open
Conversation
When amy_config.midi_thru is set, every incoming MIDI byte is echoed straight to MIDI out, in addition to being processed normally. Off by default. Forwarding happens byte-by-byte inside convert_midi_bytes_to_messages, which all MIDI inputs (UART, USB) funnel through. Forwarding inside the parse loop (rather than blasting the whole input buffer) means USB MIDI packet padding is naturally skipped: USB always delivers fixed 3-byte groups, and the existing `if(usb) i = len+1` early-exits stop the loop before the padding bytes of <3-byte messages. UART input has no padding and forwards in full. Closes #738 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #738.
What
Adds an
amy_config_t.midi_thruflag. When set, AMY echoes every incoming MIDI byte straight to MIDI out, in addition to processing it normally. Off by default.How
Forwarding is done byte-by-byte at the top of
convert_midi_bytes_to_messages()— the single function that all MIDI inputs (UART viaesp_poll_midi/on_pico_uart_rx, USB viacheck_tusb_midi) funnel through.Forwarding inside the parse loop (rather than blasting the whole input buffer) keeps USB correct: USB MIDI always delivers fixed 3-byte groups, padded with junk for <3-byte messages. The existing
if(usb) i = len+1early-exits stop the loop before those padding bytes, so only the real MIDI bytes of a USB message are passed through. UART input has no padding and forwards in full.Notes
amy_midi.c(only the body of an existing function changed), so no Godot platform-stub updates are needed.tulip.amy_midi_thru(True/False)(companion tulipcc PR).Test
make test— all 94 tests pass (midi_thru is off by default; no behavior change to existing paths).amyboard(ESP32-S3) firmware compiles with the change.Docs updated:
docs/api.md(config table) anddocs/midi.md(new "MIDI Thru" section).