ref: ac31afbe7610df77b6658b84afaaef4e01c7028d
parent: 93fe1124119faafe0704ea913ab4d5977b1f24b6
author: Simon Howard <[email protected]>
date: Wed Jul 8 17:37:45 EDT 2015
Fix formatting issues introduced in last merge. Also fixes a minor bug that would cause the pitch shift configuration to be reset each time the sound configuration window was opened.
--- a/src/doom/s_sound.c
+++ b/src/doom/s_sound.c
@@ -143,7 +143,7 @@
}
// Doom defaults to pitch-shifting off.
- if(snd_pitchshift == -1)
+ if (snd_pitchshift == -1)
{
snd_pitchshift = 0;
}
--- a/src/heretic/s_sound.c
+++ b/src/heretic/s_sound.c
@@ -525,7 +525,7 @@
I_AtExit(S_ShutDown, true);
// Heretic defaults to pitch-shifting on
- if(snd_pitchshift == -1)
+ if (snd_pitchshift == -1)
{
snd_pitchshift = 1;
}
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -800,7 +800,7 @@
I_AtExit(S_ShutDown, true);
// Hexen defaults to pitch-shifting on
- if(snd_pitchshift == -1)
+ if (snd_pitchshift == -1)
{
snd_pitchshift = 1;
}
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -280,14 +280,15 @@
{
allocated_sound_t * p = allocated_sounds_head;
- while(p != NULL)
+ while (p != NULL)
{
- if(p->sfxinfo == sfxinfo && p->pitch == pitch)
+ if (p->sfxinfo == sfxinfo && p->pitch == pitch)
{
return p;
}
p = p->next;
}
+
return NULL;
}
@@ -309,7 +310,7 @@
dstlen = (int)((1 + (1 - (float)pitch / NORM_PITCH)) * srclen);
// ensure that the new buffer is an even length
- if( (dstlen % 2) == 0)
+ if ((dstlen % 2) == 0)
{
dstlen++;
}
@@ -316,7 +317,7 @@
outsnd = AllocateSound(insnd->sfxinfo, dstlen);
- if(!outsnd)
+ if (!outsnd)
{
return NULL;
}
@@ -325,7 +326,7 @@
dstbuf = (Sint16 *)outsnd->chunk.abuf;
// loop over output buffer. find corresponding input cell, copy over
- for(outp = dstbuf; outp < dstbuf + dstlen/2; ++outp)
+ for (outp = dstbuf; outp < dstbuf + dstlen/2; ++outp)
{
inp = srcbuf + (int)((float)(outp - dstbuf) / dstlen * srclen);
*outp = *inp;
@@ -353,7 +354,7 @@
// if the sound is a pitch-shift and it's not in use, immediately
// free it
- if(snd->pitch != NORM_PITCH && snd->use_count <= 0)
+ if (snd->pitch != NORM_PITCH && snd->use_count <= 0)
{
FreeAllocatedSound(snd);
}
@@ -947,22 +948,22 @@
snd = GetAllocatedSoundBySfxInfoAndPitch(sfxinfo, pitch);
- if(snd == NULL)
+ if (snd == NULL)
{
allocated_sound_t *newsnd;
// fetch the base sound effect, un-pitch-shifted
snd = GetAllocatedSoundBySfxInfoAndPitch(sfxinfo, NORM_PITCH);
- if(!snd)
+ if (snd == NULL)
{
return -1;
}
- if(snd_pitchshift)
+ if (snd_pitchshift)
{
newsnd = PitchShift(snd, pitch);
- if(newsnd)
+ if (newsnd)
{
LockAllocatedSound(newsnd);
UnlockAllocatedSound(snd);
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -294,14 +294,6 @@
num_music_modes = NUM_MUSICMODES - 1;
}
- // All versions of Heretic and Hexen did pitch-shifting.
- // Most versions of Doom did not and Strife never did.
-
- if(gamemission == heretic || gamemission == hexen)
- {
- snd_pitchshift = 1;
- }
-
// Build the window
window = TXT_NewWindow("Sound configuration");
@@ -411,6 +403,10 @@
timidity_cfg_path = M_StringDuplicate("");
gus_patch_path = M_StringDuplicate("");
+
+ // All versions of Heretic and Hexen did pitch-shifting.
+ // Most versions of Doom did not and Strife never did.
+ snd_pitchshift = gamemission == heretic || gamemission == hexen;
// Default sound volumes - different games use different values.