ref: d74844c6c12f8dacfd13cfd2934bdae0fb28601b
parent: 3de2ca16872c8436fedf6b9325f1f2c153f05609
author: Simon Howard <[email protected]>
date: Fri Sep 15 19:47:12 EDT 2006
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
--- 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 @@
#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 @@
{
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 @@
SDL_PauseAudio(0);
- if (M_CheckParm("-nomusic") == 0)
+ if (!nomusicparm)
music_initialised = true;
- if (M_CheckParm("-nosfx") == 0)
+ if (!nosfxparm)
sound_initialised = true;
}
--- 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 @@
// 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;