Added in API level 23

MidiDeviceInfo


class MidiDeviceInfo : Parcelable
kotlin.Any
   ↳ android.media.midi.MidiDeviceInfo

This class contains information to describe a MIDI device. For now we only have information that can be retrieved easily for USB devices, but we will probably expand this in the future. This class is just an immutable object to encapsulate the MIDI device description. Use the MidiDevice class to actually communicate with devices.

Summary

Nested classes

Contains information about an input or output port.

Constants
static String

Bundle key for the device's corresponding Bluetooth device.

static String

Bundle key for the device's manufacturer name property.

static String

Bundle key for the device's user visible name property.

static String

Bundle key for the device's product name property.

static String

Bundle key for the device's serial number property.

static String

Bundle key for the device's corresponding USB device.

static String

Bundle key for the device's version property.

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a default protocol with Universal MIDI Packets (UMP).

static Int

Constant representing a device with an unknown default protocol.

static Int

Constant representing Bluetooth MIDI devices for getType

static Int

Constant representing USB MIDI devices for getType

static Int

Constant representing virtual (software based) MIDI devices for getType

Inherited constants
Public methods
Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

Int

Returns the default protocol.

Int

Returns the ID of the device.

Int

Returns the device's number of input ports.

Int

Returns the device's number of output ports.

Array<MidiDeviceInfo.PortInfo!>!

Returns information about the device's ports.

Bundle!

Returns the android.os.Bundle containing the device's properties.

Int

Returns the type of the device.

Int

Returns a hash code value for the object.

Boolean

Returns true if the device is private.

String

Returns a string representation of the object.

