foxygit / doom Log in
commit 17f3963bd8887d15868f583b7ba1f31b7dc097ab
Author:     Jonathan Dowland <jon+github@alcopop.org>
AuthorDate: Wed Jul 8 21:31:42 2015 +0100
Commit:     Jonathan Dowland <jon+github@alcopop.org>
CommitDate: Wed Jul 8 21:46:49 2015 +0100

    Default snd_pitchshift on for Heretic/Hexen

    Initialize snd_pitchshift to -1, to signal "not initialised".
    Each game engine sets a different default.
---
 src/doom/s_sound.c    | 6 ++++++
 src/heretic/s_sound.c | 6 ++++++
 src/hexen/s_sound.c   | 6 ++++++
 src/i_sound.c         | 3 ++-
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/doom/s_sound.c b/src/doom/s_sound.c
index 90f1a99c..a29509d9 100644
--- a/src/doom/s_sound.c
+++ b/src/doom/s_sound.c
@@ -142,6 +142,12 @@ void S_Init(int sfxVolume, int musicVolume)
         S_sfx[i].lumpnum = S_sfx[i].usefulness = -1;
     }

+    // Doom defaults to pitch-shifting off.
+    if(snd_pitchshift == -1)
+    {
+        snd_pitchshift = 0;
+    }
+
     I_AtExit(S_Shutdown, true);
 }

diff --git a/src/heretic/s_sound.c b/src/heretic/s_sound.c
index fb9e6988..850dd016 100644
--- a/src/heretic/s_sound.c
+++ b/src/heretic/s_sound.c
@@ -524,6 +524,12 @@ void S_Init(void)

     I_AtExit(S_ShutDown, true);

+    // Heretic defaults to pitch-shifting on
+    if(snd_pitchshift == -1)
+    {
+        snd_pitchshift = 1;
+    }
+
     I_PrecacheSounds(S_sfx, NUMSFX);
 }

diff --git a/src/hexen/s_sound.c b/src/hexen/s_sound.c
index eb3e0465..2e1fcb67 100644
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -800,6 +800,12 @@ void S_Init(void)

     I_AtExit(S_ShutDown, true);

+    // Hexen defaults to pitch-shifting on
+    if(snd_pitchshift == -1)
+    {
+        snd_pitchshift = 1;
+    }
+
     I_PrecacheSounds(S_sfx, NUMSFX);

     // Attempt to setup CD music
diff --git a/src/i_sound.c b/src/i_sound.c
index e7757d7a..759bd6b6 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -49,8 +49,9 @@ int snd_maxslicetime_ms = 28;
 char *snd_musiccmd = "";

 // Whether to vary the pitch of sound effects
+// Each game will set the default differently

-int snd_pitchshift = 0;
+int snd_pitchshift = -1;

 // Low-level sound and music modules we are using