How to stop any sound from java application?
A:
Check out the Sound API.
To simply mute sound you can do something like this:
Port p = (Port)AudioSystem.getLine(Port.Info.SPEAKER);
p.open();
//print out volume
FloatControl vol = (FloatControl)p.getControl(FloatControl.Type.VOLUME);
System.out.println("Current Volume: " + vol.getValue());
//mute sound
BooleanControl mute = (BooleanControl)p.getControl(BooleanControl.Type.MUTE);
mute.setValue(true);
p.close();
dogbane
2010-09-23 09:00:44
I think he did mean, not just muting, but solution for pause functionality, to resume playback after. What do you think?
Eugene
2010-09-23 17:49:22