public final class MidiManager extends Object
You can obtain an instance of this class by calling
Context.getSystemService()
.
Modifier and Type | Class and Description |
---|---|
static class |
MidiManager.DeviceCallback
Callback class used for clients to receive MIDI device added and removed notifications
|
static interface |
MidiManager.OnDeviceOpenedListener
Listener class used for receiving the results of
openDevice(android.media.midi.MidiDeviceInfo, android.media.midi.MidiManager.OnDeviceOpenedListener, android.os.Handler) and
openBluetoothDevice(android.bluetooth.BluetoothDevice, android.media.midi.MidiManager.OnDeviceOpenedListener, android.os.Handler) |
Modifier and Type | Field and Description |
---|---|
static String |
BLUETOOTH_MIDI_SERVICE_CLASS
BluetoothMidiService class name
|
static String |
BLUETOOTH_MIDI_SERVICE_INTENT
Intent for starting BluetoothMidiService
|
static String |
BLUETOOTH_MIDI_SERVICE_PACKAGE
BluetoothMidiService package name
|
Constructor and Description |
---|
MidiManager(IMidiManager service) |
Modifier and Type | Method and Description |
---|---|
MidiDeviceServer |
createDeviceServer(MidiReceiver[] inputPortReceivers,
int numOutputPorts,
String[] inputPortNames,
String[] outputPortNames,
Bundle properties,
int type,
MidiDeviceServer.Callback callback) |
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 . |
public static final String BLUETOOTH_MIDI_SERVICE_INTENT
public static final String BLUETOOTH_MIDI_SERVICE_PACKAGE
public static final String BLUETOOTH_MIDI_SERVICE_CLASS
public void registerDeviceCallback(MidiManager.DeviceCallback callback, Handler handler)
MidiManager.DeviceCallback.onDeviceStatusChanged(android.media.midi.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.callback
- a MidiManager.DeviceCallback
for MIDI device notificationshandler
- The Handler
that will be used for delivering the
device notifications. If handler is null, then the thread used for the
callback is unspecified.public void unregisterDeviceCallback(MidiManager.DeviceCallback callback)
MidiManager.DeviceCallback
.callback
- a MidiManager.DeviceCallback
to unregisterpublic MidiDeviceInfo[] getDevices()
public void openDevice(MidiDeviceInfo deviceInfo, MidiManager.OnDeviceOpenedListener listener, Handler handler)
deviceInfo
- a MidiDeviceInfo
to openlistener
- a MidiManager.OnDeviceOpenedListener
to be called
to receive the resulthandler
- the Handler
that will be used for delivering
the result. If handler is null, then the thread used for the
listener is unspecified.public void openBluetoothDevice(BluetoothDevice bluetoothDevice, MidiManager.OnDeviceOpenedListener listener, Handler handler)
bluetoothDevice
- a BluetoothDevice
to open as a MIDI devicelistener
- a MidiManager.OnDeviceOpenedListener
to be called to receive the
resulthandler
- the Handler
that will be used for delivering
the result. If handler is null, then the thread used for the
listener is unspecified.public MidiDeviceServer createDeviceServer(MidiReceiver[] inputPortReceivers, int numOutputPorts, String[] inputPortNames, String[] outputPortNames, Bundle properties, int type, MidiDeviceServer.Callback callback)