diff options
author | Chris Robinson <[email protected]> | 2008-01-15 16:22:39 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-01-15 16:22:39 -0800 |
commit | b95fcf5da1bb9b37f26c5f42864074790a48dc4f (patch) | |
tree | 9dd8ecbbc152ebd14722ee075963aee4a9ce8cff | |
parent | 707e5968115f99afd6efe6b0f61d8bbf0baa7a94 (diff) |
Store effect slots in the context
-rw-r--r-- | Alc/ALc.c | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 | ||||
-rw-r--r-- | OpenAL32/OpenAL32.c | 2 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 29 |
5 files changed, 19 insertions, 19 deletions
@@ -1013,6 +1013,8 @@ ALCAPI ALCvoid ALCAPIENTRY alcDestroyContext(ALCcontext *context) // Lock context SuspendContext(context); + ReleaseALAuxiliaryEffectSlots(context); + context->Device->Context = NULL; list = &g_pContextList; diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 5d389193..dba2c207 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -41,7 +41,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue); AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues); -ALvoid ReleaseALAuxiliaryEffectSlots(ALvoid); +ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); #ifdef __cplusplus } diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 67c70016..7cbb8773 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -198,6 +198,9 @@ struct ALCcontext_struct struct ALsource *Source; ALuint SourceCount; + struct ALeffectslot *AuxiliaryEffectSlot; + ALuint AuxiliaryEffectSlotCount; + ALenum LastError; ALboolean InUse; diff --git a/OpenAL32/OpenAL32.c b/OpenAL32/OpenAL32.c index a49f5b29..b2d3525e 100644 --- a/OpenAL32/OpenAL32.c +++ b/OpenAL32/OpenAL32.c @@ -41,7 +41,6 @@ BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) case DLL_PROCESS_DETACH: ReleaseALBuffers(); - ReleaseALAuxiliaryEffectSlots(); ReleaseALEffects(); ReleaseALFilters(); ReleaseALC(); @@ -62,7 +61,6 @@ static void my_deinit() once = AL_TRUE; ReleaseALBuffers(); - ReleaseALAuxiliaryEffectSlots(); ReleaseALEffects(); ReleaseALFilters(); ReleaseALC(); diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 7b6d6375..64ec6ef4 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -30,9 +30,6 @@ #include "alThunk.h" #include "alError.h" -static ALeffectslot *g_AuxiliaryEffectSlotList; -static ALuint g_AuxiliaryEffectSlotCount; - AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { @@ -50,12 +47,12 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo if (n > 0) { /* NOTE: We only support one slot currently */ - if(n == 1 && g_AuxiliaryEffectSlotCount == 0) + if(n == 1 && Context->AuxiliaryEffectSlotCount == 0) { // Check that enough memory has been allocted in the 'effectslots' array for n Effect Slots if (!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint))) { - ALeffectslot **list = &g_AuxiliaryEffectSlotList; + ALeffectslot **list = &Context->AuxiliaryEffectSlot; while(*list) list = &(*list)->next; @@ -77,7 +74,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo effectslots[i] = (ALuint)ALTHUNK_ADDENTRY(*list); (*list)->effectslot = effectslots[i]; - g_AuxiliaryEffectSlotCount++; + Context->AuxiliaryEffectSlotCount++; i++; } } @@ -128,7 +125,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect ALAuxiliaryEffectSlot = ((ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslots[i])); // Remove Source from list of Sources - list = &g_AuxiliaryEffectSlotList; + list = &Context->AuxiliaryEffectSlot; while(*list && *list != ALAuxiliaryEffectSlot) list = &(*list)->next; @@ -139,7 +136,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect memset(ALAuxiliaryEffectSlot, 0, sizeof(ALeffectslot)); free(ALAuxiliaryEffectSlot); - g_AuxiliaryEffectSlotCount--; + Context->AuxiliaryEffectSlotCount--; } } } @@ -163,7 +160,7 @@ AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) } SuspendContext(Context); - list = &g_AuxiliaryEffectSlotList; + list = &Context->AuxiliaryEffectSlot; while(*list && (*list)->effectslot != effectslot) list = &(*list)->next; @@ -457,21 +454,21 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p } -ALvoid ReleaseALAuxiliaryEffectSlots(ALvoid) +ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) { #ifdef _DEBUG - if(g_AuxiliaryEffectSlotCount > 0) - AL_PRINT("exit() %d AuxiliaryEffectSlot(s) NOT deleted\n", g_AuxiliaryEffectSlotCount); + if(Context->AuxiliaryEffectSlotCount > 0) + AL_PRINT("exit() %d AuxiliaryEffectSlot(s) NOT deleted\n", Context->AuxiliaryEffectSlotCount); #endif - while(g_AuxiliaryEffectSlotList) + while(Context->AuxiliaryEffectSlot) { - ALeffectslot *temp = g_AuxiliaryEffectSlotList; - g_AuxiliaryEffectSlotList = g_AuxiliaryEffectSlotList->next; + ALeffectslot *temp = Context->AuxiliaryEffectSlot; + Context->AuxiliaryEffectSlot = Context->AuxiliaryEffectSlot->next; // Release effectslot structure memset(temp, 0, sizeof(ALeffectslot)); free(temp); } - g_AuxiliaryEffectSlotCount = 0; + Context->AuxiliaryEffectSlotCount = 0; } |