Description
MIDI-CI messages require a bi-directional communication with MIDI devices. As far as I can tell there is currently no way to map an input device with its corresponding output device with WebMIDI. Unfortunately a typical MIDI-CI message flow requires this mapping.
midiOutputDevice.send(/* a MIDI-CI query message */)
midiInputDevice.onmessage = (event) => { /* a MIDI-CI response message */ };
The problem is that there is currently no way to know which midiInputDevice
will receive the response when sending something to a particular midiOutputDevice
.
Most devices use similar names which makes it is easy for humans to map them. But I guess this is error prone since the names are different from operating system to operating system and a list of mapped devices would be very difficult to maintain.
MIDI-CI messages also contain a MIDI Negotiation Identifier (MIND) which is unique and would allow to map responses with query messages. But in order to do that one would have to listen to all MIDI input devices to capture each and every message just to find the one device that answers.
Maybe it's an options to add something similar to the groupId of a MediaDeviceInfo
object which identifies physical devices.
interface MIDIPort {
readonly attribute DOMString groupId;
};