Java Code Examples for javax.sound.sampled.Port#Info

The following examples show how to use javax.sound.sampled.Port#Info . 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: PortMixer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: PortMixer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: PortMixer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private PortMixerPort(Port.Info info,
                      PortMixer mixer,
                      int portIndex) {
    super(info, mixer, null);
    if (Printer.trace) Printer.trace("PortMixerPort CONSTRUCTOR: info: " + info);
    this.portIndex = portIndex;
}
 
Example 4
Source File: PortMixer.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public int getMaxLines(Line.Info info) {
    Line.Info fullInfo = getLineInfo(info);

    // if it's not supported at all, return 0.
    if (fullInfo == null) {
        return 0;
    }

    if (fullInfo instanceof Port.Info) {
        //return AudioSystem.NOT_SPECIFIED; // if several instances of PortMixerPort
        return 1;
    }
    return 0;
}
 
Example 5
Source File: PortMixer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Line getLine(Line.Info info) throws LineUnavailableException {
    Line.Info fullInfo = getLineInfo(info);

    if ((fullInfo != null) && (fullInfo instanceof Port.Info)) {
        for (int i = 0; i < portInfos.length; i++) {
            if (fullInfo.equals(portInfos[i])) {
                return getPort(i);
            }
        }
    }
    throw new IllegalArgumentException("Line unsupported: " + info);
}
 
Example 6
Source File: PortMixer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private PortMixerPort(Port.Info info,
                      PortMixer mixer,
                      int portIndex) {
    super(info, mixer, null);
    if (Printer.trace) Printer.trace("PortMixerPort CONSTRUCTOR: info: " + info);
    this.portIndex = portIndex;
}
 
Example 7
Source File: PortMixer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private PortMixerPort(Port.Info info,
                      PortMixer mixer,
                      int portIndex) {
    super(info, mixer, null);
    if (Printer.trace) Printer.trace("PortMixerPort CONSTRUCTOR: info: " + info);
    this.portIndex = portIndex;
}
 
Example 8
Source File: PortMixer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Line getLine(Line.Info info) throws LineUnavailableException {
    Line.Info fullInfo = getLineInfo(info);

    if ((fullInfo != null) && (fullInfo instanceof Port.Info)) {
        for (int i = 0; i < portInfos.length; i++) {
            if (fullInfo.equals(portInfos[i])) {
                return getPort(i);
            }
        }
    }
    throw new IllegalArgumentException("Line unsupported: " + info);
}
 
Example 9
Source File: PortMixer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
Port getPort(int index) {
    if (ports == null) {
        ports = new PortMixerPort[portInfos.length];
    }
    if (ports[index] == null) {
        ports[index] = new PortMixerPort((Port.Info)portInfos[index], this, index);
        return ports[index];
    }
    // $$fb TODO: return (Port) (ports[index].clone());
    return ports[index];
}
 
Example 10
Source File: PortMixer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public int getMaxLines(Line.Info info) {
    Line.Info fullInfo = getLineInfo(info);

    // if it's not supported at all, return 0.
    if (fullInfo == null) {
        return 0;
    }

    if (fullInfo instanceof Port.Info) {
        //return AudioSystem.NOT_SPECIFIED; // if several instances of PortMixerPort
        return 1;
    }
    return 0;
}
 
Example 11
Source File: PortMixer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private PortMixerPort(Port.Info info,
                      PortMixer mixer,
                      int portIndex) {
    super(info, mixer, null);
    if (Printer.trace) Printer.trace("PortMixerPort CONSTRUCTOR: info: " + info);
    this.portIndex = portIndex;
}
 
Example 12
Source File: PortMixer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private PortMixerPort(Port.Info info,
                      PortMixer mixer,
                      int portIndex) {
    super(info, mixer, null);
    if (Printer.trace) Printer.trace("PortMixerPort CONSTRUCTOR: info: " + info);
    this.portIndex = portIndex;
}
 
Example 13
Source File: PortMixer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Line getLine(Line.Info info) throws LineUnavailableException {
    Line.Info fullInfo = getLineInfo(info);

    if ((fullInfo != null) && (fullInfo instanceof Port.Info)) {
        for (int i = 0; i < portInfos.length; i++) {
            if (fullInfo.equals(portInfos[i])) {
                return getPort(i);
            }
        }
    }
    throw new IllegalArgumentException("Line unsupported: " + info);
}
 
Example 14
Source File: PortMixer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int getMaxLines(Line.Info info) {
    Line.Info fullInfo = getLineInfo(info);

    // if it's not supported at all, return 0.
    if (fullInfo == null) {
        return 0;
    }

    if (fullInfo instanceof Port.Info) {
        //return AudioSystem.NOT_SPECIFIED; // if several instances of PortMixerPort
        return 1;
    }
    return 0;
}
 
Example 15
Source File: PortMixer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public int getMaxLines(Line.Info info) {
    Line.Info fullInfo = getLineInfo(info);

    // if it's not supported at all, return 0.
    if (fullInfo == null) {
        return 0;
    }

    if (fullInfo instanceof Port.Info) {
        //return AudioSystem.NOT_SPECIFIED; // if several instances of PortMixerPort
        return 1;
    }
    return 0;
}
 
Example 16
Source File: PortMixer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
Port getPort(int index) {
    if (ports == null) {
        ports = new PortMixerPort[portInfos.length];
    }
    if (ports[index] == null) {
        ports[index] = new PortMixerPort((Port.Info)portInfos[index], this, index);
        return ports[index];
    }
    // $$fb TODO: return (Port) (ports[index].clone());
    return ports[index];
}
 
Example 17
Source File: PortMixer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
Port getPort(int index) {
    if (ports == null) {
        ports = new PortMixerPort[portInfos.length];
    }
    if (ports[index] == null) {
        ports[index] = new PortMixerPort((Port.Info)portInfos[index], this, index);
        return ports[index];
    }
    // $$fb TODO: return (Port) (ports[index].clone());
    return ports[index];
}
 
Example 18
Source File: PortMixer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public int getMaxLines(Line.Info info) {
    Line.Info fullInfo = getLineInfo(info);

    // if it's not supported at all, return 0.
    if (fullInfo == null) {
        return 0;
    }

    if (fullInfo instanceof Port.Info) {
        //return AudioSystem.NOT_SPECIFIED; // if several instances of PortMixerPort
        return 1;
    }
    return 0;
}
 
Example 19
Source File: PortMixer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public Line getLine(Line.Info info) throws LineUnavailableException {
    Line.Info fullInfo = getLineInfo(info);

    if ((fullInfo != null) && (fullInfo instanceof Port.Info)) {
        for (int i = 0; i < portInfos.length; i++) {
            if (fullInfo.equals(portInfos[i])) {
                return getPort(i);
            }
        }
    }
    throw new IllegalArgumentException("Line unsupported: " + info);
}
 
Example 20
Source File: PortMixer.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
PortMixer(PortMixerProvider.PortMixerInfo portMixerInfo) {
    // pass in Line.Info, mixer, controls
    super(portMixerInfo,              // Mixer.Info
          null,                       // Control[]
          null,                       // Line.Info[] sourceLineInfo
          null);                      // Line.Info[] targetLineInfo
    int count = 0;
    int srcLineCount = 0;
    int dstLineCount = 0;

    try {
        try {
            id = nOpen(getMixerIndex());
            if (id != 0) {
                count = nGetPortCount(id);
                if (count < 0) {
                    count = 0;
                }
            }
        } catch (Exception e) {}

        portInfos = new Port.Info[count];

        for (int i = 0; i < count; i++) {
            int type = nGetPortType(id, i);
            srcLineCount += ((type & SRC_MASK) != 0)?1:0;
            dstLineCount += ((type & DST_MASK) != 0)?1:0;
            portInfos[i] = getPortInfo(i, type);
        }
    } finally {
        if (id != 0) {
            nClose(id);
        }
        id = 0;
    }

    // fill sourceLineInfo and targetLineInfos with copies of the ones in portInfos
    sourceLineInfo = new Port.Info[srcLineCount];
    targetLineInfo = new Port.Info[dstLineCount];

    srcLineCount = 0; dstLineCount = 0;
    for (int i = 0; i < count; i++) {
        if (portInfos[i].isSource()) {
            sourceLineInfo[srcLineCount++] = portInfos[i];
        } else {
            targetLineInfo[dstLineCount++] = portInfos[i];
        }
    }
}