aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-03-27 23:16:23 -0700
committerChris Robinson <[email protected]>2017-03-27 23:16:23 -0700
commit70aefa75e2253ef7a93cdd6412e8523663d3c6e9 (patch)
tree82e740fbebe8d1ebe71082d3b40f807247484618 /Alc/ALc.c
parentb49a79a15fa16e93e2e2ff1fc76dbae0425fd503 (diff)
Use an array of pointers for effects instead of a linked list
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 8d241802..84007020 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2449,6 +2449,7 @@ static ALCboolean VerifyDevice(ALCdevice **device)
static ALvoid InitContext(ALCcontext *Context)
{
ALlistener *listener = Context->Listener;
+ struct ALeffectslotArray *auxslots;
//Initialise listener
listener->Gain = 1.0f;
@@ -2490,6 +2491,10 @@ static ALvoid InitContext(ALCcontext *Context)
InitUIntMap(&Context->SourceMap, Context->Device->SourcesMax);
InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax);
+ auxslots = al_calloc(DEF_ALIGN, offsetof(struct ALeffectslotArray, slot[0]));
+ auxslots->count = 0;
+ ATOMIC_INIT(&Context->ActiveAuxSlots, auxslots);
+
//Set globals
Context->DistanceModel = DefaultDistanceModel;
Context->SourceDistanceModel = AL_FALSE;
@@ -2510,11 +2515,16 @@ static ALvoid InitContext(ALCcontext *Context)
static void FreeContext(ALCcontext *context)
{
ALlistener *listener = context->Listener;
+ struct ALeffectslotArray *auxslots;
struct ALlistenerProps *lprops;
size_t count;
TRACE("%p\n", context);
+ auxslots = ATOMIC_EXCHANGE(struct ALeffectslotArray*, &context->ActiveAuxSlots,
+ NULL, almemory_order_relaxed);
+ al_free(auxslots);
+
if(context->SourceMap.size > 0)
{
WARN("(%p) Deleting %d Source%s\n", context, context->SourceMap.size,
@@ -3511,7 +3521,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
ALContext->Listener = (ALlistener*)ALContext->_listener_mem;
ALContext->Device = device;
- ATOMIC_INIT(&ALContext->ActiveAuxSlotList, NULL);
+ ATOMIC_INIT(&ALContext->ActiveAuxSlots, NULL);
ALContext->Voices = NULL;
ALContext->MaxVoices = 0;