mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 13:50:53 +00:00
Try to fix noise with certain sounds with rate scaling active.
Fix snd_playbackrate cvar not applying to csqc's sounds. (Both issues reported by GoaLitiuM) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5609 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
0d01ec40ea
commit
79bd5bd8a9
2 changed files with 8 additions and 7 deletions
|
@ -2632,7 +2632,7 @@ channel_t *SND_PickChannel(soundcardinfo_t *sc, int entnum, int entchannel)
|
|||
if (oldest == -1)
|
||||
return NULL;
|
||||
|
||||
if (sc->channel[oldest].sfx)
|
||||
//if (sc->channel[oldest].sfx)
|
||||
sc->channel[oldest].sfx = NULL;
|
||||
|
||||
if (sc->total_chans <= oldest)
|
||||
|
@ -2891,11 +2891,12 @@ static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_
|
|||
return;
|
||||
}
|
||||
|
||||
if (!ratemul) //rate of 0
|
||||
ratemul = 1;
|
||||
ratemul *= snd_playbackrate.value;
|
||||
if (!snd_ignoregamespeed.ival)
|
||||
ratemul *= (cls.state?cl.gamespeed:1) * (cls.demoplayback?cl_demospeed.value:1);
|
||||
|
||||
if (ratemul <= 0)
|
||||
if (ratemul <= 0) //in case the user set the cvars weirdly
|
||||
ratemul = 1;
|
||||
|
||||
vol = fvol*255;
|
||||
|
|
|
@ -554,11 +554,11 @@ static void SND_PaintChannel16_O2I1 (channel_t *ch, sfxcache_t *sc, int starttim
|
|||
sfx = (signed short *)sc->data;
|
||||
for (i=0 ; i<count ; i++)
|
||||
{
|
||||
float frac = pos&((1<<PITCHSHIFT)-1);
|
||||
data = sfx[pos>>PITCHSHIFT] * (1-frac) + sfx[(pos>>PITCHSHIFT)+1] * frac;
|
||||
int frac = pos&((1<<PITCHSHIFT)-1);
|
||||
data = sfx[pos>>PITCHSHIFT] * ((1<<PITCHSHIFT)-1-frac) + sfx[(pos>>PITCHSHIFT)+1] * frac;
|
||||
pos += rate;
|
||||
paintbuffer[starttime+i].s[0] += (leftvol * data)>>8;
|
||||
paintbuffer[starttime+i].s[1] += (rightvol * data)>>8;
|
||||
paintbuffer[starttime+i].s[0] += (leftvol * data)>>(PITCHSHIFT+8);
|
||||
paintbuffer[starttime+i].s[1] += (rightvol * data)>>(PITCHSHIFT+8);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue