]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_oss.c
got rid of Cshader system as it really wasn't helping anything, now all surfaces...
[xonotic/darkplaces.git] / snd_oss.c
index 516072785145df17062012324986a8185c1f1e7f..e5fddc2fe2a8978d78dce8ddcb7828b36235d2ba 100644 (file)
--- a/snd_oss.c
+++ b/snd_oss.c
@@ -44,19 +44,12 @@ qboolean SNDDMA_Init(void)
        struct audio_buf_info info;
        int caps;
        int format16bit;
-       // LordHavoc: a quick patch to support big endian cpu, I hope
-       union
-       {
-               unsigned char c[2];
-               unsigned short s;
-       }
-       endiantest;
-       endiantest.s = 1;
-       if (endiantest.c[1])
-               format16bit = AFMT_S16_BE;
-       else
-               format16bit = AFMT_S16_LE;
 
+#if BYTE_ORDER == BIG_ENDIAN
+       format16bit = AFMT_S16_BE;
+#else
+       format16bit = AFMT_S16_LE;
+#endif
        snd_inited = 0;
 
        // open /dev/dsp, confirm capability to mmap, and get size of dma buffer
@@ -64,14 +57,14 @@ qboolean SNDDMA_Init(void)
        if (audio_fd < 0)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not open /dev/dsp\n");
+               Con_Print("Could not open /dev/dsp\n");
                return 0;
        }
 
        if (ioctl(audio_fd, SNDCTL_DSP_RESET, 0) < 0)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not reset /dev/dsp\n");
+               Con_Print("Could not reset /dev/dsp\n");
                close(audio_fd);
                return 0;
        }
@@ -79,14 +72,14 @@ qboolean SNDDMA_Init(void)
        if (ioctl(audio_fd, SNDCTL_DSP_GETCAPS, &caps)==-1)
        {
                perror("/dev/dsp");
-               Con_Printf("Sound driver too old\n");
+               Con_Print("Sound driver too old\n");
                close(audio_fd);
                return 0;
        }
 
        if (!(caps & DSP_CAP_TRIGGER) || !(caps & DSP_CAP_MMAP))
        {
-               Con_Printf("Sorry but your soundcard can't do this\n");
+               Con_Print("Sorry but your soundcard can't do this\n");
                close(audio_fd);
                return 0;
        }
@@ -94,7 +87,7 @@ qboolean SNDDMA_Init(void)
        if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
        {
                perror("GETOSPACE");
-               Con_Printf("Um, can't do GETOSPACE?\n");
+               Con_Print("Um, can't do GETOSPACE?\n");
                close(audio_fd);
                return 0;
        }
@@ -147,7 +140,7 @@ qboolean SNDDMA_Init(void)
        if (!shm->buffer || shm->buffer == (unsigned char *)-1)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not mmap /dev/dsp\n");
+               Con_Print("Could not mmap /dev/dsp\n");
                close(audio_fd);
                return 0;
        }
@@ -160,7 +153,7 @@ qboolean SNDDMA_Init(void)
        if (rc < 0)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not set /dev/dsp to stereo=%d", shm->channels);
+               Con_Printf("Could not set /dev/dsp to stereo=%d\n", shm->channels);
                close(audio_fd);
                return 0;
        }
@@ -173,7 +166,7 @@ qboolean SNDDMA_Init(void)
        if (rc < 0)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not set /dev/dsp speed to %d", shm->speed);
+               Con_Printf("Could not set /dev/dsp speed to %d\n", shm->speed);
                close(audio_fd);
                return 0;
        }
@@ -185,7 +178,7 @@ qboolean SNDDMA_Init(void)
                if (rc < 0)
                {
                        perror("/dev/dsp");
-                       Con_Printf("Could not support 16-bit data.  Try 8-bit.\n");
+                       Con_Print("Could not support 16-bit data.  Try 8-bit.\n");
                        close(audio_fd);
                        return 0;
                }
@@ -197,7 +190,7 @@ qboolean SNDDMA_Init(void)
                if (rc < 0)
                {
                        perror("/dev/dsp");
-                       Con_Printf("Could not support 8-bit data.\n");
+                       Con_Print("Could not support 8-bit data.\n");
                        close(audio_fd);
                        return 0;
                }
@@ -205,7 +198,7 @@ qboolean SNDDMA_Init(void)
        else
        {
                perror("/dev/dsp");
-               Con_Printf("%d-bit sound not supported.", shm->samplebits);
+               Con_Printf("%d-bit sound not supported.\n", shm->samplebits);
                close(audio_fd);
                return 0;
        }
@@ -216,7 +209,7 @@ qboolean SNDDMA_Init(void)
        if (rc < 0)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not toggle.\n");
+               Con_Print("Could not toggle.\n");
                close(audio_fd);
                return 0;
        }
@@ -225,7 +218,7 @@ qboolean SNDDMA_Init(void)
        if (rc < 0)
        {
                perror("/dev/dsp");
-               Con_Printf("Could not toggle.\n");
+               Con_Print("Could not toggle.\n");
                close(audio_fd);
                return 0;
        }
@@ -246,7 +239,7 @@ int SNDDMA_GetDMAPos(void)
        if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &count)==-1)
        {
                perror("/dev/dsp");
-               Con_Printf("Uh, sound dead.\n");
+               Con_Print("Uh, sound dead.\n");
                close(audio_fd);
                snd_inited = 0;
                return 0;