diff options
author | Chris Robinson <[email protected]> | 2011-08-29 23:05:47 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-29 23:10:02 -0700 |
commit | cc67f4589256efceb17c58673159b3e687ec0436 (patch) | |
tree | fe7c3688ac00bdb6ee0fc9766216ab4b9f9144b8 /OpenAL32 | |
parent | c6a110ec59c794f08446bd8bb9d90958903984c9 (diff) |
Use the reference counting functions for the buffer and auxiliary slot refs
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 2 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 4 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 8 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 22 |
5 files changed, 19 insertions, 19 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index ac71c4ec..5fcfce7d 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -26,7 +26,7 @@ typedef struct ALeffectslot ALfloat ClickRemoval[1]; ALfloat PendingClicks[1]; - ALuint refcount; + RefCount ref; // Index to itself ALuint effectslot; diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 12feee5d..8e18732a 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -85,7 +85,7 @@ typedef struct ALbuffer ALsizei LoopStart; ALsizei LoopEnd; - ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0) + RefCount ref; // Number of sources using this buffer (deletion can only occur when this is 0) // Index to itself ALuint buffer; diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index edd29fb2..f34f4d09 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -94,7 +94,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo slot->ClickRemoval[j] = 0.0f; slot->PendingClicks[j] = 0.0f; } - slot->refcount = 0; + slot->ref = 0; } } @@ -125,7 +125,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect SlotsValid = AL_FALSE; break; } - else if(EffectSlot->refcount > 0) + else if(EffectSlot->ref != 0) { alSetError(Context, AL_INVALID_NAME); SlotsValid = AL_FALSE; diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 7d5b895f..ebcd4724 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -221,7 +221,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) Failed = AL_TRUE; break; } - else if(ALBuf->refcount != 0) + else if(ALBuf->ref != 0) { /* Buffer still in use, cannot be deleted */ alSetError(Context, AL_INVALID_OPERATION); @@ -297,7 +297,7 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid device = Context->Device; if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL) alSetError(Context, AL_INVALID_NAME); - else if(ALBuf->refcount != 0) + else if(ALBuf->ref != 0) alSetError(Context, AL_INVALID_VALUE); else if(size < 0 || freq < 0) alSetError(Context, AL_INVALID_VALUE); @@ -453,7 +453,7 @@ AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, device = Context->Device; if((ALBuf=LookupBuffer(device->BufferMap, buffer)) == NULL) alSetError(Context, AL_INVALID_NAME); - else if(ALBuf->refcount != 0) + else if(ALBuf->ref != 0) alSetError(Context, AL_INVALID_VALUE); else if(frames < 0 || samplerate == 0) alSetError(Context, AL_INVALID_VALUE); @@ -737,7 +737,7 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum eParam, const ALint* pl switch(eParam) { case AL_LOOP_POINTS_SOFT: - if(ALBuf->refcount > 0) + if(ALBuf->ref != 0) alSetError(pContext, AL_INVALID_OPERATION); else if(plValues[0] < 0 || plValues[1] < 0 || plValues[0] >= plValues[1] || ALBuf->size == 0) diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 79f5751f..3e8d2b6a 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -166,14 +166,14 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) Source->queue = BufferList->next; if(BufferList->buffer != NULL) - BufferList->buffer->refcount--; + DecrementRef(&BufferList->buffer->ref); free(BufferList); } for(j = 0;j < MAX_SENDS;++j) { if(Source->Send[j].Slot) - Source->Send[j].Slot->refcount--; + DecrementRef(&Source->Send[j].Slot->ref); Source->Send[j].Slot = NULL; } @@ -571,7 +571,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) Source->queue = BufferListItem->next; if(BufferListItem->buffer) - BufferListItem->buffer->refcount--; + DecrementRef(&BufferListItem->buffer->ref); free(BufferListItem); } Source->BuffersInQueue = 0; @@ -599,7 +599,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue) Source->Update = CalcNonAttnSourceParams; // Increment reference counter for buffer - buffer->refcount++; + IncrementRef(&buffer->ref); } else { @@ -770,10 +770,10 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1, /* Release refcount on the previous slot, and add one for * the new slot */ if(Source->Send[lValue2].Slot) - Source->Send[lValue2].Slot->refcount--; + DecrementRef(&Source->Send[lValue2].Slot->ref); Source->Send[lValue2].Slot = ALEffectSlot; if(Source->Send[lValue2].Slot) - Source->Send[lValue2].Slot->refcount++; + IncrementRef(&Source->Send[lValue2].Slot->ref); if(!ALFilter) { @@ -1636,7 +1636,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A BufferListStart->prev = NULL; // Increment reference counter for buffer - if(buffer) buffer->refcount++; + if(buffer) IncrementRef(&buffer->ref); BufferList = BufferListStart; @@ -1650,7 +1650,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei n, const A BufferList->next->prev = BufferList; // Increment reference counter for buffer - if(buffer) buffer->refcount++; + if(buffer) IncrementRef(&buffer->ref); BufferList = BufferList->next; } @@ -1723,7 +1723,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALui // Record name of buffer buffers[i] = BufferList->buffer->buffer; // Decrement buffer reference counter - BufferList->buffer->refcount--; + DecrementRef(&BufferList->buffer->ref); } else buffers[i] = 0; @@ -2145,14 +2145,14 @@ ALvoid ReleaseALSources(ALCcontext *Context) temp->queue = BufferList->next; if(BufferList->buffer != NULL) - BufferList->buffer->refcount--; + DecrementRef(&BufferList->buffer->ref); free(BufferList); } for(j = 0;j < MAX_SENDS;++j) { if(temp->Send[j].Slot) - temp->Send[j].Slot->refcount--; + DecrementRef(&temp->Send[j].Slot->ref); temp->Send[j].Slot = NULL; } |