Unit
writeToParcel(parcel: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<MidiDeviceInfo!>

Constants

PROPERTY_BLUETOOTH_DEVICE

Added in API level 23
static val PROPERTY_BLUETOOTH_DEVICE: String

Bundle key for the device's corresponding Bluetooth device. The value for this property is of type android.bluetooth.BluetoothDevice. Only set for Bluetooth MIDI devices. Used with the android.os.Bundle returned by getProperties

Value: "bluetooth_device"

PROPERTY_MANUFACTURER

Added in API level 23
static val PROPERTY_MANUFACTURER: String

Bundle key for the device's manufacturer name property. The value for this property is of type java.lang.String. Used with the android.os.Bundle returned by getProperties. Matches the USB device manufacturer name string for USB MIDI devices.

Value: "manufacturer"

PROPERTY_NAME

Added in API level 23
static val PROPERTY_NAME: String

Bundle key for the device's user visible name property. The value for this property is of type java.lang.String. Used with the android.os.Bundle returned by getProperties. For USB devices, this is a concatenation of the manufacturer and product names.

Value: "name"

PROPERTY_PRODUCT

Added in API level 23
static val PROPERTY_PRODUCT: String

Bundle key for the device's product name property. The value for this property is of type java.lang.String. Used with the android.os.Bundle returned by getProperties Matches the USB device product name string for USB MIDI devices.

Value: "product"

PROPERTY_SERIAL_NUMBER

Added in API level 23
static val PROPERTY_SERIAL_NUMBER: String

Bundle key for the device's serial number property. The value for this property is of type java.lang.String. Used with the android.os.Bundle returned by getProperties Matches the USB device serial number for USB MIDI devices.

Value: "serial_number"

PROPERTY_USB_DEVICE

Added in API level 23
static val PROPERTY_USB_DEVICE: String

Bundle key for the device's corresponding USB device. The value for this property is of type android.hardware.usb.UsbDevice. Only set for USB MIDI devices. Used with the android.os.Bundle returned by getProperties

Value: "usb_device"

PROPERTY_VERSION

Added in API level 23
static val PROPERTY_VERSION: String

Bundle key for the device's version property. The value for this property is of type java.lang.String. Used with the android.os.Bundle returned by getProperties Matches the USB device version number for USB MIDI devices.

Value: "version"

PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS

Added in API level 33
static val PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use MIDI 1.0 through UMP with packet sizes up to 128 bits. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 3

PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS

Added in API level 33
static val PROTOCOL_UMP_MIDI_1_0_UP_TO_128_BITS_AND_JRTS: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use MIDI 1.0 through UMP with packet sizes up to 128 bits and jitter reduction timestamps. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 4

PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS

Added in API level 33
static val PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use MIDI 1.0 through UMP with packet sizes up to 64 bits. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 1

PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS

Added in API level 33
static val PROTOCOL_UMP_MIDI_1_0_UP_TO_64_BITS_AND_JRTS: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use MIDI 1.0 through UMP with packet sizes up to 64 bits and jitter reduction timestamps. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 2

PROTOCOL_UMP_MIDI_2_0

Added in API level 33
static val PROTOCOL_UMP_MIDI_2_0: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use MIDI 2.0 through UMP. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 17

PROTOCOL_UMP_MIDI_2_0_AND_JRTS

Added in API level 33
static val PROTOCOL_UMP_MIDI_2_0_AND_JRTS: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use MIDI 2.0 through UMP and jitter reduction timestamps. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 18

PROTOCOL_UMP_USE_MIDI_CI

Added in API level 33
static val PROTOCOL_UMP_USE_MIDI_CI: Int

Constant representing a default protocol with Universal MIDI Packets (UMP). UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. All UMP data should be a multiple of 4 bytes. Use UMP to negotiate with the device with MIDI-CI. MIDI-CI is defined in "MIDI Capability Inquiry (MIDI-CI)" spec. Call MidiManager.getDevicesForTransport with parameter MidiManager.TRANSPORT_UNIVERSAL_MIDI_PACKETS to get devices with this transport.

Value: 0

PROTOCOL_UNKNOWN

Added in API level 33
static val PROTOCOL_UNKNOWN: Int

Constant representing a device with an unknown default protocol. If Universal MIDI Packets (UMP) are needed, use MIDI-CI through MIDI 1.0. UMP is defined in "Universal MIDI Packet (UMP) Format and MIDI 2.0 Protocol" spec. MIDI-CI is defined in "MIDI Capability Inquiry (MIDI-CI)" spec.

Value: -1

TYPE_BLUETOOTH

Added in API level 23
static val TYPE_BLUETOOTH: Int

Constant representing Bluetooth MIDI devices for getType

Value: 3

TYPE_USB

Added in API level 23
static val TYPE_USB: Int

Constant representing USB MIDI devices for getType

Value: 1

TYPE_VIRTUAL

Added in API level 23
static val TYPE_VIRTUAL: Int

Constant representing virtual (software based) MIDI devices for getType

Value: 2

Public methods

describeContents

Added in API level 23
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

equals

Added in API level 23
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getDefaultProtocol

Added in API level 33
fun getDefaultProtocol(): Int

Returns the default protocol. For most devices, this will be PROTOCOL_UNKNOWN. Returning PROTOCOL_UNKNOWN is not an error; the device just doesn't support Universal MIDI Packets by default.

Return
Int the device's default protocol.
Value is one of the following:

getId

Added in API level 23
fun getId(): Int

Returns the ID of the device. This ID is generated by the MIDI service and is not persistent across device unplugs.

Return
Int the device's ID

getInputPortCount

Added in API level 23
fun getInputPortCount(): Int

Returns the device's number of input ports.

Return
Int the number of input ports

getOutputPortCount

Added in API level 23
fun getOutputPortCount(): Int

Returns the device's number of output ports.

Return
Int the number of output ports

getPorts

Added in API level 23
fun getPorts(): Array<MidiDeviceInfo.PortInfo!>!

Returns information about the device's ports. The ports are in unspecified order.

Return
Array<MidiDeviceInfo.PortInfo!>! array of PortInfo

getProperties

Added in API level 23
fun getProperties(): Bundle!

Returns the android.os.Bundle containing the device's properties.

Return
Bundle! the device's properties

getType

Added in API level 23
fun getType(): Int

Returns the type of the device.

Return
Int the device's type

hashCode

Added in API level 23
fun hashCode(): Int

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Return
Int a hash code value for this object.

isPrivate

Added in API level 23
fun isPrivate(): Boolean

Returns true if the device is private. Private devices are only visible and accessible to clients with the same UID as the application that is hosting the device.

Return
Boolean true if the device is private

toString

Added in API level 23
fun toString(): String

Returns a string representation of the object.

Return
String a string representation of the object.

writeToParcel

Added in API level 23
fun writeToParcel(
    parcel: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following:

Properties

CREATOR

Added in API level 23
static val CREATOR: Parcelable.Creator<MidiDeviceInfo!>