/** * @return a device that matches the manufacturer and product or null */ public static MidiDeviceInfo findDevice(MidiManager midiManager, String manufacturer, String product) { for (MidiDeviceInfo info : midiManager.getDevices()) { String deviceManufacturer = info.getProperties() .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER); if ((manufacturer != null) && manufacturer.equals(deviceManufacturer)) { String deviceProduct = info.getProperties() .getString(MidiDeviceInfo.PROPERTY_PRODUCT); if ((product != null) && product.equals(deviceProduct)) { return info; } } } return null; } }
/** * @return a device that matches the manufacturer and product or null */ public static MidiDeviceInfo findDevice(MidiManager midiManager, String manufacturer, String product) { for (MidiDeviceInfo info : midiManager.getDevices()) { String deviceManufacturer = info.getProperties() .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER); if ((manufacturer != null) && manufacturer.equals(deviceManufacturer)) { String deviceProduct = info.getProperties() .getString(MidiDeviceInfo.PROPERTY_PRODUCT); if ((product != null) && product.equals(deviceProduct)) { return info; } } } return null; } }
/** * @return a device that matches the manufacturer and product or null */ public static MidiDeviceInfo findDevice(MidiManager midiManager, String manufacturer, String product) { for (MidiDeviceInfo info : midiManager.getDevices()) { String deviceManufacturer = info.getProperties() .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER); if ((manufacturer != null) && manufacturer.equals(deviceManufacturer)) { String deviceProduct = info.getProperties() .getString(MidiDeviceInfo.PROPERTY_PRODUCT); if ((product != null) && product.equals(deviceProduct)) { return info; } } } return null; } }
new Handler(Looper.getMainLooper())); MidiDeviceInfo[] infos = mMidiManager.getDevices(); for (MidiDeviceInfo info : infos) { onDeviceAdded(info);
new Handler(Looper.getMainLooper())); MidiDeviceInfo[] infos = mMidiManager.getDevices(); for (MidiDeviceInfo info : infos) { onDeviceAdded(info);
private void findMidiDevice() { MidiDeviceInfo[] infos = midiManager.getDevices(); for(MidiDeviceInfo info : infos) { String name = info.getProperties().getString(MidiDeviceInfo.PROPERTY_NAME); logger.log("Found MIDI device named " + name); if(TEENSY_MIDI_NAME.equals(name)) { logger.log("^^^ using this device ^^^"); isConnecting = true; midiManager.openDevice(info, new MidiManager.OnDeviceOpenedListener() { @Override public void onDeviceOpened(MidiDevice device) { if (device == null) { logger.log("Error, unable to open MIDI device"); } else { logger.log("Opened MIDI device successfully!"); midiDevice = device; } isConnecting = false; } }, null); break; } } }
new Handler(Looper.getMainLooper())); MidiDeviceInfo[] infos = mMidiManager.getDevices(); for (MidiDeviceInfo info : infos) { onDeviceAdded(info);