aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-11-25 18:30:57 -0800
committerChris Robinson <[email protected]>2010-11-25 18:30:57 -0800
commit596514f7aa47ae83e44934bf43eada38ab331ffd (patch)
tree5af268a0a63b04b64c1f9873a520fcbd01454e5e
parent6e3a6f90e9e1db9c12a6a4c28e62b4637d2c7ac7 (diff)
Make the buffer queue a double-linked list
-rw-r--r--OpenAL32/Include/alSource.h1
-rw-r--r--OpenAL32/alSource.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 54a3470e..96e5393c 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -25,6 +25,7 @@ typedef struct ALbufferlistitem
{
struct ALbuffer *buffer;
struct ALbufferlistitem *next;
+ struct ALbufferlistitem *prev;
} ALbufferlistitem;
typedef struct ALsource
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 440bd859..4182ee15 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -550,6 +550,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
BufferListItem = malloc(sizeof(ALbufferlistitem));
BufferListItem->buffer = buffer;
BufferListItem->next = NULL;
+ BufferListItem->prev = NULL;
Source->queue = BufferListItem;
Source->BuffersInQueue = 1;
@@ -1621,6 +1622,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
BufferListStart = malloc(sizeof(ALbufferlistitem));
BufferListStart->buffer = buffer;
BufferListStart->next = NULL;
+ BufferListStart->prev = NULL;
// Increment reference counter for buffer
if(buffer) buffer->refcount++;
@@ -1634,6 +1636,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
BufferList->next = malloc(sizeof(ALbufferlistitem));
BufferList->next->buffer = buffer;
BufferList->next->next = NULL;
+ BufferList->next->prev = BufferList;
// Increment reference counter for buffer
if(buffer) buffer->refcount++;
@@ -1655,6 +1658,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A
BufferList = BufferList->next;
BufferList->next = BufferListStart;
+ BufferList->next->prev = BufferList;
}
// Update number of buffers in queue
@@ -1719,6 +1723,8 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALui
free(BufferList);
Source->BuffersInQueue--;
}
+ if(Source->queue)
+ Source->queue->prev = NULL;
if(Source->state != AL_PLAYING)
{