java类javax.sound.sampled.Port的实例源码

PortMixer.java 文件源码 项目:OpenJSharp 阅读 23 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:OpenJSharp 阅读 20 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class<?> typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:openjdk9 阅读 19 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class<?> typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:jdk8u_jdk 阅读 20 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:jdk8u_jdk 阅读 18 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 26 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 17 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:infobip-open-jdk-8 阅读 30 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:infobip-open-jdk-8 阅读 19 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:jdk8u-dev-jdk 阅读 25 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:jdk8u-dev-jdk 阅读 19 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String name = typeClass.getName();
    String value = AccessController.doPrivileged(
            (PrivilegedAction<String>) () -> System.getProperty(name));
    if (value == null) {
        value = getProperties().getProperty(name);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:jdk7-jdk 阅读 24 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:jdk7-jdk 阅读 19 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String value;
    String propertyName = typeClass.getName();
    value = JSSecurityManager.getProperty(propertyName);
    if (value == null) {
        value = getProperties().getProperty(propertyName);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:openjdk-source-code-learn 阅读 22 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:openjdk-source-code-learn 阅读 24 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String value;
    String propertyName = typeClass.getName();
    value = JSSecurityManager.getProperty(propertyName);
    if (value == null) {
        value = getProperties().getProperty(propertyName);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortMixer.java 文件源码 项目:OLD-OpenJDK8 阅读 24 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:OLD-OpenJDK8 阅读 17 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String value;
    String propertyName = typeClass.getName();
    value = JSSecurityManager.getProperty(propertyName);
    if (value == null) {
        value = getProperties().getProperty(propertyName);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortInfoTest.java 文件源码 项目:cn1 阅读 19 收藏 0 点赞 0 评论 0
public void testPortInfo() {
    assertEquals("COMPACT_DISC source port", Port.Info.COMPACT_DISC.toString());
    assertEquals("LINE_OUT target port", Port.Info.LINE_OUT.toString());

    Class<Port> cl = Port.class;
    String name = "name";
    Port.Info pi1 = new Port.Info(cl, name, true);
    assertEquals(name, pi1.getName());
    assertTrue(pi1.isSource());

    Port.Info pi2 = new Port.Info(cl, name, true);
    assertFalse(pi1.equals(pi2));
    assertTrue(pi1.equals(pi1));        
    assertTrue(pi1.matches(pi2));
    assertTrue(pi2.matches(pi1));

    pi2 = new Port.Info(cl, "name1", false);
    assertTrue(pi1.matches(pi1));
    assertFalse(pi1.matches(pi2));
    assertFalse(pi2.matches(pi1));
}
PortMixer.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 26 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 21 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String value;
    String propertyName = typeClass.getName();
    value = JSSecurityManager.getProperty(propertyName);
    if (value == null) {
        value = getProperties().getProperty(propertyName);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
PortInfoTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public void testPortInfo() {
    assertEquals("COMPACT_DISC source port", Port.Info.COMPACT_DISC.toString());
    assertEquals("LINE_OUT target port", Port.Info.LINE_OUT.toString());

    Class cl = Port.class;
    String name = "name";
    Port.Info pi1 = new Port.Info(cl, name, true);
    assertEquals(name, pi1.getName());
    assertTrue(pi1.isSource());

    Port.Info pi2 = new Port.Info(cl, name, true);
    assertFalse(pi1.equals(pi2));
    assertTrue(pi1.equals(pi1));        
    assertTrue(pi1.matches(pi2));
    assertTrue(pi2.matches(pi1));

    pi2 = new Port.Info(cl, "name1", false);
    assertTrue(pi1.matches(pi1));
    assertFalse(pi1.matches(pi2));
    assertFalse(pi2.matches(pi1));
}
PortInfoTest.java 文件源码 项目:freeVM 阅读 20 收藏 0 点赞 0 评论 0
public void testPortInfo() {
    assertEquals("COMPACT_DISC source port", Port.Info.COMPACT_DISC.toString());
    assertEquals("LINE_OUT target port", Port.Info.LINE_OUT.toString());

    Class<Port> cl = Port.class;
    String name = "name";
    Port.Info pi1 = new Port.Info(cl, name, true);
    assertEquals(name, pi1.getName());
    assertTrue(pi1.isSource());

    Port.Info pi2 = new Port.Info(cl, name, true);
    assertFalse(pi1.equals(pi2));
    assertTrue(pi1.equals(pi1));        
    assertTrue(pi1.matches(pi2));
    assertTrue(pi2.matches(pi1));

    pi2 = new Port.Info(cl, "name1", false);
    assertTrue(pi1.matches(pi1));
    assertFalse(pi1.matches(pi2));
    assertFalse(pi2.matches(pi1));
}
PortMixer.java 文件源码 项目:openjdk-icedtea7 阅读 22 收藏 0 点赞 0 评论 0
private Port.Info getPortInfo(int portIndex, int type) {
    switch (type) {
    case SRC_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), true);
    case SRC_MICROPHONE:   return Port.Info.MICROPHONE;
    case SRC_LINE_IN:      return Port.Info.LINE_IN;
    case SRC_COMPACT_DISC: return Port.Info.COMPACT_DISC;

    case DST_UNKNOWN:      return new PortInfo(nGetPortName(getID(), portIndex), false);
    case DST_SPEAKER:      return Port.Info.SPEAKER;
    case DST_HEADPHONE:    return Port.Info.HEADPHONE;
    case DST_LINE_OUT:     return Port.Info.LINE_OUT;
    }
    // should never happen...
    if (Printer.debug) Printer.debug("unknown port type: "+type);
    return null;
}
JDK13Services.java 文件源码 项目:openjdk-icedtea7 阅读 19 收藏 0 点赞 0 评论 0
/** Obtain the value of a default provider property.
    @param typeClass The type of the default provider property. This
    should be one of Receiver.class, Transmitter.class, Sequencer.class,
    Synthesizer.class, SourceDataLine.class, TargetDataLine.class,
    Clip.class or Port.class.
    @return The complete value of the property, if available.
    If the property is not set, null is returned.
 */
private static synchronized String getDefaultProvider(Class typeClass) {
    if (!SourceDataLine.class.equals(typeClass)
            && !TargetDataLine.class.equals(typeClass)
            && !Clip.class.equals(typeClass)
            && !Port.class.equals(typeClass)
            && !Receiver.class.equals(typeClass)
            && !Transmitter.class.equals(typeClass)
            && !Synthesizer.class.equals(typeClass)
            && !Sequencer.class.equals(typeClass)) {
        return null;
    }
    String value;
    String propertyName = typeClass.getName();
    value = JSSecurityManager.getProperty(propertyName);
    if (value == null) {
        value = getProperties().getProperty(propertyName);
    }
    if ("".equals(value)) {
        value = null;
    }
    return value;
}
JavaMixer.java 文件源码 项目:spark-svn-mirror 阅读 21 收藏 0 点赞 0 评论 0
private Line.Info[] getPortInfo(Mixer mixer) {
    Line.Info[] infos;
    List<Line.Info> portInfoList = new ArrayList<Line.Info>();
    infos = mixer.getSourceLineInfo();
    for (Line.Info info : infos) {
        if (info instanceof Port.Info || info instanceof DataLine.Info) {
            portInfoList.add((Line.Info) info);
        }
    }
    infos = mixer.getTargetLineInfo();
    for (Line.Info info1 : infos) {
        if (info1 instanceof Port.Info || info1 instanceof DataLine.Info) {
            portInfoList.add((Line.Info) info1);
        }
    }
    return portInfoList.toArray(EMPTY_PORT_INFO_ARRAY);
}


问题


面经


文章

微信
公众号

扫码关注公众号