aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenAL32/alSource.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index a073b8a4..d0701468 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1768,7 +1768,7 @@ static ALvoid InitSourceParams(ALsource *Source)
static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALfloat *offset, ALfloat updateLen)
{
ALbufferlistitem *BufferList;
- ALbuffer *Buffer;
+ ALbuffer *Buffer = NULL;
ALfloat BufferFreq;
ALint Channels, Bytes;
ALint readPos, writePos;
@@ -1776,16 +1776,25 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALfloat *offset, AL
ALint TotalBufferDataSize;
ALuint i;
- if((Source->state != AL_PLAYING && Source->state != AL_PAUSED) ||
- !Source->Buffer)
+ // Find the first non-NULL Buffer in the Queue
+ BufferList = Source->queue;
+ while(BufferList)
+ {
+ if(BufferList->buffer)
+ {
+ Buffer = BufferList->buffer;
+ break;
+ }
+ BufferList = BufferList->next;
+ }
+
+ if((Source->state != AL_PLAYING && Source->state != AL_PAUSED) || !Buffer)
{
offset[0] = 0.0f;
offset[1] = 0.0f;
return;
}
- Buffer = Source->Buffer;
-
// Get Current Buffer Size and frequency (in milliseconds)
BufferFreq = (ALfloat)Buffer->frequency;
OriginalFormat = Buffer->eOriginalFormat;