ref: 8a3621b237bdc5c7c2b9e7ea747045aa7950ad8c
parent: 17f3963bd8887d15868f583b7ba1f31b7dc097ab
author: Jonathan Dowland <jon+github@alcopop.org>
date: Wed Jul 8 18:02:46 EDT 2015
Enable pitch-shifting in Hexen Hexen modified the sfxinfo_t structure from Doom, removing the pitch member (which was used for sfx links, which aren't used in Hexen anyway) and adding 'changePitch', a flag which indicated whether a given sound effect should be shifted, or not. Rather than add the member back, overload the 'pitch' member to mean the same thing. The table of sfxinfo_t definitions was already writing the changePitch value into the pitch member, so no further changes are needed there.
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -498,9 +498,8 @@
// vol = SoundCurve[dist];
}
-#if 0
-// TODO
- if (S_sfx[sound_id].changePitch)
+ // if the sfxinfo_t is marked as 'can be pitch shifted'
+ if (S_sfx[sound_id].pitch)
{
Channel[i].pitch = (byte) (NORM_PITCH + (M_Random() & 7) - (M_Random() & 7));
}
@@ -508,7 +507,7 @@
{
Channel[i].pitch = NORM_PITCH;
}
-#endif
+
if (S_sfx[sound_id].lumpnum == 0)
{
S_sfx[sound_id].lumpnum = I_GetSfxLumpNum(&S_sfx[sound_id]);
@@ -518,7 +517,7 @@
i,
vol,
sep,
- NORM_PITCH);
+ Channel[i].pitch);
Channel[i].sound_id = sound_id;
Channel[i].priority = priority;
Channel[i].volume = volume;
@@ -772,7 +771,7 @@
if (sep > 192)
sep = 512 - sep;
}
- I_UpdateSoundParams(i, vol, sep /*, Channel[i].pitch */);
+ I_UpdateSoundParams(i, vol, sep);
priority = S_sfx[Channel[i].sound_id].priority;
priority *= PRIORITY_MAX_ADJUST - (dist / DIST_ADJUST);
Channel[i].priority = priority;
--- a/src/i_sound.h
+++ b/src/i_sound.h
@@ -46,7 +46,7 @@
// referenced sound if a link
sfxinfo_t *link;
- // pitch if a link
+ // pitch if a link (Doom), whether to pitch-shift (Hexen)
int pitch;
// volume if a link