android.media.midi.MidiDeviceInfo.PortInfo Java Examples

The following examples show how to use android.media.midi.MidiDeviceInfo.PortInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MidiPrinter.java    From media-samples with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #2
Source File: MidiPortWrapper.java    From media-samples with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #3
Source File: MidiPortWrapper.java    From media-samples with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #4
Source File: MidiPortWrapper.java    From android-MidiSynth with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #5
Source File: MidiPrinter.java    From android-MidiScope with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #6
Source File: MidiPortWrapper.java    From android-MidiScope with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #7
Source File: MidiPrinter.java    From android-midisuite with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #8
Source File: MidiPortWrapper.java    From android-midisuite with Apache License 2.0 6 votes vote down vote up
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();
    }
}
 
Example #9
Source File: MidiPortWrapper.java    From media-samples with Apache License 2.0 5 votes vote down vote up
/**
 * @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;
}
 
Example #10
Source File: MidiPortWrapper.java    From media-samples with Apache License 2.0 5 votes vote down vote up
/**
 * @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;
}
 
Example #11
Source File: MidiPortWrapper.java    From android-MidiSynth with Apache License 2.0 5 votes vote down vote up
/**
 * @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;
}
 
Example #12
Source File: MidiPortWrapper.java    From android-MidiScope with Apache License 2.0 5 votes vote down vote up
/**
 * @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;
}
 
Example #13
Source File: MidiPortWrapper.java    From android-midisuite with Apache License 2.0 5 votes vote down vote up
/**
 * @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;
}