Friday, June 6, 2014

webmidi 9.3 not working in Chrome

It is kind of bullshit source, I should have smelt a rat. so Chrome doesn't conform to basic ins and outs and the code here fails:

http://www.w3.org/TR/webmidi/#listing-inputs-and-outputs

The example in section 9.3 is a bit shint, surely an ecma map like Chrome returns is better, whats with the odd looking containers and the abuse of the for in operator w3?

As for working code, Chrome likes the following better (with obligatory web midi enable in chrome:\\flags)

function enumMidiAccess( midiAccess ) {
 var inputs=midiAccess.inputs(); 
 for(var key in inputs) 
 {
  var input=inputs[key];
  console.log( "Input port " + input.name );
 }

 var outputs=midiAccess.outputs();
 for(var key in outputs)
 {
  var output=outputs[key];
  console.log( "Output port " + output.name );
 }
}

Google+ Chrome webmidi pre-announce https://plus.google.com/+ChrisWilson/posts/cs4J6sS9qmJ