get sound (generally) working again

This commit is contained in:
Bill Currie 2003-04-17 02:40:17 +00:00
parent d566790c0b
commit 87025a4598
2 changed files with 7 additions and 9 deletions

View file

@ -153,11 +153,9 @@ SND_StreamAdvance (sfxbuffer_t *buffer, unsigned int count)
stepscale = (float) info->rate / shm->speed; // usually 0.5, 1, or 2 stepscale = (float) info->rate / shm->speed; // usually 0.5, 1, or 2
// find out how many samples the buffer currently holds // find out how many samples the buffer currently holds
if (buffer->head < buffer->tail) { samples = buffer->head - buffer->tail;
samples = buffer->length + buffer->head - buffer->tail; if (buffer->head < buffer->tail)
} else { samples += buffer->length;
samples = buffer->head - buffer->tail;
}
// find out where head points to in the stream // find out where head points to in the stream
headpos = buffer->pos + samples; headpos = buffer->pos + samples;
@ -202,7 +200,7 @@ SND_StreamAdvance (sfxbuffer_t *buffer, unsigned int count)
// find out how many samples can be read into the buffer // find out how many samples can be read into the buffer
samples = buffer->tail - buffer->head - 1; samples = buffer->tail - buffer->head - 1;
if (samples < 0) if (buffer->tail <= buffer->head)
samples += buffer->length; samples += buffer->length;
if (headpos + samples > sfx->length) { if (headpos + samples > sfx->length) {

View file

@ -168,8 +168,8 @@ SND_TransferPaintBuffer (int endtime)
void void
SND_PaintChannels (unsigned int endtime) SND_PaintChannels (unsigned int endtime)
{ {
unsigned int end, ltime, count; unsigned int end, ltime;
int i; int i, count;
channel_t *ch; channel_t *ch;
sfxbuffer_t *sc; sfxbuffer_t *sc;
@ -214,7 +214,7 @@ SND_PaintChannels (unsigned int endtime)
// if at end of loop, restart // if at end of loop, restart
if (ltime >= ch->end) { if (ltime >= ch->end) {
if (ch->sfx->loopstart >= 0) { if (ch->sfx->loopstart != (unsigned int) -1) {
ch->pos = ch->sfx->loopstart; ch->pos = ch->sfx->loopstart;
ch->end = ltime + ch->sfx->length - ch->pos; ch->end = ltime + ch->sfx->length - ch->pos;
} else { // channel just stopped } else { // channel just stopped