]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_alsa.c
don't allow runaway loops caused by Con_Print during notify/console drawing
[xonotic/darkplaces.git] / snd_alsa.c
index 4328a603d5ba71c25e8b6675c53f58523a01584e..31f5c1e4e113587e8be8493c50942727c2a90af4 100644 (file)
@@ -31,7 +31,6 @@
 #include "quakedef.h"
 #include "snd_main.h"
 
-static int                     snd_inited;
 static snd_pcm_uframes_t buffer_size;
 
 static const char  *pcmname = NULL;
@@ -84,6 +83,10 @@ qboolean SNDDMA_Init (void)
                if ((i=COM_CheckParm("-sndstereo")) != 0)
                        if (channels != 2)
                                continue;
+// COMMANDLINEOPTION: Linux ALSA Sound: -sndquad sets sound output to 4 channel surround
+               if ((i=COM_CheckParm("-sndquad")) != 0)
+                       if (channels != 4)
+                               continue;
 
 // COMMANDLINEOPTION: Linux ALSA Sound: -sndpcm <devicename> selects which pcm device to us, default is "default"
                if (channels == 8)
@@ -207,7 +210,6 @@ qboolean SNDDMA_Init (void)
                shm->samples = shm->sampleframes * shm->format.channels;
                SNDDMA_GetDMAPos ();            // sets shm->buffer
 
-               snd_inited = 1;
                return true;
        }
        return false;
@@ -219,7 +221,7 @@ int SNDDMA_GetDMAPos (void)
        snd_pcm_uframes_t offset;
        snd_pcm_uframes_t nframes = shm->sampleframes;
 
-       if (!snd_inited)
+       if (!shm)
                return 0;
 
        snd_pcm_avail_update (pcm);
@@ -233,10 +235,7 @@ int SNDDMA_GetDMAPos (void)
 
 void SNDDMA_Shutdown (void)
 {
-       if (snd_inited) {
-               snd_pcm_close (pcm);
-               snd_inited = 0;
-       }
+       snd_pcm_close (pcm);
 }
 
 /*