Bug#466225: glest: fails to start with no audio device

Emmet Hikory emmet.hikory at gmail.com
Mon Feb 18 10:32:10 UTC 2008


Paul Wise wrote:
> On Mon, 2008-02-18 at 01:10 +0200, Eddy Petrișor wrote:
>
> > Does installing oss-compat fixes the issue?
>
> Nope, I already had it installed. Is there anything I should do to make
> it use oss-compat?
>
> Anyway, the reason the audio device isn't available is because another
> application is using it. In this case (or when there is no audio device)
> glest should still start up since the game is still fairly playable
> without sound. A few less wolves howling and "yes sir"s isn't a big deal
> for playability of the game.

    The issue is that the OpenAL we ship raises an exception when it
cannot find the audio device (which may happen for several reasons).
This needs to be trapped by the calling code, to either retry, or
disable audio, or something.

    An example patch that I had been using for torcs for the same
issue was as follows:

+diff -urN torcs-1.3.0/src/modules/graphic/ssggraph/grsound.cpp
torcs-1.3.0.new/src/modules/graphic/ssggraph/grsound.cpp
+--- src/modules/graphic/ssggraph/grsound.cpp   2006-11-05
10:42:26.000000000 +0900
++++ src/modules/graphic/ssggraph/grsound.cpp   2007-10-08
18:15:29.000000000 +0900
+@@ -72,7 +72,14 @@
+
+       switch (sound_mode) {
+       case OPENAL_MODE:
+-              sound_interface = new OpenalSoundInterface (44100, 32);
++              try {
++                      sound_interface = new OpenalSoundInterface (44100, 32);
++              }
++              catch (const char *err) {
++                      fprintf (stderr, "Disabling Sound: OpenAL
initialisation failed: %s\n", err ? err : "");
++                      sound_mode = DISABLED;
++                      return;
++              }
+               break;
+       case PLIB_MODE:
+               sound_interface = new PlibSoundInterface(44100, 32);

    Applying something similar to the sound initialisation portion of
glest ought prevent the segfault, assuming that glest has some
mechanism to run with sound disabled.

    Separately, one can set various options in /etc/openalrc for a
general fallback mechanism to avoid raising this exception, although
the correct configuration for this file depends quite heavily on the
local sound configuration.

-- 
Emmet HIKORY


More information about the Pkg-games-devel mailing list