W3C home > Mailing lists > Public > public-audio@w3.org > October to December 2012

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

From: Marcos Caceres <marcosscaceres@gmail.com>
Date: Sun, 16 Dec 2012 09:23:24 +0000
To: "public-audio@w3.org" <public-audio@w3.org>
Message-ID: <9CF6BB832E0446F3BB48AB47EE7FABB2@gmail.com>



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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:50:04 UTC