mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 05:41:52 +00:00
OpenAL: Crush that annoying bug where volume changes creates clicks in the sound.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6236 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
bc8895c5fa
commit
7fea1f33ee
3 changed files with 9 additions and 4 deletions
|
@ -1074,7 +1074,7 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, chanupdat
|
|||
|
||||
if (schanged)
|
||||
{
|
||||
if (schanged == CUR_UPDATE && chan->pos)
|
||||
if (schanged & CUR_OFFSET && chan->pos)
|
||||
{ //complex update, but not restart. pos contains an offset, rather than an absolute time.
|
||||
palSourcei(src, AL_SAMPLE_OFFSET, (chan->pos>>PITCHSHIFT));
|
||||
}
|
||||
|
|
|
@ -2900,6 +2900,9 @@ static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_
|
|||
return;
|
||||
}
|
||||
|
||||
if (timeoffset != 0.0)
|
||||
chanupdatetype |= CUR_OFFSET;
|
||||
|
||||
if (!ratemul) //rate of 0
|
||||
ratemul = 1;
|
||||
ratemul *= snd_playbackrate.value;
|
||||
|
@ -2913,6 +2916,7 @@ static void S_UpdateSoundCard(soundcardinfo_t *sc, qboolean updateonly, channel_
|
|||
// spatialize
|
||||
if (target_chan->sfx != sfx)
|
||||
chanupdatetype |= CUR_SOUNDCHANGE;
|
||||
|
||||
memset (target_chan, 0, sizeof(*target_chan));
|
||||
if (!origin)
|
||||
{
|
||||
|
|
|
@ -346,10 +346,11 @@ extern sounddriver pAHI_InitCard;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
CUR_SPACIALISEONLY = 0, //for ticking over, respacialising, etc
|
||||
CUR_UPDATE = (1u<<1), //flags/rate/offset changed without changing the sound itself
|
||||
CUR_SPACIALISEONLY = 0, //for ticking over, respacialising, etc
|
||||
CUR_UPDATE = (1u<<1), //flags/rate changed without changing the sound itself
|
||||
CUR_SOUNDCHANGE = (1u<<2), //the audio file changed too. reset everything.
|
||||
CUR_EVERYTHING = CUR_UPDATE|CUR_SOUNDCHANGE
|
||||
CUR_OFFSET = (1u<<3),
|
||||
CUR_EVERYTHING = CUR_UPDATE|CUR_SOUNDCHANGE|CUR_OFFSET
|
||||
} chanupdatereason_t;
|
||||
|
||||
struct soundcardinfo_s { //windows has one defined AFTER directsound
|
||||
|
|
Loading…
Reference in a new issue