List of usage examples for javax.sound.sampled BooleanControl setValue
public void setValue(boolean value)
From source file:Main.java
public static void main(String[] argv) throws Exception { DataLine.Info info = null;/* ww w . j a v a2s. co m*/ Clip clip = (Clip) AudioSystem.getLine(info); FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); double gain = .5D; // number between 0 and 1 (loudest) float dB = (float) (Math.log(gain) / Math.log(10.0) * 20.0); gainControl.setValue(dB); BooleanControl muteControl = (BooleanControl) clip.getControl(BooleanControl.Type.MUTE); muteControl.setValue(true); muteControl.setValue(false); }