List of usage examples for javax.sound.sampled AudioSystem getMixer
public static Mixer getMixer(final Mixer.Info info)
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 ww. j a va 2s . 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); } } } }