adafruit / adafruit/Adafruit_CircuitPython_MIDI
Why is `send` always overwriting `MIDIMessage.channel`?
- Dominant language
- Python
- Stars
- 56
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Just curious, but why is `send` forcing a `channel` on a message ([here](https://github.com/adafruit/Adafruit_CircuitPython_MIDI/blob/main/adafruit_midi/__init__.py#L155)) even if the message had its channel field set explicitly? Isn't the main point of the message having a "channel" field in being able to prepare a set of messages assigned to different channels and have the MIDI interpreter send them to those channels, exactly as given?
Sure, I could always make sure to write `midi.send(message, message.channel)`, but this now seems to defeat the purpose of the `send` method's channel argument (and the `MIDI` object `out_channel` field) in being able to configure an `out_channel` as some sort of a default when necessary.
A more meaningful design, IMO, could be:
* Whenever a parameter is passed to `send`, use it.
* Otherwise, use `MIDIMessage.channel`, unless it is None.
* ... in which case fall back to `MIDI.out_channel`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the send implementation in adafruit_midi/__init__.py around line 155 and read the issue's proposed channel-precedence rules alongside the MIDIMessage and MIDI out_channel behavior. Determine the intended precedence, check existing callers, and define completion as an agreed and tested behavior that preserves the documented default-channel use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100