diff options
author | Chris Robinson <[email protected]> | 2014-08-21 02:27:56 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-08-21 02:27:56 -0700 |
commit | 65d2e0eb8d8c2af6e36586299bca23c014167b24 (patch) | |
tree | 9ee207678d64d90cb2140a0ac39f40028600bcef /Alc | |
parent | b92e643e9742765acd364bcbe30ebaedbe50400f (diff) |
Use an array of objects for active sources instead of pointers
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 13 | ||||
-rw-r--r-- | Alc/ALu.c | 16 |
2 files changed, 11 insertions, 18 deletions
@@ -1924,7 +1924,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) for(pos = 0;pos < context->ActiveSourceCount;pos++) { - ALactivesource *src = context->ActiveSources[pos]; + ALactivesource *src = &context->ActiveSources[pos]; ALsource *source = src->Source; ALuint s = device->NumAuxSends; @@ -1937,8 +1937,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(source) { - src->Update(src, source, context); ATOMIC_STORE(&source->NeedsUpdate, AL_FALSE); + src->Update(src, source, context); } } @@ -2141,10 +2141,8 @@ static ALvoid InitContext(ALCcontext *Context) * Cleans up the context, and destroys any remaining objects the app failed to * delete. Called once there's no more references on the context. */ -static ALCvoid FreeContext(ALCcontext *context) +static void FreeContext(ALCcontext *context) { - ALsizei i; - TRACE("%p\n", context); if(context->SourceMap.size > 0) @@ -2161,11 +2159,6 @@ static ALCvoid FreeContext(ALCcontext *context) } ResetUIntMap(&context->EffectSlotMap); - for(i = 0;i < context->MaxActiveSources;i++) - { - al_free(context->ActiveSources[i]); - context->ActiveSources[i] = NULL; - } free(context->ActiveSources); context->ActiveSources = NULL; context->ActiveSourceCount = 0; @@ -1140,7 +1140,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) { ALuint SamplesToDo; ALeffectslot **slot, **slot_end; - ALactivesource **src, **src_end; + ALactivesource *src, *src_end; ALCcontext *ctx; FPUCtl oldMode; ALuint i, c; @@ -1175,21 +1175,21 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) src_end = src + ctx->ActiveSourceCount; while(src != src_end) { - ALsource *source = (*src)->Source; + ALsource *source = src->Source; if(!source) goto next; if(source->state != AL_PLAYING && source->state != AL_PAUSED) { - (*src)->Source = NULL; + src->Source = NULL; goto next; } if(!DeferUpdates && (ATOMIC_EXCHANGE(ALenum, &source->NeedsUpdate, AL_FALSE) || UpdateSources)) - (*src)->Update(*src, source, ctx); + src->Update(src, source, ctx); if(source->state != AL_PAUSED) - MixSource(*src, source, device, SamplesToDo); + MixSource(src, source, device, SamplesToDo); next: src++; } @@ -1295,14 +1295,14 @@ ALvoid aluHandleDisconnect(ALCdevice *device) Context = ATOMIC_LOAD(&device->ContextList); while(Context) { - ALactivesource **src, **src_end; + ALactivesource *src, *src_end; src = Context->ActiveSources; src_end = src + Context->ActiveSourceCount; while(src != src_end) { - ALsource *source = (*src)->Source; - (*src)->Source = NULL; + ALsource *source = src->Source; + src->Source = NULL; if(source && source->state == AL_PLAYING) { |