[Bug 18764] MIDI messages don't all have a channel, and status should be part of data.

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

--- Comment #6 from Chris Wilson <cwilso@gmail.com> 2012-09-05 18:36:12 UTC ---
Ah, I see.  I think WebIDL gives you two options:

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

This operation is "variadic" - http://www.w3.org/TR/WebIDL/#dfn-variadic -
which means "required status param, any number (zero or more) of data args
following".  Or, you can have

void sendMessage(short status, optional short data0, optional short data1)

which uses "optional arguments"
(http://www.w3.org/TR/WebIDL/#dfn-optional-argument) and means "required status
param, either one or two data args following."  This would be my preferred
form, since MIDI short messages shouldn't (IMO) be allowed to have more than
three bytes.  Nullable types (e.g. short?) are, AFAICT, essentially the same as
Optional types here, so

void sendMessage(short status, short? data0, short? data1)

is okay too - although I think this may technically allow you to call the
function with:

sendMessage( value, NULL, value );

which is a little bizarre - optional is probably preferable for this reason
alone.

MIDI Short messages (i.e. non-sysex) always have a status byte followed by
zero, one or two data bytes per complete message.  What's currently in the spec
defines one data byte, followed by an optional second data byte - so even if
you don't want to call the first byte "status" (and I think we should), it
needs another data byte.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 5 September 2012 18:36:14 UTC