Bug 18762 - MIDIOutput.sendMessage doesn't need a timestamp
Summary: MIDIOutput.sendMessage doesn't need a timestamp
Alias: None
Product: AudioWG - OBSOLETE - Moved to Github
Classification: Unclassified
Component: MIDI API - OBSOLETE - Now on Github (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: TBD
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-audio
Depends on:
Reported: 2012-08-31 22:43 UTC by Chris Wilson
Modified: 2012-09-20 06:59 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Chris Wilson 2012-08-31 22:43:30 UTC
After reviewing carefully the use in practice, as well as historical usage from the Windows MIDI APIs, I believe the sendMessage() "short message shortcut" should not have a timestamp, in order to allow a variable length short message.  (From status-byte-only to typical 3-byte messages.)

The Windows method doesn't have this, and the overhead of using sendMIDIMessage(createMIDIMessage()) is actually not very large if you DO want the timestamp.
Comment 1 Jussi Kalliokoski 2012-09-05 09:58:02 UTC
Fair enough. Actually what I want to do right now with this and Bug 18764 is to shrink the MIDIMessage interface to just contain the timestamp and the data, status and channel being the first byte. Thoughts? I'm also thinking of a way to make the MIDIMessage interface a dictionary instead.

In that case we'd have

sendMessage(firstByte, secondByte, thirdByte, ...)

and the longer version for more complicated messages:

  timestamp: performance.now() + 1234.0,
  data: new Uint8Array([firstByte, secondByte, thirdByte, ...])

How's that sound?
Comment 2 Jussi Kalliokoski 2012-09-05 12:15:08 UTC
Proposed changeset: https://dvcs.w3.org/hg/audio/rev/bf0e920450e6
Comment 3 Chris Wilson 2012-09-05 17:20:43 UTC
Comment 4 Florian Bomers 2012-09-05 19:31:07 UTC
just asking: doesn't the syntax allow you to define:

void sendMessage(DOMHighResTimeStamp timestamp, short status, short... data)

Then we could have a timestamp for the convenience "send" method, and a variable length message. Set timestamp to 0 to send it immediately.
Comment 5 Olivier Thereaux 2012-09-20 06:59:30 UTC
Hearing no objection after over a week, closing.