Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6271108
Votes 10
Synopsis Java doesn't use kernel sound api
Category java:classes_sound
Reported Against
Release Fixed 7(b20)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 16-MAY-2005
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 ----------
  xxxxx@xxxxx   2005-05-16 20:54:53 GMT
Work Around
N/A
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.
Posted Date : 2006-10-06 13:13:04.0
Comments
  
  Include a link with my name & email   

Submitted On 15-MAY-2006
Is there no progress on this? Seems like an easy fix to me.


Submitted On 18-NOV-2007
Where is this bug fixed ? It is definitely still present in 1.6.0_03. It means that for most practical purposes Java sound is completely unusable on Linux machines which sound cards which do not support hardware mixing.


Submitted On 08-APR-2008
john.p
Still present in 1.6.0_05 :( 


Submitted On 09-APR-2008
This issue is extremely aggravating for us on our kiosks.  We don't care if our Java app. claims exclusive use of the sound card, but we DO care about audio mixing and have run into many audio devices which don't have driver mixing support in ALSA.  Our solution thus far has been to use the Java Sound Audio Engine (HeadspaceMixer class) in order to get mixing.  The side effect is that the latency between our code telling the Java Sound Audio Engine to play a sound and the sound actually coming out of the speakers is noticeably large.  Please, for God's sake, fix this issue.


Submitted On 07-MAY-2008
This fix should be backported to the 1.6.0 releases. It's a rather crippling bug with Java audio on Linux.



PLEASE NOTE: JDK6 is formerly known as Project Mustang