[quake3-commits] r1700 - trunk/code/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Oct 24 04:33:20 EDT 2009
Author: thilo
Date: 2009-10-24 04:33:12 -0400 (Sat, 24 Oct 2009)
New Revision: 1700
Modified:
trunk/code/client/snd_openal.c
Log:
A few more last fixes that will handle some special cases
Modified: trunk/code/client/snd_openal.c
===================================================================
--- trunk/code/client/snd_openal.c 2009-10-23 23:51:00 UTC (rev 1699)
+++ trunk/code/client/snd_openal.c 2009-10-24 08:33:12 UTC (rev 1700)
@@ -501,7 +501,7 @@
float curGain; // gain employed if source is within maxdistance.
float scaleGain; // Last gain value for this source. 0 if muted.
- float lastTimePos; // On stopped loops, last time position in s
+ float lastTimePos; // On stopped loops, the last position in the buffer
int lastSampleTime; // Time when this was stopped
qboolean local; // Is this local (relative to the cam)
@@ -758,7 +758,8 @@
curSfx = &knownSfx[rmSource->sfx];
- curSfx->loopActiveCnt--;
+ if(rmSource->isPlaying)
+ curSfx->loopActiveCnt--;
if(iskilled)
curSfx->loopCnt--;
@@ -798,9 +799,20 @@
else
curSource = &srcList[firstInactive];
- // this was the last not stopped source, save last sample position + time
- qalGetSourcef(rmSource->alSource, AL_SEC_OFFSET, &curSource->lastTimePos);
- curSource->lastSampleTime = Sys_Milliseconds();
+ if(rmSource->isPlaying)
+ {
+ // this was the last not stopped source, save last sample position + time
+ qalGetSourcef(rmSource->alSource, AL_SEC_OFFSET, &curSource->lastTimePos);
+ curSource->lastSampleTime = Sys_Milliseconds();
+ }
+ else
+ {
+ // second case: all loops using this sound have stopped due to listener being of of range,
+ // and now the inactive master gets deleted. Just move over the soundpos settings to the
+ // new master.
+ curSource->lastTimePos = rmSource->lastTimePos;
+ curSource->lastSampleTime = rmSource->lastSampleTime;
+ }
}
}
}
@@ -840,9 +852,11 @@
}
// Stop it if it's playing
- if(curSource->isActive)
+ if(curSource->isPlaying)
+ {
qalSourceStop(curSource->alSource);
- curSource->isPlaying = qfalse;
+ curSource->isPlaying = qfalse;
+ }
// Remove the buffer
qalSourcei(curSource->alSource, AL_BUFFER, 0);
@@ -1340,7 +1354,6 @@
qalSourcei(curSource->alSource, AL_LOOPING, AL_TRUE);
curSource->isPlaying = qtrue;
qalSourcePlay(curSource->alSource);
-
}
// Update locality
@@ -1370,6 +1383,7 @@
qalGetSourcei(curSource->alSource, AL_SOURCE_STATE, &state);
if(state == AL_STOPPED)
{
+ curSource->isPlaying = qfalse;
S_AL_SrcKill(i);
continue;
}
More information about the quake3-commits
mailing list