Need help with MultiPort #326
-
I am working in a program that autosaves MIDI messages as they are played, and everything is working really well when using a single input port. ports = mido.get_input_names() for msg_A in port_A.iter_pending(): The problem with this is that the loops are sequential. When I test by sending the same midi message through the 2 ports, the same event when entering through port_B is processed with a few milliseconds of delay. I want to test if the mido.ports.MultiPort() helps. My problem is that I cannot make it to work. If I try: multi = mido.ports.MultiPort([port_A, port_B]) as suggested in the documentation, no msg is printed... I have done all sorts of syntax combinations for the ports in multi, but nothing seems to work. EDIT: I posted the same question at stackoverflow and received an helpful suggestion as a workaround: open_ports = [port_A, port_B] Now the same MIDI message sent through both ports arrive simultaneously. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for sharing your solution. I guess one could also use callbacks instead of polling depending on the requirements. |
Beta Was this translation helpful? Give feedback.
Thanks for sharing your solution.
I guess one could also use callbacks instead of polling depending on the requirements.
This would lighten the loop load at the cost of having to handle thread synchronisation according to the docs.