List of usage examples for javax.sound.sampled Mixer isLineSupported
boolean isLineSupported(Line.Info info);
From source file:BasicPlayer.java
public List getMixers() { ArrayList mixers = new ArrayList(); Mixer.Info[] mInfos = AudioSystem.getMixerInfo(); if (mInfos != null) { for (int i = 0; i < mInfos.length; i++) { Line.Info lineInfo = new Line.Info(SourceDataLine.class); Mixer mixer = AudioSystem.getMixer(mInfos[i]); if (mixer.isLineSupported(lineInfo)) { mixers.add(mInfos[i].getName()); }/* w w w. j av a2s . c om*/ } } return mixers; }
From source file:org.eclipse.smarthome.io.javasound.internal.JavaSoundAudioSink.java
private void runVolumeCommand(Closure closure) { Mixer.Info[] infos = AudioSystem.getMixerInfo(); for (Mixer.Info info : infos) { Mixer mixer = AudioSystem.getMixer(info); if (mixer.isLineSupported(Port.Info.SPEAKER)) { Port port;// w ww.j a v a2 s. co m try { port = (Port) mixer.getLine(Port.Info.SPEAKER); port.open(); if (port.isControlSupported(FloatControl.Type.VOLUME)) { FloatControl volume = (FloatControl) port.getControl(FloatControl.Type.VOLUME); closure.execute(volume); } port.close(); } catch (LineUnavailableException e) { logger.error("Cannot access master volume control", e); } } } }
From source file:org.openhab.io.javasound.internal.JavaSoundAudioSink.java
private void runVolumeCommand(Closure closure) { Mixer.Info[] infos = AudioSystem.getMixerInfo(); for (Mixer.Info info : infos) { Mixer mixer = AudioSystem.getMixer(info); if (mixer.isLineSupported(Port.Info.SPEAKER)) { Port port;//from w w w .j ava2 s .c o m try { port = (Port) mixer.getLine(Port.Info.SPEAKER); port.open(); if (port.isControlSupported(FloatControl.Type.VOLUME)) { FloatControl volume = (FloatControl) port.getControl(FloatControl.Type.VOLUME); closure.execute(volume); } port.close(); } catch (LineUnavailableException e) { LOGGER.error("Cannot access master volume control", e); } } } }
From source file:org.openhab.io.multimedia.actions.Audio.java
private static void runVolumeCommand(Closure closure) { Mixer.Info[] infos = AudioSystem.getMixerInfo(); for (Mixer.Info info : infos) { Mixer mixer = AudioSystem.getMixer(info); if (mixer.isLineSupported(Port.Info.SPEAKER)) { Port port;/*from w w w. j a v a 2 s . com*/ try { port = (Port) mixer.getLine(Port.Info.SPEAKER); port.open(); if (port.isControlSupported(FloatControl.Type.VOLUME)) { FloatControl volume = (FloatControl) port.getControl(FloatControl.Type.VOLUME); closure.execute(volume); } port.close(); } catch (LineUnavailableException e) { logger.error("Cannot access master volume control", e); } } } }