mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 14:20:59 +00:00
this seems to fix the sound cutouts. I /think/ this is the correct fix as cached sfxs are shared and thus nulling the buffer pointer isn't a particularly good idea for every release.
This commit is contained in:
parent
7ba41632d9
commit
2ee461fc24
3 changed files with 10 additions and 5 deletions
|
@ -686,7 +686,7 @@ SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol,
|
|||
VectorCopy (origin, ss->origin);
|
||||
ss->master_vol = vol;
|
||||
ss->dist_mult = (attenuation / 64) / sound_nominal_clip_dist;
|
||||
ss->end = snd_paintedtime + osfx->length;
|
||||
ss->end = 0;
|
||||
|
||||
s_spatialize (ss);
|
||||
ss->oldphase = ss->phase;
|
||||
|
|
|
@ -98,6 +98,8 @@ SND_CacheRetain (sfx_t *sfx)
|
|||
{
|
||||
sfxblock_t *block = (sfxblock_t *) sfx->data;
|
||||
block->buffer = Cache_TryGet (&block->cache);
|
||||
if (!block->buffer)
|
||||
Sys_Printf ("failed to cache sound!\n");
|
||||
return block->buffer;
|
||||
}
|
||||
|
||||
|
@ -105,7 +107,6 @@ void
|
|||
SND_CacheRelease (sfx_t *sfx)
|
||||
{
|
||||
sfxblock_t *block = (sfxblock_t *) sfx->data;
|
||||
block->buffer = 0;
|
||||
// due to the possibly asynchronous nature of the mixer, the cache
|
||||
// may have been flushed behind our backs
|
||||
if (block->cache.data) {
|
||||
|
@ -115,6 +116,8 @@ SND_CacheRelease (sfx_t *sfx)
|
|||
return;
|
||||
}
|
||||
Cache_Release (&block->cache);
|
||||
if (!Cache_ReadLock (&block->cache))
|
||||
block->buffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ snd_paint_channel (channel_t *ch, sfxbuffer_t *sc, int count)
|
|||
ch->pos += count;
|
||||
if ((int) ch->pos <= 0)
|
||||
return;
|
||||
offs = ch->pos;
|
||||
offs = count - ch->pos;
|
||||
count -= offs;
|
||||
ch->pos = 0;
|
||||
}
|
||||
|
@ -135,11 +135,13 @@ SND_PaintChannels (unsigned endtime)
|
|||
if (ch->pause)
|
||||
continue;
|
||||
sc = sfx->getbuffer (sfx);
|
||||
if (!sc) // something went wrong with the sfx
|
||||
if (!sc) { // something went wrong with the sfx
|
||||
printf ("XXXX sfx blew up!!!!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ch->end)
|
||||
ch->end = snd_paintedtime + sfx->length;
|
||||
ch->end = snd_paintedtime + sfx->length - ch->pos;
|
||||
|
||||
ltime = snd_paintedtime;
|
||||
|
||||
|
|
Loading…
Reference in a new issue