mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
get sound (generally) working again
This commit is contained in:
parent
d566790c0b
commit
87025a4598
2 changed files with 7 additions and 9 deletions
|
@ -153,11 +153,9 @@ SND_StreamAdvance (sfxbuffer_t *buffer, unsigned int count)
|
|||
stepscale = (float) info->rate / shm->speed; // usually 0.5, 1, or 2
|
||||
|
||||
// find out how many samples the buffer currently holds
|
||||
if (buffer->head < buffer->tail) {
|
||||
samples = buffer->length + buffer->head - buffer->tail;
|
||||
} else {
|
||||
samples = buffer->head - buffer->tail;
|
||||
}
|
||||
if (buffer->head < buffer->tail)
|
||||
samples += buffer->length;
|
||||
|
||||
// find out where head points to in the stream
|
||||
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
|
||||
samples = buffer->tail - buffer->head - 1;
|
||||
if (samples < 0)
|
||||
if (buffer->tail <= buffer->head)
|
||||
samples += buffer->length;
|
||||
|
||||
if (headpos + samples > sfx->length) {
|
||||
|
|
|
@ -168,8 +168,8 @@ SND_TransferPaintBuffer (int endtime)
|
|||
void
|
||||
SND_PaintChannels (unsigned int endtime)
|
||||
{
|
||||
unsigned int end, ltime, count;
|
||||
int i;
|
||||
unsigned int end, ltime;
|
||||
int i, count;
|
||||
channel_t *ch;
|
||||
sfxbuffer_t *sc;
|
||||
|
||||
|
@ -214,7 +214,7 @@ SND_PaintChannels (unsigned int endtime)
|
|||
|
||||
// if at end of loop, restart
|
||||
if (ltime >= ch->end) {
|
||||
if (ch->sfx->loopstart >= 0) {
|
||||
if (ch->sfx->loopstart != (unsigned int) -1) {
|
||||
ch->pos = ch->sfx->loopstart;
|
||||
ch->end = ltime + ch->sfx->length - ch->pos;
|
||||
} else { // channel just stopped
|
||||
|
|
Loading…
Reference in a new issue