Chapter 23.   Readers Comments

 

No AudioDevice Specified

Ashley Hales (2nd June 2007) wrote:

When I run Shooter3D, I get:

> java Shooter3D
java.lang.UnsupportedOperationException: No AudioDevice specified
        at com.sun.j3d.utils.universe.Viewer.createAudioDevice(Viewer.java:978)
        at chapter23.WrapShooter3D.(WrapShooter3D.java:53)
        at chapter23.Shooter3D.(Shooter3D.java:29)
        at chapter23.Shooter3D.main(Shooter3D.java:42)
Java 3D: audio is disabled
PointSound created from sounds/Explo1.wav
Loading 6 GIFS called images/explo
PointSound created from sounds/laser2.wav

The program executes, but with no audio. The line of code referred to is:

AudioDevice audioDev = su.getViewer().createAudioDevice();
What's the problem?

 

My response (2nd June):

3D sound has been disabled since Java 3D 1.3.2. due to bugs in PointSound and ConeSound. Shooter3D doesn't use the buggy features, so should work if Java 3D's default audio engine is re-enabled using the j3d.audiodevice property:

> java -Dj3d.audiodevice=com.sun.j3d.audioengines.javasound.JavaSoundMixer Shooter3D
PointSound created from sounds/Explo1.wav
Loading 6 GIFS called images/explo
PointSound created from sounds/laser2.wav

This works with Java 3D 1.4.0, but will stop working in future versions.

Currently, Java 3D Sound is being reimplemented to use JOAL, a Java wrapper around OpenAL. OpenAL, the Open Audio Library, is a cross-platform API for programming 2D and 3D audio. This will get rid of the bugs, and also mean that the classes will no longer rely on the Headspace audio engine, third-party software not maintained by Sun.

David Grace has developed a JOAL-based audio engine called JoalMixer, which can be found in the org.jdesktop.j3d.audioengines.joal branch of the j3d-incubator project. It includes revised PointSound, ConeSound, and BackgroundSound classes, built with JOAL.

JoalMixer arrived too late for the Java 3D 1.5 release, and can only be utilized at the moment by recompiling the Java 3D sources. JoalMixer will be integrated into future releases of Java 3D.

An easy way to use JOAL today is to utilize my JOALSoundMan class, described in chapter 13 of Pro Java 6 3D Game Development.

More information on the problems with Java 3D sound can be found at: here, here, and here.


Navigation:


Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to my home page