#249 Java 7 Sound Problem

open
nobody
None
5
2012-02-24
2012-02-24
Florian Haag
No

As described in http://sourceforge.net/tracker/?func=detail&atid=101111&aid=3490202&group_id=1111 , Stendhal sounds do/did not work for me on two computers after installing Java 7. One of the computers has Windows Vista installed, the other one has Windows 7 installed.

The only visible difference seems to be that available audio devices are enumerated in reverse order in Java 7, compared to Java 6. This is the same both for people where Java 7 didn't change anything (see aforementioned ticket) as well as those that don't have sound any more (myself, on two computers).

I've looked into the source code of the net.sf.arianne.arilib.client.sound.impl.sound.manager.SoundManagerNG class and I've figured that the SoundManagerNG.getOutputLine() method returns the first found audio device. That device is then used to initialize a SoundSystemNG in SoundManagerNG.nava:195, so I take it that device will be used throughout the rest of the game.

Problem: That device doesn't happen to be a suitable output device on my computers. cf. the following four log excerpts from two different systems:

System 1

Java 6, sounds work:
Controlador primario de sonido - Direct Audio Device: DirectSound Playback (0)
Realtek AC97 Audio - Direct Audio Device: DirectSound Playback (0)
Java Sound Audio Engine - Software mixer and synthesizer (-1)

Java 7, sounds work:
Realtek AC97 Audio - Direct Audio Device: DirectSound Playback (0)
Controlador primario de sonido - Direct Audio Device: DirectSound Playback (0)

System 2

Java 6, sounds work:
Primärer Soundtreiber - Direct Audio Device: DirectSound Playback (0)
Lautsprecher (Conexant 20561 SmartAudio HD) - Direct Audio Device: DirectSound Playback (0)
SPDIF-Schnittstelle (Conexant 20561 SmartAudio HD) - Direct Audio Device: DirectSound Playback (0)
Java Sound Audio Engine - Software mixer and synthesizer (-1)

Java 7, sounds do not work any more:
SPDIF-Schnittstelle (Conexant 20561 SmartAudio HD) - Direct Audio Device: DirectSound Playback (0)
Lautsprecher (Conexant 20561 SmartAudio HD) - Direct Audio Device: DirectSound Playback (0)
Primärer Soundtreiber - Direct Audio Device: DirectSound Playback (0)

Hence, on system 2, the SPDIF interface happens to get selected as the output device, and that one doesn't output any sound to the speakers.

I've solved the problem for now by disabling my SPDIF interface system-wide. When I run Stendhal now, the sounds are back even with Java 7.
I'd like someone who knows how the list of available audio devices is initialized in SoundManagerNG to look into this or tell me where to find the respective information. If the original source guarantees a certain meaningful order of available devices, I can file a bug report for Java 7 as it breaks that order. If it does not guarantee a certain meaningful order, Stendhal should probably use a more meaningful way of picking the most appropriate audio output device rather than just choosing whatever happens to be enumerated first.

Discussion

  • Stendhal does a down scoring for the built in Java software mixer because it has a very high latency (more than one second).

    But as far as I understand this case, down scoring or blacklisting would not work: Another user may have plugged his speakers into the digital output instead of the analog one.

    Perhaps we should add an entry in the setting dialog to allow users to pick a different device. So far, I don't see a way how we can detect the right device automatically.

     
  • We added an drop down list to select the audio device in the settings dialog box. Please test this.

    It is in CVS or you can download the test client at http://stendhalgame.org/wiki/Stendhal_Testing

     
  • Florian Haag
    Florian Haag
    2012-02-26

    Excellent, the setting works for me in v0.99.5, on both machines (T and Q) from the original bug report.

     


Anonymous


Cancel   Add attachments