fix the -ve reads

This commit is contained in:
Bill Currie 2003-04-15 03:21:29 +00:00
parent da44c783fb
commit 130a3f4d59
2 changed files with 3 additions and 12 deletions

View file

@ -69,7 +69,6 @@ vec3_t listener_up;
vec_t sound_nominal_clip_dist = 1000.0;
int soundtime; // sample PAIRS
int sound_delta;
#define MAX_SFX 512
sfx_t *known_sfx; // hunk allocated [MAX_SFX]
@ -529,14 +528,11 @@ SND_UpdateAmbientSounds (void)
}
}
extern double realtime;
static void
SND_GetSoundtime (void)
{
int fullsamples, samplepos;
static int buffers, oldsamplepos;
static double oldrealtime;
fullsamples = shm->samples / shm->channels;
@ -557,12 +553,7 @@ SND_GetSoundtime (void)
}
oldsamplepos = samplepos;
sound_delta = soundtime;
soundtime = buffers * fullsamples + samplepos / shm->channels;
sound_delta = soundtime - sound_delta;
sound_delta = (int)((realtime - oldrealtime) * shm->speed);
oldrealtime = realtime;
}
static void

View file

@ -205,12 +205,12 @@ SND_PaintChannels (int endtime)
if (count > 0) {
sc->paint (ch, sc, count);
if (sc->advance)
sc->advance (sc, count);
ltime += count;
}
if (sc->advance)
sc->advance (sc, count);
// if at end of loop, restart
if (ltime >= ch->end) {
if (ch->sfx->loopstart >= 0) {