コンテンツに移動

よくアクセスするページ

最近アクセスしたページ

navigation

MidiManager

public final class MidiManager
extends Object

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


This class is the public application interface to the MIDI service.

Instances of this class must be obtained using Context.getSystemService(Class) with the argument MidiManager.class or Context.getSystemService(String) with the argument Context.MIDI_SERVICE.

Summary

Nested classes

class MidiManager.DeviceCallback

Callback class used for clients to receive MIDI device added and removed notifications  

interface MidiManager.OnDeviceOpenedListener

Listener class used for receiving the results of openDevice(MidiDeviceInfo, MidiManager.OnDeviceOpenedListener, Handler) and openBluetoothDevice(BluetoothDevice, MidiManager.OnDeviceOpenedListener, Handler)  

Public methods

MidiDeviceInfo[] getDevices()

Gets the list of all connected MIDI devices.

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

Opens a Bluetooth MIDI device for reading and writing.

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

Opens a MIDI device for reading and writing.

void registerDeviceCallback(MidiManager.DeviceCallback callback, Handler handler)

Registers a callback to receive notifications when MIDI devices are added and removed.

void unregisterDeviceCallback(MidiManager.DeviceCallback callback)

Unregisters a MidiManager.DeviceCallback.

Inherited methods

Public methods

getDevices

added in API level 23
MidiDeviceInfo[] getDevices ()

Gets the list of all connected MIDI devices.

Returns
MidiDeviceInfo[] an array of all MIDI devices

openBluetoothDevice

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

Opens a Bluetooth MIDI device for reading and writing.

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)

Opens a MIDI device for reading and writing.

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)

Registers a callback to receive notifications when MIDI devices are added and removed. The onDeviceStatusChanged(MidiDeviceStatus) method will be called immediately for any devices that have open ports. This allows applications to know which input ports are already in use and, therefore, unavailable. Applications should call getDevices() before registering the callback to get a list of devices already added.

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)

Unregisters a MidiManager.DeviceCallback.

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

このサイトでは、ユーザーが選択したサイトの言語と表示設定を保存する目的で Cookie を使用しています。

Android デベロッパー向けの最新情報やヒントを入手して、Google Play での成功を手に入れましょう。

* 必須

送信しました

WeChat で Google Developers をフォローする

このサイトをで表示しますか?

ページの表示言語としてを選択しましたが、このサイトの言語はに設定されています。

言語設定を変更してこのサイトをで表示しますか?言語設定を変更する場合は、各ページの下にある言語メニューを使用してください。

このクラスには、API レベル 以上が必要です。

API レベル が選択されているため、このドキュメントは非表示になっています。左のナビゲーションの上にあるセレクタを使って、ドキュメントの API レベルを変更できます。

アプリに必要な API レベルを指定する方法について、詳しくは異なるプラットフォーム バージョンのサポートをご覧ください。

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)