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: Mon, 17 Dec 2012 15:42:12 +0000
To: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
Cc: "public-audio@w3.org" <public-audio@w3.org>
Message-ID: <34EA4C6A7CD5431D8EB061D7BA82AE28@gmail.com>

On Monday, December 17, 2012 at 2:45 PM, Jussi Kalliokoski wrote:

> On Sun, Dec 16, 2012 at 9:30 AM, Marcos Caceres <marcosscaceres@gmail.com (mailto:marcosscaceres@gmail.com)> 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.
> >  
> > --
> > Marcos Caceres
> > http://datadriven.com.au
> Heh, we actually had a veeeery looooong discussion about this earlier: https://www.w3.org/Bugs/Public/show_bug.cgi?id=18764
Yeah, I read through the whole thread - it was really interesting. But, in the end, I didn't see how the spec ended up with just the array (instead of the array and the 3 bytes). I am in agreement that people will end up writing wrappers all over the place for this, but it would be great to at least not have to for some things.
Like I mentioned previously, as a JS developer, I kept screwing up and not putting things into an array. It's another thing I have to think about, which, IMHO, I shouldn't have to.  

It would be great now that we have some reference implementations to put this in from of some other devs for feedback. Lets see what kind of stuff they make and if the array thing comes up as a problem?  

Marcos Caceres
Received on Monday, 17 December 2012 15:42:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:14 UTC