I use a Java applet, which produces unwanted sounds to me. Mute option in the applet is missing, and it's not possible to rewrite the source code. I want to hear other(non-JVM) applications' sounds. How do I suppress this Java applet(or JVM) sound output without disabling it?
I'm using Ubuntu 9.10, jre1.6.0_18 and Mozilla FF 3.5.8.
UPDATE:
If you are in control of the deployment of the applet (I.e. the webpage hosting the applet), you could write your own Applet Launcher. The launcher functions as a wrapper that provides a custom environment to the actual applet. The launcher instantiates the real applet and passes to it customized versions of the applet environment (AppletStub, AppletContext.) The custom environment implements AudioClip as a "do nothing" interface.
To disable audio, you could override the AppletContext like this:
class CustomAppletContext implements AppletContext
{
AppletContext realContext;
// most methods delegate to the real context, either directly, or with a little modification to hide the fact that we are using this launcher
public void setStatus(String status)
{
realContext.setStatus(status);
}
// override the getAudioClip to return a dummy clip
public AudioClip getAudioClip(URl url)
{
return new DummyAudioClip();
}
}
// An AudioClip implementation that does nothing
class DummyAudioClip implements AudioClip
{
public void loop() { }
public void play() { }
public void stop() { }
}
We also override AppletStub, since this is where the Applet gets the AppletContext from
class CustomAppletStub implements AppletStub
{
AppletStub realStub;
public AppletContext getAppletContext()
{
return new CustomAppletContext(realStub.getAppletContext());
}
}
And then, your launcher:
class AppletLauncher extends Applet
{
private Applet realApplet = new NoisyApplet();
// delegate most methods to the applet, but override the stub, to inject our
// AppletContext and AudioClip implementation
public void setAppletStub(AppletStub stub)
{
realApplet.setAppletStub(new CustomAppletStub(stub));
}
}
It looks like a lot of code, but it's really just a few classes and mostly wiring just to inject a new DummyAudioClip implementation.
HTH!
probably should be in power user. You can use pulse audio to control applications sounds(assuming you haven't disabled it) it should be in sound preferences. right click on the volume applet and open preferences click on application tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With