New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is send
always overwriting MIDIMessage.channel
?
#56
Comments
It originates from this conversation I think: #9 (comment) I agree it is a bit weird to overwrite it. @kevinjwalters may have thoughts too. |
Not much to add as there's a lot covered in aforementioned conversation which is better than my memory here as this was quite a while back! I don't have an opinion on discussed change other than it may affect existing application code. There might have been some influence here from the original implementation too. |
I've been bitten by this too. Having so many useful places to set channel makes the logic a bit tricky. I would expect the precedence to be: ( if isinstance(msg, MIDIMessage):
msg.channel = channel to this: if isinstance(msg, MIDIMessage):
channel = msg.channel or channel # guard against msg channel not set But I've not tested this. |
I wouldn't use |
Just curious, but why is
send
forcing achannel
on a message (here) 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 thesend
method's channel argument (and theMIDI
objectout_channel
field) in being able to configure anout_channel
as some sort of a default when necessary.A more meaningful design, IMO, could be:
send
, use it.MIDIMessage.channel
, unless it is None.MIDI.out_channel
.The text was updated successfully, but these errors were encountered: