javax.sound.sampled.Port Java Examples

The following examples show how to use javax.sound.sampled.Port. 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 jdk8u_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 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 #3
Source File: JDK13Services.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #4
Source File: JDK13Services.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #5
Source File: PortMixer.java    From jdk8u60 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 #6
Source File: PortMixer.java    From openjdk-jdk8u 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 #7
Source File: JDK13Services.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #8
Source File: JDK13Services.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #9
Source File: PortMixer.java    From openjdk-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 #10
Source File: PortMixer.java    From openjdk-jdk8u-backup 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 #11
Source File: PortMixer.java    From Bytecoder with Apache License 2.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.err) Printer.err("unknown port type: "+type);
    return null;
}
 
Example #12
Source File: PortMixer.java    From openjdk-jdk9 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 #13
Source File: JDK13Services.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #14
Source File: PortMixer.java    From jdk8u-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 #15
Source File: JDK13Services.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #16
Source File: PortMixer.java    From hottub 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 #17
Source File: JDK13Services.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/** 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;
}
 
Example #18
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 #19
Source File: Main.java    From Java-Speech-Recognizer-Tutorial--Calculator with Apache License 2.0 5 votes vote down vote up
/**
 * Starting a Thread that checks if the resources needed to the
 * SpeechRecognition library are available
 */
protected void startResourcesThread() {

	// alive?
	if (resourcesThread != null && resourcesThread.isAlive())
		return;

	resourcesThread = new Thread(() -> {
		try {

			// Detect if the microphone is available
			while (true) {
				if (AudioSystem.isLineSupported(Port.Info.MICROPHONE)) {
					// logger.log(Level.INFO, "Microphone is available.\n")
				} else {
					// logger.log(Level.INFO, "Microphone is not
					// available.\n")

				}

				// Sleep some period
				Thread.sleep(350);
			}

		} catch (InterruptedException ex) {
			logger.log(Level.WARNING, null, ex);
			resourcesThread.interrupt();
		}
	});

	// Start
	resourcesThread.start();
}
 
Example #20
Source File: SpeechCalculator.java    From Java-Speech-Recognizer-Tutorial--Calculator with Apache License 2.0 5 votes vote down vote up
/**
 * Starting a Thread that checks if the resources needed to the
 * SpeechRecognition library are available
 */
public void startResourcesThread() {

	// alive?
	if (resourcesThread != null && resourcesThread.isAlive())
		return;

	resourcesThread = new Thread(() -> {
		try {

			// Detect if the microphone is available
			while (true) {
				if (AudioSystem.isLineSupported(Port.Info.MICROPHONE)) {
					// logger.log(Level.INFO, "Microphone is available.\n")
				} else {
					logger.log(Level.INFO, "Microphone is not available.\n");
				}

				// Sleep some period
				Thread.sleep(350);
			}

		} catch (InterruptedException ex) {
			logger.log(Level.WARNING, null, ex);
			resourcesThread.interrupt();
		}
	});

	// Start
	resourcesThread.start();
}
 
Example #21
Source File: PortMixer.java    From openjdk-8 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 #22
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 #23
Source File: PortMixer.java    From hottub 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 #24
Source File: PortMixer.java    From Bytecoder with Apache License 2.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(portInfos[index], this, index);
        return ports[index];
    }
    // $$fb TODO: return (Port) (ports[index].clone());
    return ports[index];
}
 
Example #25
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 #26
Source File: PortMixer.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
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 #27
Source File: PortMixer.java    From hottub 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 #28
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 #29
Source File: SpeechRecognizer.java    From Java-Speech-Recognizer-Tutorial--Calculator with Apache License 2.0 5 votes vote down vote up
/**
 * Starting a Thread that checks if the resources needed to the SpeechRecognition library are available
 */
public void startResourcesThread() {
	
	//Check lock
	if (resourcesThreadRunning)
		logger.log(Level.INFO, "Resources Thread already running...\n");
	else
		//Submit to ExecutorService
		eventsExecutorService.submit(() -> {
			try {
				
				//Lock
				resourcesThreadRunning = true;
				
				// Detect if the microphone is available
				while (true) {
					
					//Is the Microphone Available
					if (!AudioSystem.isLineSupported(Port.Info.MICROPHONE))
						logger.log(Level.INFO, "Microphone is not available.\n");
					
					// Sleep some period
					Thread.sleep(350);
				}
				
			} catch (InterruptedException ex) {
				logger.log(Level.WARNING, null, ex);
				resourcesThreadRunning = false;
			}
		});
}
 
Example #30
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);
}