Re: [Web MIDI API] send() method should also allow 3 shorts + timestamp

On Sunday, 16 December 2012 at 07:30, Marcos Caceres wrote:

> Currently, the send() method is defined as:  
> void send (sequence<short> data, optional DOMHighResTimeStamp? timestamp);
>  
> However, it appears to me that it is extremely common to only want to send 3 bytes of data at a time (+ optional timestamp)… Having now been playing around with the API for about 10 hours, I actually keep forgetting to put things into an array (which leads to annoying errors). Can I recommend that the send interface be overloaded:
>  
> void send (sequence<short> data, optional DOMHighResTimeStamp? timestamp);
> void send (short byte1, short byte2, short byte3, optional DOMHighResTimeStamp? timestamp);  
>  
> That would make the interface much more natural to work with and avoid having to remember to put things into an array all the time.  
>  


I also just just realised that "short" is the wrong type, the spec should be using "octet":  
The octet type is an unsigned integer type that has values in the range [0, 255].

While "short" is defined as:  
The short type is a signed integer type that has values in the range [−32768, 32767].

So:
void send (sequence<octet> data, optional DOMHighResTimeStamp? timestamp);
void send (octet byte1, octet byte2, octet byte3, optional DOMHighResTimeStamp? timestamp);

Received on Sunday, 16 December 2012 09:23:55 UTC