aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alSource.h1
-rw-r--r--OpenAL32/alSource.c23
2 files changed, 14 insertions, 10 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index ba1e5f4c..d49120b8 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -97,7 +97,6 @@ typedef struct ALsource {
/** Source Buffer Queue info. */
ALbufferlistitem *queue;
- ALuint BuffersInQueue;
ALbufferlistitem *current_buffer;
/** Current buffer sample info. */
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index f762747a..1e221c73 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -583,9 +583,6 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
{
ALbufferlistitem *BufferListItem;
- /* Source is now Static */
- Source->SourceType = AL_STATIC;
-
/* Add the selected buffer to a one-item queue */
BufferListItem = malloc(sizeof(ALbufferlistitem));
BufferListItem->buffer = buffer;
@@ -593,8 +590,9 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
BufferListItem->prev = NULL;
IncrementRef(&buffer->ref);
+ /* Source is now Static */
+ Source->SourceType = AL_STATIC;
oldlist = ExchangePtr((XchgPtr*)&Source->queue, BufferListItem);
- Source->BuffersInQueue = 1;
ReadLock(&buffer->lock);
Source->NumChannels = ChannelsFromFmt(buffer->FmtChannels);
@@ -606,7 +604,6 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
/* Source is now Undetermined */
Source->SourceType = AL_UNDETERMINED;
oldlist = ExchangePtr((XchgPtr*)&Source->queue, NULL);
- Source->BuffersInQueue = 0;
}
Source->current_buffer = Source->queue;
@@ -1023,7 +1020,18 @@ static ALboolean GetSourceiv(const ALsource *Source, ALCcontext *Context, SrcInt
return AL_TRUE;
case AL_BUFFERS_QUEUED:
- *values = Source->BuffersInQueue;
+ LockContext(Context);
+ if(!(BufferList=Source->queue))
+ *values = 0;
+ else
+ {
+ ALsizei count = 0;
+ do {
+ ++count;
+ } while((BufferList=BufferList->next) != NULL);
+ *values = count;
+ }
+ UnlockContext(Context);
return AL_TRUE;
case AL_BUFFERS_PROCESSED:
@@ -2142,8 +2150,6 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu
}
BufferListStart = NULL;
- source->BuffersInQueue += nb;
-
UnlockContext(context);
done:
@@ -2198,7 +2204,6 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint
{
BufferList = source->queue;
source->queue = BufferList->next;
- source->BuffersInQueue--;
if(BufferList->buffer)
{