@Override public boolean equals(Object other) { if (other == null) return false; if (!(other instanceof MidiPortWrapper)) return false; MidiPortWrapper otherWrapper = (MidiPortWrapper) other; if (mPortIndex != otherWrapper.mPortIndex) return false; if (mType != otherWrapper.mType) return false; if (mInfo == null) return (otherWrapper.mInfo == null); return mInfo.equals(otherWrapper.mInfo); }
private int getInfoPortCount(final MidiDeviceInfo info) { int portCount = (mType == MidiDeviceInfo.PortInfo.TYPE_INPUT) ? info.getInputPortCount() : info.getOutputPortCount(); return portCount; }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + mPortIndex; hashCode = 31 * hashCode + mType; hashCode = 31 * hashCode + mInfo.hashCode(); return hashCode; }
private void updateString() { if (mInfo == null) { mString = "- - - - - -"; } else { StringBuilder sb = new StringBuilder(); String name = mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_NAME); if (name == null) { name = mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER) + ", " + mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_PRODUCT); } sb.append("#" + mInfo.getId()); sb.append(", ").append(name); PortInfo portInfo = findPortInfo(); sb.append("[" + mPortIndex + "]"); if (portInfo != null) { sb.append(", ").append(portInfo.getName()); } else { sb.append(", null"); } mString = sb.toString(); } }
public static String formatDeviceInfo(MidiDeviceInfo info) { StringBuilder sb = new StringBuilder(); if (info != null) { Bundle properties = info.getProperties(); for (String key : properties.keySet()) { Object value = properties.get(key); sb.append(key).append(" = ").append(value).append('\n'); } for (PortInfo port : info.getPorts()) { sb.append((port.getType() == PortInfo.TYPE_INPUT) ? "input" : "output"); sb.append("[").append(port.getPortNumber()).append("] = \"").append(port.getName() + "\"\n"); } } return sb.toString(); } }
/** * @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; } }
/** * @param info * @param portIndex * @return */ private PortInfo findPortInfo() { PortInfo[] ports = mInfo.getPorts(); for (PortInfo portInfo : ports) { if (portInfo.getPortNumber() == mPortIndex && portInfo.getType() == mType) { return portInfo; } } return null; }
+ ", info = " + info); int portCount = info.getInputPortCount(); for (int i = 0; i < portCount; ++i) { MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i);
private void updateString() { if (mInfo == null) { mString = "- - - - - -"; } else { StringBuilder sb = new StringBuilder(); String name = mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_NAME); if (name == null) { name = mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER) + ", " + mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_PRODUCT); } sb.append("#" + mInfo.getId()); sb.append(", ").append(name); PortInfo portInfo = findPortInfo(); sb.append("[" + mPortIndex + "]"); if (portInfo != null) { sb.append(", ").append(portInfo.getName()); } else { sb.append(", null"); } mString = sb.toString(); } }
public static String formatDeviceInfo(MidiDeviceInfo info) { StringBuilder sb = new StringBuilder(); if (info != null) { Bundle properties = info.getProperties(); for (String key : properties.keySet()) { Object value = properties.get(key); sb.append(key).append(" = ").append(value).append('\n'); } for (PortInfo port : info.getPorts()) { sb.append((port.getType() == PortInfo.TYPE_INPUT) ? "input" : "output") .append("[") .append(port.getPortNumber()) .append("] = \"") .append(port.getName()).append("\"\n"); } } return sb.toString(); } }
/** * @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; } }
/** * @param info * @param portIndex * @return */ private PortInfo findPortInfo() { PortInfo[] ports = mInfo.getPorts(); for (PortInfo portInfo : ports) { if (portInfo.getPortNumber() == mPortIndex && portInfo.getType() == mType) { return portInfo; } } return null; }
+ ", info = " + info); int portCount = info.getInputPortCount(); for (int i = 0; i < portCount; ++i) { MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i);
private int getInfoPortCount(final MidiDeviceInfo info) { int portCount = (mType == MidiDeviceInfo.PortInfo.TYPE_INPUT) ? info.getInputPortCount() : info.getOutputPortCount(); return portCount; }
private void updateString() { if (mInfo == null) { mString = "- - - - - -"; } else { StringBuilder sb = new StringBuilder(); String name = mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_NAME); if (name == null) { name = mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_MANUFACTURER) + ", " + mInfo.getProperties() .getString(MidiDeviceInfo.PROPERTY_PRODUCT); } sb.append("#" + mInfo.getId()); sb.append(", ").append(name); PortInfo portInfo = findPortInfo(); sb.append("[" + mPortIndex + "]"); if (portInfo != null) { sb.append(", ").append(portInfo.getName()); } else { sb.append(", null"); } mString = sb.toString(); } }
/** * @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; } }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + mPortIndex; hashCode = 31 * hashCode + mType; hashCode = 31 * hashCode + mInfo.hashCode(); return hashCode; }
@Override public boolean equals(Object other) { if (other == null) return false; if (!(other instanceof MidiPortWrapper)) return false; MidiPortWrapper otherWrapper = (MidiPortWrapper) other; if (mPortIndex != otherWrapper.mPortIndex) return false; if (mType != otherWrapper.mType) return false; if (mInfo == null) return (otherWrapper.mInfo == null); return mInfo.equals(otherWrapper.mInfo); }
/** * @param info * @param portIndex * @return */ private PortInfo findPortInfo() { PortInfo[] ports = mInfo.getPorts(); for (PortInfo portInfo : ports) { if (portInfo.getPortNumber() == mPortIndex && portInfo.getType() == mType) { return portInfo; } } return null; }
+ ", info = " + info); int portCount = info.getInputPortCount(); for (int i = 0; i < portCount; ++i) { MidiPortWrapper wrapper = new MidiPortWrapper(info, mType, i);