import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.BooleanControl;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.FloatControl;
public class Main {
public static void main(String[] argv) throws Exception {
DataLine.Info info = null;
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);
}
}
|