- From: <bugzilla@jessica.w3.org>
- Date: Mon, 24 Dec 2012 08:15:56 +0000
- To: public-audio@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20505 Bug ID: 20505 Summary: merge getInput, getOutput -> getPort() or getPortById() Classification: Unclassified Product: AudioWG Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P2 Component: MIDI API Assignee: dave.null@w3.org Reporter: w3c@marcosc.com QA Contact: public-audio@w3.org The methods getInput() and getOutput() effectively do the same thing (evident also by the amount of duplicate text in the spec); as such, they should be merged. Furthermore, it's not clear (in the spec) as why there are 3 different ways to get a MIDIPort. I would like to suggest that these two methods be merged into a single method and the way to be one way to get a MIDIPort: by its ID… hence getPort(id) or getPortById(id); Consider: 1. getInput/Output(MIDIPort)… doesn't make much sense, as why is a developer requesting a MIDIPort with a MIDIPort they already have? I'm sure there is something I'm missing here. 2. getInput/Output(short): first, short here doesn't make much sense, given that a WebIDL short is defined as: "The short type is a signed integer type that has values in the range [−32768, 32767]". So requesting negative indexes don't make any sense here. In addition, this is basically the same as doing: var port = midiAccess.getInputs()[x]; Additionally, the ordering of the ports may or may not be consistent after each session, so saying getInput(number) is inherently unreliable. Also, it's kinda unhelpful is you want to, for instance, get the last available port. This is because midiAccess has no length property. The only way to get the length is to first call getInputs(), and get the length from there… but then you already have the list of inputs, in so you don't then need to call getInput( number ), because it's already the same as inputs[number]. 3. getInput/Output( id ): this is probably the only one that makes sense. It's a cheap way of checking if a previously used exists: var favInstrument = midiAccess.getInput(localStorage.fav) if(favInstrument){ … } Also, if target is is not found, just return null. Please don't throw an exception. Throwing exceptions should be done in "exceptional" circumstances, not on simple lookups. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Monday, 24 December 2012 08:15:57 UTC