如何在web midi api中发现midi键盘? [英] How to discover midi keyboard in web midi api?

查看:147
本文介绍了如何在web midi api中发现midi键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考: 2013年浏览器与Web MIDI API?

目前,我正在OS 10.9.2上运行Chrome 34.0.1847.116并尝试使用Web Midi API。启用chrome:// flags /#enable-web-midi后,我可以通过粘贴以下代码来获取midiAccess对象: http://www.w3.org/TR/webmidi/ 进入DevTools控制台。

I'm currently running Chrome 34.0.1847.116 on OS 10.9.2 and experimenting with the Web Midi API. After enabling chrome://flags/#enable-web-midi, I'm able to get a midiAccess object by pasting the following code from http://www.w3.org/TR/webmidi/ into the DevTools console.

var midi = null;  // global MIDIAccess object

function onMIDISuccess( midiAccess ) {
  console.log( "MIDI ready!" );
  midi = midiAccess;  // store in the global (in real usage, would probably keep in an object instance)
}
function onMIDIFailure(msg) {
console.log( "Failed to get MIDI access - " + msg );
}
navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );

当我查询midi.inputs()和midi.outputs()时,返回的列表仅包含IAC总线设备。我的midi键盘(连接Turtle Beach USB midi适配器)没有出现。在试图诊断问题时,我到目前为止发现了以下内容:

When I query midi.inputs() and midi.outputs(), the returned list contains only IAC Bus devices. My midi keyboard (connected with a Turtle Beach USB midi adapter) does not show up. In trying to diagnose the problem, I've so far found the following:

  • The adapter is visible in OS X's Audio/Midi Setup and the keyboard works correctly with Logic Pro as well as with homebrew CoreMidi code.
  • The web synth example at http://webaudiodemos.appspot.com/monosynth/index.html also fails to find the keyboard and does not make sound when keys are pressed.
  • The web synth example at http://djazz.se/lab/synth/ does make sound when I click on its virtual keys. DevTools shows that it's using an IAC Bus device.

我需要做些什么来帮助Chrome找到非IAC MIDI设备? / p>

What do I need to do to help Chrome find non-IAC MIDI devices?

推荐答案

开发人员cwilso对问题的解答(下面链接)解释了这个问题。必须重新启动浏览器以检测新的连接设备(即使已启用web-midi)。这样做会导致我的适配器被检测到并作为输入设备使用

The answer to the question (linked below) from developer cwilso explains the problem. The browser has to be rebooted to detect new connected devices (even if web-midi is already enabled). Doing caused my adapter to be detected and available as an input device

检测是否在Web MIDI API中连接了MIDI接口

这篇关于如何在web midi api中发现midi键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