mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-19 02:22:01 +00:00
Don't lower the volume of 8-bit sounds
(because some game sounds are 16-bit)
This commit is contained in:
parent
35f0014502
commit
125689a499
1 changed files with 22 additions and 1 deletions
|
@ -21,7 +21,14 @@ void *Snd_Resample(int inrate, int inwidth, int innumsamples, int channels, cons
|
|||
int i;
|
||||
for (i=0; i<innumsamples; i++)
|
||||
{
|
||||
in16bit[i] = (((unsigned char *)indata)[i] - 128) << 6; // FIXME: should be << 8, but causes clipping
|
||||
unsigned char sample = ((unsigned char *)indata)[i];
|
||||
|
||||
if (sample == 255)
|
||||
{
|
||||
//Con_Printf("8-bit clipping\n");
|
||||
}
|
||||
|
||||
in16bit[i] = (((short)sample) - 128) << 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -85,6 +92,20 @@ void *Snd_Resample(int inrate, int inwidth, int innumsamples, int channels, cons
|
|||
//speex_resampler_destroy(resampler);
|
||||
}
|
||||
|
||||
// Check for clipping.
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<*outnumsamples; i++)
|
||||
{
|
||||
short sample = outdata[i];
|
||||
|
||||
if (sample == 32767)
|
||||
{
|
||||
//Con_Printf("16-bit clipping\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in16bit != indata)
|
||||
{
|
||||
free(in16bit);
|
||||
|
|
Loading…
Reference in a new issue