diff options
author | Chris Robinson <[email protected]> | 2014-05-10 03:33:41 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-05-10 03:33:41 -0700 |
commit | eebde08e65ea8f2c3200308d8db1e031a0d80273 (patch) | |
tree | 6a89c6df7eaa2f0f653565a88ffd5b8b3fc39f67 /OpenAL32 | |
parent | c4383b65e20c2223b0e390c5e5254edbb6aada8f (diff) |
Don't explicitly store the BuffersInQueue
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alSource.h | 1 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 23 |
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) { |