Most visited

Recently visited

Added in API level 23

MidiManager

public final class MidiManager
extends Object

java.lang.Object
   ↳ android.media.midi.MidiManager


这个类是MIDI服务的公共应用程序接口。

您可以通过调用 Context.getSystemService()来获得此类的实例。

MidiManager manager = (MidiManager) getSystemService(Context.MIDI_SERVICE);

Summary

Nested classes

class MidiManager.DeviceCallback

回叫类用于客户端接收MIDI设备添加和删除通知

interface MidiManager.OnDeviceOpenedListener

监听器类用于接收openDevice(MidiDeviceInfo, MidiManager.OnDeviceOpenedListener, Handler)openBluetoothDevice(BluetoothDevice, MidiManager.OnDeviceOpenedListener, Handler)的结果

Public methods

MidiDeviceInfo[] getDevices()

获取所有连接的MIDI设备的列表。

void openBluetoothDevice(BluetoothDevice bluetoothDevice, MidiManager.OnDeviceOpenedListener listener, Handler handler)

打开蓝牙MIDI设备进行读写。

void openDevice(MidiDeviceInfo deviceInfo, MidiManager.OnDeviceOpenedListener listener, Handler handler)

打开一个MIDI设备进行读写。

void registerDeviceCallback(MidiManager.DeviceCallback callback, Handler handler)

注册回调以在MIDI设备添加和删除时接收通知。

void unregisterDeviceCallback(MidiManager.DeviceCallback callback)

取消注册 MidiManager.DeviceCallback

Inherited methods

From class java.lang.Object

Public methods

getDevices

Added in API level 23
MidiDeviceInfo[] getDevices ()

获取所有连接的MIDI设备的列表。

Returns
MidiDeviceInfo[] an array of all MIDI devices

openBluetoothDevice

Added in API level 23
void openBluetoothDevice (BluetoothDevice bluetoothDevice, 
                MidiManager.OnDeviceOpenedListener listener, 
                Handler handler)

打开蓝牙MIDI设备进行读写。

Parameters
bluetoothDevice BluetoothDevice: a BluetoothDevice to open as a MIDI device
listener MidiManager.OnDeviceOpenedListener: a MidiManager.OnDeviceOpenedListener to be called to receive the result
handler Handler: the Handler that will be used for delivering the result. If handler is null, then the thread used for the listener is unspecified.

openDevice

Added in API level 23
void openDevice (MidiDeviceInfo deviceInfo, 
                MidiManager.OnDeviceOpenedListener listener, 
                Handler handler)

打开一个MIDI设备进行读写。

Parameters
deviceInfo MidiDeviceInfo: a MidiDeviceInfo to open
listener MidiManager.OnDeviceOpenedListener: a MidiManager.OnDeviceOpenedListener to be called to receive the result
handler Handler: the Handler that will be used for delivering the result. If handler is null, then the thread used for the listener is unspecified.

registerDeviceCallback

Added in API level 23
void registerDeviceCallback (MidiManager.DeviceCallback callback, 
                Handler handler)

注册回调以在MIDI设备添加和删除时接收通知。 对于任何具有开放端口的设备,将立即调用onDeviceStatusChanged(MidiDeviceStatus)方法。 这允许应用程序知道哪些输入端口已被使用,因此不可用。 在注册回调之前,应用程序应调用getDevices()以获取已添加设备的列表。

Parameters
callback MidiManager.DeviceCallback: a MidiManager.DeviceCallback for MIDI device notifications
handler Handler: The Handler that will be used for delivering the device notifications. If handler is null, then the thread used for the callback is unspecified.

unregisterDeviceCallback

Added in API level 23
void unregisterDeviceCallback (MidiManager.DeviceCallback callback)

取消注册 MidiManager.DeviceCallback

Parameters
callback MidiManager.DeviceCallback: a MidiManager.DeviceCallback to unregister

Hooray!