Closed
Description
I'm not sure if the problem is with the wording of the spec, with the way Firefox implemented it or maybe it's just me but I was expecting MIDIOutput.clear()
to also delete messages queued up for later delivery. After running some tests, it seems it is not the case.
For example, the code below does trigger the notes scheduled for 3 seconds later (in Firefox 120.0.1):
function onMIDISuccess(midiAccess) {
midiAccess.outputs.forEach(o => {
o.send([0x90, 60, 0x7f]);
o.send([0x90, 60, 0x7f], performance.now() + 3000); // those also get sent
o.clear();
});
}
navigator
.requestMIDIAccess()
.then(onMIDISuccess, msg => `MIDI error: ${msg}`);
The spec says that the clear()
method Clears any pending send data that has not yet been sent from the MIDIOutput's queue. Shouldn't that also include messages scheduled to be sent later? Is there something I'm not understanding properly?