Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2898/src

Modified Files:
        sound.c 
Log Message:
Remove sound_init if open audio device fails, and break out of sound 
initiliazation,
as some SDL function like Mix_Volume and Mix_PlayMusic will cause a client
crash if no audio device.  Oddly, other SDL functions like Mix_PlayChannel 
seemed
to just spit an error message but not cause a crash.

Index: sound.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/sound.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- sound.c     21 Feb 2007 17:27:01 -0000      1.25
+++ sound.c     22 Feb 2007 05:18:18 -0000      1.26
@@ -214,8 +214,12 @@
            atexit(SDL_Quit);
 
            /* Open the audio device at 22050 Hz 8 bit Microsoft PCM with 
stereo */
-           if (Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 1024) < 0) 
+           if (Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 1024) < 0)
+           {
                LineToConsole("Mix_OpenAudio: %s\n", Mix_GetError());
+               sound_init = 0;
+               return;
+           }
 
             /* Set sound and music volume to half (128 is MAXVOLUME) */
             Mix_Volume(-1, 64);


_______________________________________________
netrek-cvs mailing list
[email protected]
http://mailman.us.netrek.org/mailman/listinfo/netrek-cvs

Reply via email to