ref: 79ffc9dbd24613e9f200db4ed9a66f2383048097
parent: 31f27c7a41f2aa2aac87052f85882a0eafbb1425
author: Jonathan Dowland <jon+github@alcopop.org>
date: Fri Jun 26 02:39:28 EDT 2015
Define NORM_PITCH in i_sound.h The four game engines and the back-end sound driver need to agree on what NORM_PITCH is, so define it in i_sound.h, which is the one header they all have in common. Remove other definitions and use it in a few places where a bare constant was used instead.
--- a/src/doom/s_sound.c
+++ b/src/doom/s_sound.c
@@ -59,7 +59,6 @@
#define S_STEREO_SWING (96 * FRACUNIT)
-#define NORM_PITCH 128
#define NORM_PRIORITY 64
#define NORM_SEP 128
--- a/src/heretic/s_sound.c
+++ b/src/heretic/s_sound.c
@@ -270,7 +270,7 @@
// TODO: Play pitch-shifted sounds as in Vanilla Heretic
- channel[i].pitch = (byte) (127 + (M_Random() & 7) - (M_Random() & 7));
+ channel[i].pitch = (byte) (NORM_PITCH + (M_Random() & 7) - (M_Random() & 7));
channel[i].handle = I_StartSound(&S_sfx[sound_id], i, vol, sep);
channel[i].mo = origin;
channel[i].sound_id = sound_id;
@@ -328,7 +328,7 @@
}
// TODO: Pitch shifting.
- channel[i].pitch = (byte) (127 - (M_Random() & 3) + (M_Random() & 3));
+ channel[i].pitch = (byte) (NORM_PITCH - (M_Random() & 3) + (M_Random() & 3));
channel[i].handle = I_StartSound(&S_sfx[sound_id], i, volume, 128);
channel[i].mo = origin;
channel[i].sound_id = sound_id;
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -502,11 +502,11 @@
// TODO
if (S_sfx[sound_id].changePitch)
{
- Channel[i].pitch = (byte) (127 + (M_Random() & 7) - (M_Random() & 7));
+ Channel[i].pitch = (byte) (NORM_PITCH + (M_Random() & 7) - (M_Random() & 7));
}
else
{
- Channel[i].pitch = 127;
+ Channel[i].pitch = NORM_PITCH;
}
#endif
if (S_sfx[sound_id].lumpnum == 0)
--- a/src/i_sound.h
+++ b/src/i_sound.h
@@ -22,6 +22,8 @@
#include "doomtype.h"
+// so that the individual game logic and sound driver code agree
+#define NORM_PITCH 127
//
// SoundFX struct.
--- a/src/strife/s_sound.c
+++ b/src/strife/s_sound.c
@@ -60,7 +60,6 @@
#define S_STEREO_SWING (96 * FRACUNIT)
-#define NORM_PITCH 128
#define NORM_PRIORITY 64
#define NORM_SEP 128