summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2006-03-23 17:43:15 +0000
committerSimon Howard2006-03-23 17:43:15 +0000
commitd54a1ab430987fb6bda3c05ee2db2e9d012a6341 (patch)
tree46279b4dc9969641e9e99dc0dcddf58e642cc0c7 /src
parente920b33fe51d5f129935ae7d8bfc85bf37263e3d (diff)
downloadchocolate-doom-d54a1ab430987fb6bda3c05ee2db2e9d012a6341.tar.gz
chocolate-doom-d54a1ab430987fb6bda3c05ee2db2e9d012a6341.tar.bz2
chocolate-doom-d54a1ab430987fb6bda3c05ee2db2e9d012a6341.zip
Separate variables for config file volume levels and sound API internal
volume levels (this is how the Vanilla code behaves). Fixes sound behavior on level 8! Subversion-branch: /trunk/chocolate-doom Subversion-revision: 429
Diffstat (limited to 'src')
-rw-r--r--src/d_main.c6
-rw-r--r--src/doomstat.h7
-rw-r--r--src/i_sound.c20
-rw-r--r--src/m_menu.c28
-rw-r--r--src/m_misc.c8
-rw-r--r--src/s_sound.c14
6 files changed, 39 insertions, 44 deletions
diff --git a/src/d_main.c b/src/d_main.c
index 548dafa5..c0f50a3d 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 419 2006-03-15 18:52:31Z fraggle $
+// $Id: d_main.c 429 2006-03-23 17:43:15Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -184,7 +184,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_main.c 419 2006-03-15 18:52:31Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 429 2006-03-23 17:43:15Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -1649,7 +1649,7 @@ void D_DoomMain (void)
PrintGameVersion();
printf (DEH_String("S_Init: Setting up sound.\n"));
- S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ );
+ S_Init (sfxVolume * 8, musicVolume * 8);
printf (DEH_String("HU_Init: Setting up heads up display.\n"));
HU_Init ();
diff --git a/src/doomstat.h b/src/doomstat.h
index b9ea204c..fe850b19 100644
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: doomstat.h 388 2006-02-24 19:14:22Z fraggle $
+// $Id: doomstat.h 429 2006-03-23 17:43:15Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -105,13 +105,12 @@ extern boolean deathmatch;
// but are not (yet) supported with Linux
// (e.g. no sound volume adjustment with menu.
-// These are not used, but should be (menu).
// From m_menu.c:
// Sound FX volume has default, 0 - 15
// Music volume has default, 0 - 15
// These are multiplied by 8.
-extern int snd_SfxVolume; // maximum volume for sound
-extern int snd_MusicVolume; // maximum volume for music
+extern int sfxVolume;
+extern int musicVolume;
// Current music/sfx card - index useless
// w/o a reference LUT in a sound module.
diff --git a/src/i_sound.c b/src/i_sound.c
index 17f5e7d0..b0dfca71 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_sound.c 426 2006-03-18 23:24:04Z fraggle $
+// $Id: i_sound.c 429 2006-03-23 17:43:15Z 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 426 2006-03-18 23:24:04Z fraggle $";
+rcsid[] = "$Id: i_sound.c 429 2006-03-23 17:43:15Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -348,12 +348,7 @@ void I_SetChannels()
void I_SetSfxVolume(int volume)
{
- // Identical to DOS.
- // Basically, this should propagate
- // the menu/config file setting
- // to the state variable used in
- // the mixing.
- snd_SfxVolume = volume;
+ // Unused
}
@@ -501,8 +496,8 @@ I_UpdateSoundParams
if (!sound_initialised)
return;
- left = ((254 - sep) * vol) / 15;
- right = ((sep) * vol) / 15;
+ left = ((254 - sep) * vol) / 127;
+ right = ((sep) * vol) / 127;
Mix_SetPanning(handle, left, right);
}
@@ -586,6 +581,7 @@ void I_ShutdownMusic(void)
}
static boolean musicpaused = false;
+static int currentMusicVolume;
//
// SDL_mixer's native MIDI music playing does not pause properly.
@@ -599,7 +595,7 @@ static void UpdateMusicVolume(void)
if (musicpaused)
vol = 0;
else
- vol = (snd_MusicVolume * MIX_MAX_VOLUME) / 15;
+ vol = (currentMusicVolume * MIX_MAX_VOLUME) / 127;
Mix_VolumeMusic(vol);
}
@@ -608,7 +604,7 @@ static void UpdateMusicVolume(void)
void I_SetMusicVolume(int volume)
{
// Internal state variable.
- snd_MusicVolume = volume;
+ currentMusicVolume = volume;
UpdateMusicVolume();
}
diff --git a/src/m_menu.c b/src/m_menu.c
index f4513796..09d7e7f6 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_menu.c 328 2006-01-22 23:48:00Z fraggle $
+// $Id: m_menu.c 429 2006-03-23 17:43:15Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -78,7 +78,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_menu.c 328 2006-01-22 23:48:00Z fraggle $";
+rcsid[] = "$Id: m_menu.c 429 2006-03-23 17:43:15Z fraggle $";
#include <stdlib.h>
#include <ctype.h>
@@ -878,10 +878,10 @@ void M_DrawSound(void)
V_DrawPatchDirect (60,38,0,W_CacheLumpName(DEH_String("M_SVOL"),PU_CACHE));
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),
- 16,snd_SfxVolume);
+ 16,sfxVolume);
M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1),
- 16,snd_MusicVolume);
+ 16,musicVolume);
}
void M_Sound(int choice)
@@ -894,16 +894,16 @@ void M_SfxVol(int choice)
switch(choice)
{
case 0:
- if (snd_SfxVolume)
- snd_SfxVolume--;
+ if (sfxVolume)
+ sfxVolume--;
break;
case 1:
- if (snd_SfxVolume < 15)
- snd_SfxVolume++;
+ if (sfxVolume < 15)
+ sfxVolume++;
break;
}
- S_SetSfxVolume(snd_SfxVolume /* *8 */);
+ S_SetSfxVolume(sfxVolume * 8);
}
void M_MusicVol(int choice)
@@ -911,16 +911,16 @@ void M_MusicVol(int choice)
switch(choice)
{
case 0:
- if (snd_MusicVolume)
- snd_MusicVolume--;
+ if (musicVolume)
+ musicVolume--;
break;
case 1:
- if (snd_MusicVolume < 15)
- snd_MusicVolume++;
+ if (musicVolume < 15)
+ musicVolume++;
break;
}
- S_SetMusicVolume(snd_MusicVolume /* *8 */);
+ S_SetMusicVolume(musicVolume * 8);
}
diff --git a/src/m_misc.c b/src/m_misc.c
index 7345f819..f36c04f5 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_misc.c 367 2006-02-15 12:57:58Z fraggle $
+// $Id: m_misc.c 429 2006-03-23 17:43:15Z 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 367 2006-02-15 12:57:58Z fraggle $";
+rcsid[] = "$Id: m_misc.c 429 2006-03-23 17:43:15Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -333,8 +333,8 @@ typedef struct
static default_t doom_defaults_list[] =
{
{"mouse_sensitivity", &mouseSensitivity},
- {"sfx_volume",&snd_SfxVolume},
- {"music_volume",&snd_MusicVolume},
+ {"sfx_volume",&sfxVolume},
+ {"music_volume",&musicVolume},
{"show_messages",&showMessages},
{"key_right",&key_right, DEFAULT_KEY},
diff --git a/src/s_sound.c b/src/s_sound.c
index eba7c84e..d8547dc3 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: s_sound.c 318 2006-01-22 21:20:20Z fraggle $
+// $Id: s_sound.c 429 2006-03-23 17:43:15Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -67,7 +67,7 @@
static const char
-rcsid[] = "$Id: s_sound.c 318 2006-01-22 21:20:20Z fraggle $";
+rcsid[] = "$Id: s_sound.c 429 2006-03-23 17:43:15Z fraggle $";
@@ -153,14 +153,15 @@ typedef struct
// the set of channels available
static channel_t* channels;
-// These are not used, but should be (menu).
// Maximum volume of a sound effect.
// Internal default is max out of 0-15.
-int snd_SfxVolume = 8;
+int sfxVolume = 8;
-// Maximum volume of music. Useless so far.
-int snd_MusicVolume = 8;
+// Maximum volume of music.
+int musicVolume = 8;
+// Internal volume level, ranging from 0-127
+static int snd_SfxVolume;
// whether songs are mus_paused
@@ -654,7 +655,6 @@ void S_SetMusicVolume(int volume)
I_SetMusicVolume(127);
I_SetMusicVolume(volume);
- snd_MusicVolume = volume;
}