diff options
-rw-r--r-- | OpenAL32/Include/alSource.h | 1 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 6 |
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) { |