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

[Web MIDI API] send(sequence<short> data)

From: Marcos Caceres <marcosscaceres@gmail.com>
Date: Mon, 24 Dec 2012 01:15:10 +0000
To: "public-audio@w3.org" <public-audio@w3.org>
Message-ID: <395D8C8A0714492082E0B83AC84B1AE3@gmail.com>
If the first argument of send() is going to be coerced in to a Uint8Array, then send should just take any as a type. That avoids a whole bunch of unnecessary checks that will be performed when whatever value if thrown into new Uint8Array().  

For example:

send({}) === []
send(function(){}) === []
send(Node) === []  

send("") === [0]
send([" "]) === []

send([undefined,null,Node,Array, [1,23,432]]) === [0, 0, 0, 0, 0]

This one is important:
send(["100", "200", "300"])  === [100, 200, 44]


And so on…  

--  
Marcos Caceres
http://datadriven.com.au
Received on Monday, 24 December 2012 01:15:39 UTC

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