patch from div0 to add -sndmono and -sndstereo options to sdl sound code
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Jan 2006 13:01:34 +0000 (13:01 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Jan 2006 13:01:34 +0000 (13:01 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5925 d7cf8633-e32d-0410-b094-e92efae38249

snd_sdl.c

index 1b9ef7d..5e4157e 100644 (file)
--- a/snd_sdl.c
+++ b/snd_sdl.c
@@ -89,8 +89,18 @@ qboolean SNDDMA_Init(void)
                return false;
        }
 
-       for (channels = 8;channels >= 2;channels -= 2)
+       for (channels = 8;channels >= 1;channels--)
        {
+               if ((channels & 1) && channels != 1)
+                       continue;
+// COMMANDLINEOPTION: SDL Sound: -sndmono sets sound output to mono
+               if ((i=COM_CheckParm("-sndmono")) != 0)
+                       if (channels != 1)
+                               continue;
+// COMMANDLINEOPTION: SDL Sound: -sndstereo sets sound output to stereo
+               if ((i=COM_CheckParm("-sndstereo")) != 0)
+                       if (channels != 2)
+                               continue;
                // Init the SDL Audio subsystem
                wantspec.callback = Buffer_Callback;
                wantspec.userdata = NULL;
@@ -128,7 +138,7 @@ qboolean SNDDMA_Init(void)
                as.size = shm->bufferlength;
                break;
        }
-       if (channels < 2)
+       if (channels < 1)
        {
                Con_Print( "Failed to open the audio device!\n" );
                Con_DPrintf(