Closed ak-988 closed 1 month ago
Looks like we need to extend FadeInMono8()
to FadeInAndOutMono8()
here:
Looks like we need to extend FadeInMono8()
to FadeInAndOutMono8()
here:
Even I can hear this and this patch fixes it for me:
--- a/src/i_oalsound.c
+++ b/src/i_oalsound.c
@@ -610,12 +610,12 @@ static boolean IsPaddedSound(const byte *data, int size)
return true;
}
-static void FadeInMono8(byte *data, ALsizei size, ALsizei freq)
+static void FadeInOutMono8(byte *data, ALsizei size, ALsizei freq)
{
const int fadelen = freq * FADETIME / 1000000;
int i;
- if (data[0] == 128 || size < fadelen)
+ if ((data[0] == 128 && data[size - 1] == 128) || size < fadelen)
{
return;
}
@@ -623,6 +623,7 @@ static void FadeInMono8(byte *data, ALsizei size, ALsizei freq)
for (i = 0; i < fadelen; i++)
{
data[i] = (data[i] - 128) * i / fadelen + 128;
+ data[size - 1 - i] = (data[size - 1 - i] - 128) * i / fadelen + 128;
}
}
@@ -687,7 +688,7 @@ boolean I_OAL_CacheSound(sfxinfo_t *sfx)
// Fade in sounds that start at a non-zero amplitude to prevent
// clicking.
- FadeInMono8(sampledata, size, freq);
+ FadeInOutMono8(sampledata, size, freq);
}
else
{
This was my suspicion, thanks for investigating!
Most of the Chex Quest sounds have issues: chex_sfx.txt (for comparison, doom2_sfx.txt is less severe) The range is -128 to 127, so roughly half the Chex Quest sounds have the last sample at full volume. Very poor mastering.
Reported here https://www.doomworld.com/forum/post/2809339
I can reproduce this clicking and the other observations in that thread on Windows 10. DSITEMUP is a good test candidate (scrolling a submenu.) Somehow, DSDA and PrBoomX don't have this issue. GZDoom and Woof do. Woof even has it back to early releases with SDL Mixer.
Pretty sure this abrupt drop at the end of DSITEMUP is the culprit, and Woof is just playing it faithfully:
Same thing with DSBFG:
The DSITEMUP that comes with Vanilla Chex 3 doesn't have it, and doesn't pop with a current build of Woof:
https://melodic-spaceship.neocities.org/chex3v/downloads
This seems like something Woof's fading to avoid clicks could address. But, how do those other ports avoid it? I tried a quick look around and didn't find any obvious "Fix Chex sound" commits.
Edit: Just to help verify things, here's a sound replacement WAD for Chex Quest that allows it to be played in current Woof with no issues that I heard: https://www.doomworld.com/applications/core/interface/file/attachment.php?id=301455