Skip to main content

LineUnavailableExceptions when using build4

4 replies [Last post]
nikolai
Offline
Joined: 2003-06-10
Points: 0

I get many exceptions like the one below every frame after converting my app to build4, and to JavaSoundMixer from HeadSpaceMixer. It still plays the sounds I ask it to though. The exceptions come even if I play no sounds, but if nothing moves in my scene the exceptions stop coming.

Based on what the API stipulates will happen if all available Channels are in use this can not be taken as expected behavior and must be a bug?:

API states:
Prioritize Sound

Sound Priority is used to rank concurrently playing sounds in order of importance during playback. When more sounds are started than the AudioDevice can handle, the sound node with the lowest priority ranking is deactivated (but continues playing silently). If a sound is deactivated (due to a sound with a higher priority being started), it is automatically re-activated when resources become available (e.g., when a sound with a higher priority finishes playing), or when the ordering of sound nodes are changed due to a change in a sound node's priority.

Sounds with a lower priority than sound that can not be played due to lack of channels will be played. For example, assume we have eight channels available for playing sounds. After ordering four sounds, we begin playing them in order, checking if the number of channels required to play a given sound are actually available before the sound is played. Furthermore, say the first sound needs three channels to play, the second sound needs four channels, the third sound needs three channels and the fourth sound needs only one channel. The first and second sounds can be started because they require seven of the eight available channels. The third sound can not be audibly started because it requires three channels and only one is still available. Consequently, the third sound starts playing 'silently.' The fourth sound can and will be started since it only requires one channel. The third sound will be made audible when three channels become available (i.e., when the first or second sound finishes playing).

Sounds given the same priority are ordered randomly. If the application wants a specific ordering, it must assign unique priorities to each sound.

Methods to determine what audio output resources are required for playing a Sound node on a particular AudioDevice and to determine the currently available audio output resources are described in the AudioDevice class.

javax.sound.sampled.LineUnavailableException: No Free Voices
at com.sun.media.sound.MixerClip.nSetup(Native Method)
at com.sun.media.sound.MixerClip.getValidVoiceId(MixerClip.java:593)
at com.sun.media.sound.MixerClip.implOpen(MixerClip.java:571)
at com.sun.media.sound.MixerClip.open(MixerClip.java:161)
at com.sun.media.sound.MixerClip.open(MixerClip.java:249)
at com.sun.j3d.audioengines.javasound.JSClip.initDataLine(Unknown Source)
at com.sun.j3d.audioengines.javasound.JSSample.load(Unknown Source)
at com.sun.j3d.audioengines.javasound.JavaSoundMixer.prepareSound(Unknown Source)
at javax.media.j3d.SoundScheduler.attachSoundData(Unknown Source)
at javax.media.j3d.SoundScheduler.processSoundAtom(Unknown Source)
at javax.media.j3d.SoundScheduler.calcSchedulingAction(Unknown Source)
at javax.media.j3d.SoundScheduler.renderChanges(Unknown Source)
at javax.media.j3d.SoundScheduler.processMessages(Unknown Source)
at javax.media.j3d.StructureUpdateThread.doWork(Unknown Source)
at javax.media.j3d.J3dThread.run(Unknown Source)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
herkules
Offline
Joined: 2003-06-12
Points: 0

just saw that FlyingGuns suffers exactly from that error as well.

is there an issue ID?

kcr
Offline
Joined: 2004-03-17
Points: 0

> is there an issue ID?

Chien filed Issue 24 yesterday.
https://java3d.dev.java.net/issues/show_bug.cgi?id=24

Feel free to add information to this Issue for the various sound problems that you run into.

-- Kevin

jada
Offline
Joined: 2004-03-17
Points: 0

Sound is basically broken in the current j3d1.3.2 build. We are planning to rewrite it once we've a high priority deployment issue resolved.

- Chien.

nikolai
Offline
Joined: 2003-06-10
Points: 0

I found another JavaSoundMixer error:

Distance attenuation

setDistanceGain(Point2f[] attenuation)

no longer works. The sound is played with max gain all the time. No stereo either, max gain in both speakers.