foxygit / doom Log in
commit d74844c6c12f8dacfd13cfd2934bdae0fb28601b
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Fri Sep 15 23:47:12 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Fri Sep 15 23:47:12 2006 +0000

    Interpret the snd_sfxdevice and snd_musicdevice values in the configuration
    file and act the same as Vanilla Doom.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 606
---
 src/i_sound.c | 40 +++++++++++++++++++++++++++++++++-------
 src/m_misc.c  |  8 ++++----
 2 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/src/i_sound.c b/src/i_sound.c
index eb600cd6..2bbf9bba 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: i_sound.c 603 2006-09-09 21:44:51Z fraggle $
+// $Id: i_sound.c 606 2006-09-15 23:47:12Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -128,7 +128,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: i_sound.c 603 2006-09-09 21:44:51Z fraggle $";
+rcsid[] = "$Id: i_sound.c 606 2006-09-15 23:47:12Z fraggle $";

 #include <stdio.h>
 #include <stdlib.h>
@@ -157,6 +157,26 @@ rcsid[] = "$Id: i_sound.c 603 2006-09-09 21:44:51Z fraggle $";

 #define MAXMIDLENGTH        (96 * 1024)

+enum
+{
+    SNDDEVICE_NONE = 0,
+    SNDDEVICE_PCSPEAKER = 1,
+    SNDDEVICE_ADLIB = 2,
+    SNDDEVICE_SB = 3,
+    SNDDEVICE_PAS = 4,
+    SNDDEVICE_GUS = 5,
+    SNDDEVICE_WAVEBLASTER = 6,
+    SNDDEVICE_SOUNDCANVAS = 7,
+    SNDDEVICE_GENMIDI = 8,
+    SNDDEVICE_AWE32 = 9,
+};
+
+extern int snd_sfxdevice;
+extern int snd_musicdevice;
+
+static boolean nosfxparm;
+static boolean nomusicparm;
+
 static boolean sound_initialised = false;
 static boolean music_initialised = false;

@@ -535,12 +555,18 @@ I_InitSound()
     {
         channels_playing[i] = sfx_None;
     }
-
+
+    nomusicparm = M_CheckParm("-nomusic") > 0
+               || M_CheckParm("-nosound") > 0
+               || snd_musicdevice < SNDDEVICE_ADLIB;
+    nosfxparm = M_CheckParm("-nosfx") > 0
+             || M_CheckParm("-nosound") > 0
+             || snd_sfxdevice < SNDDEVICE_SB;
+
     // If music or sound is going to play, we need to at least
     // initialise SDL

-    if (M_CheckParm("-nosound")
-     || (M_CheckParm("-nosfx") && M_CheckParm("-nomusic")))
+    if (nomusicparm && nosfxparm)
         return;

     if (SDL_Init(SDL_INIT_AUDIO) < 0)
@@ -559,10 +585,10 @@ I_InitSound()

     SDL_PauseAudio(0);

-    if (M_CheckParm("-nomusic") == 0)
+    if (!nomusicparm)
         music_initialised = true;

-    if (M_CheckParm("-nosfx") == 0)
+    if (!nosfxparm)
         sound_initialised = true;
 }

diff --git a/src/m_misc.c b/src/m_misc.c
index 95cc0595..1c6a8c8f 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: m_misc.c 591 2006-08-31 22:11:08Z fraggle $
+// $Id: m_misc.c 606 2006-09-15 23:47:12Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -106,7 +106,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: m_misc.c 591 2006-08-31 22:11:08Z fraggle $";
+rcsid[] = "$Id: m_misc.c 606 2006-09-15 23:47:12Z fraggle $";

 #include <stdio.h>
 #include <stdlib.h>
@@ -297,8 +297,8 @@ extern int      vanilla_demo_limit;
 // so that the config file can be shared between chocolate
 // doom and doom.exe

-static int snd_musicdevice = 0;
-static int snd_sfxdevice = 0;
+int snd_musicdevice = 0;
+int snd_sfxdevice = 0;
 static int snd_sbport = 0;
 static int snd_sbirq = 0;
 static int snd_sbdma = 0;