diff options
author | Chris Robinson <[email protected]> | 2014-03-21 00:54:37 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-21 01:23:01 -0700 |
commit | ff63188cc2eb307eb874350e5281733d9c50f258 (patch) | |
tree | c422ded3a9125811f5658fb279aef96245c78268 /Alc/ALc.c | |
parent | e6e3937fa9d1d192bc26b900438b45c0e6eb5be2 (diff) |
Add a generic vector interface and use it for the active effect slots
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -2173,10 +2173,7 @@ static ALCvoid FreeContext(ALCcontext *context) context->ActiveSourceCount = 0; context->MaxActiveSources = 0; - context->ActiveEffectSlotCount = 0; - free(context->ActiveEffectSlots); - context->ActiveEffectSlots = NULL; - context->MaxActiveEffectSlots = 0; + VECTOR_DEINIT(context->ActiveAuxSlots); ALCdevice_DecRef(context->Device); context->Device = NULL; @@ -2891,11 +2888,13 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ALContext->ref = 1; ALContext->Listener = (ALlistener*)ALContext->_listener_mem; + VECTOR_INIT(ALContext->ActiveAuxSlots); + ALContext->MaxActiveSources = 256; ALContext->ActiveSources = calloc(ALContext->MaxActiveSources, sizeof(ALContext->ActiveSources[0])); } - if(!ALContext || !ALContext->ActiveSources) + if(!ALContext || !ALContext->ActiveAuxSlots || !ALContext->ActiveSources) { if(!device->ContextList) { @@ -2904,8 +2903,16 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin } UnlockLists(); - free(ALContext); - ALContext = NULL; + if(ALContext) + { + free(ALContext->ActiveSources); + ALContext->ActiveSources = NULL; + + VECTOR_DEINIT(ALContext->ActiveAuxSlots); + + free(ALContext); + ALContext = NULL; + } alcSetError(device, ALC_OUT_OF_MEMORY); ALCdevice_DecRef(device); |