diff options
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 7 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 12 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 397c8075..d7f4206a 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -84,12 +84,13 @@ typedef struct ALbuffer ALsizei LoopStart; ALsizei LoopEnd; - RefCount ref; // Number of sources using this buffer (deletion can only occur when this is 0) + /* Number of times buffer was attached to a source (deletion can only occur when 0) */ + RefCount ref; RWLock lock; - // Index to itself - ALuint buffer; + /* Self ID */ + ALuint id; } ALbuffer; ALvoid ReleaseALBuffers(ALCdevice *device); diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index c2d0f41c..94aad22d 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -215,12 +215,12 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) } RWLockInit(&buffer->lock); - err = NewThunkEntry(&buffer->buffer); + err = NewThunkEntry(&buffer->id); if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, buffer); + err = InsertUIntMapEntry(&device->BufferMap, buffer->id, buffer); if(err != AL_NO_ERROR) { - FreeThunkEntry(buffer->buffer); + FreeThunkEntry(buffer->id); memset(buffer, 0, sizeof(ALbuffer)); free(buffer); @@ -229,7 +229,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) break; } - buffers[i++] = buffer->buffer; + buffers[i++] = buffer->id; } } @@ -283,7 +283,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) { if((ALBuf=RemoveBuffer(device, buffers[i])) == NULL) continue; - FreeThunkEntry(ALBuf->buffer); + FreeThunkEntry(ALBuf->id); /* Release the memory used to store audio data */ free(ALBuf->data); @@ -2278,7 +2278,7 @@ ALvoid ReleaseALBuffers(ALCdevice *device) free(temp->data); - FreeThunkEntry(temp->buffer); + FreeThunkEntry(temp->id); memset(temp, 0, sizeof(ALbuffer)); free(temp); } diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 2ec4ce9c..1e3d09c5 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1145,7 +1145,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value } } *value = ((BufferList && BufferList->buffer) ? - BufferList->buffer->buffer : 0); + BufferList->buffer->id : 0); UnlockContext(Context); break; @@ -1763,7 +1763,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint source, ALsizei n, ALuin if(BufferList->buffer) { // Record name of buffer - buffers[i] = BufferList->buffer->buffer; + buffers[i] = BufferList->buffer->id; // Decrement buffer reference counter DecrementRef(&BufferList->buffer->ref); } |