JDK-6271108 : Java doesn't use kernel sound api
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 5.0,6u27e
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,linux_ubuntu
  • CPU: x86,arm
  • Submitted: 2005-05-16
  • Updated: 2012-10-01
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b20Fixed
Description
FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_02-b09, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux localhost.localdomain 2.6.11-1.14_FC3smp #1 SMP Thu Apr 7 19:36:23 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux

EXTRA RELEVANT SYSTEM CONFIGURATION :
Using alsa on a soundcard with only one device to output.

A DESCRIPTION OF THE PROBLEM :
Java on linux uses "hw" or "plughw" device, which are hardcoded on source code.
And java VM won't free this device until it is destroyed.

Linux used to have no software mixing except sound servers, but now it has a kernel sound mixing (called dmix).
You can drain more than one sound into one device UNLESS a process mistakenly grasps "hw" device.
(Such processes are thought to be very rude and ancient now.)

You should use "default" device instead of "(plug)hw" device.
This device is alias of "plughw" device by default, but users can change it to "dmix" device for software mixing.
Or you should allow users to choose which device to use.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start up java and play a sound in application (or applet).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both sound from java and that from another process came out of speakers.
ACTUAL -
Only sound from java cames out of speakers.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.applet.*

public class TestApplet {

    public void init() {
        AudioClip clip = newAudioClip(TestApplet.class.getResource("test.wave"));
    }

}
---------- END SOURCE ----------
###@###.### 2005-05-16 20:54:53 GMT

Comments
EVALUATION "default" device will be added for sampled and midi devices (in and out), like Windows DirectSound does (it just a link to a device and the same device appears in the device list one more time as "real device" (this two devices will have different names)). if default device is dmix or another virtual device, there will be no duplicates in the list.
06-10-2006