Skip to content

What is MIDIOutput.clear() meant to do? #260

Closed
@djipco

Description

@djipco

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Editshttps://speced.github.io/spec-maintenance/about/category: enhancementhttps://www.w3.org/policies/process/#class-3

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions