diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index a142857f7..79045a76e 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -847,6 +847,7 @@ void S_StartSoundCard(soundcardinfo_t *sc, int entnum, int entchannel, sfx_t *sf target_chan->sfx = sfx; target_chan->pos = startpos; target_chan->end = sc->paintedtime + scache->length; + target_chan->looping = false; // if an identical sound has also been started this frame, offset the pos // a bit to keep it from just making the first one louder @@ -1046,7 +1047,8 @@ void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation) VectorCopy (origin, ss->origin); ss->master_vol = vol; ss->dist_mult = (attenuation/64) / sound_nominal_clip_dist; - ss->end = scard->paintedtime + scache->length; + ss->end = scard->paintedtime + scache->length; + ss->looping = true; SND_Spatialize (scard, ss); } diff --git a/engine/client/snd_mix.c b/engine/client/snd_mix.c index b41bd52db..aa993774b 100644 --- a/engine/client/snd_mix.c +++ b/engine/client/snd_mix.c @@ -700,6 +700,11 @@ void S_PaintChannels(soundcardinfo_t *sc, int endtime) break; } } + else if (ch->looping && scache->length) + { + ch->pos = 0; + ch->end = ltime + scache->length - ch->pos; + } else { // channel just stopped s = ch->sfx;