[Bug 19975] Promote data and timestamp onmessage/MIDIEvent, get rid of MIDIMessage altogether?

https://www.w3.org/Bugs/Public/show_bug.cgi?id=19975

--- Comment #7 from Jussi Kalliokoski <jussi.kalliokoski@gmail.com> ---
(In reply to comment #6)
> 
> How are they stacked into a single event?  We must not be looking at the
> same MIDI APIs.  AFAICT, even in the questionably-deprecated DirectMusic
> MIDI API, short (non-sysex) messages are sent back one at a time:
> http://directmidi.sourceforge.net/documentation/creceiver.htm#CRRecv2.  Note
> that I haven't developed Windows MIDI s/w for a long time, though, so if I'm
> missing the right API, please point me in the right direction.

What I was referring to has nothing to do with how many messages the underlying
API gives the implementation. Let's say there's a layout operation that takes
250ms. During that time the underlying API relays the implementation multiple
messages. Now the implementation can decide if it fires these messages in
separate events or batches the messages into one event. Same as a silly
pseudo-code implementation:

bool isEventScheduled = false;
vector<MIDIMessage> messages;

void onmidimessage (MIDIMessage msg) {
  messages.add(msg);

  if (isEventScheduled) return;

  isEventScheduled = true;

  JS.onNextTick(void () {
    isEventScheduled = false;
    midiPort.triggerEvent("message", {
      MIDIMessages: messages
    })

    messages.clear()
  })
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 29 November 2012 20:37:26 UTC