aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-08-21 02:27:56 -0700
committerChris Robinson <[email protected]>2014-08-21 02:27:56 -0700
commit65d2e0eb8d8c2af6e36586299bca23c014167b24 (patch)
tree9ee207678d64d90cb2140a0ac39f40028600bcef /Alc
parentb92e643e9742765acd364bcbe30ebaedbe50400f (diff)
Use an array of objects for active sources instead of pointers
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c13
-rw-r--r--Alc/ALu.c16
2 files changed, 11 insertions, 18 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 53295fa0..7eefd9d1 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -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;
diff --git a/Alc/ALu.c b/Alc/ALu.c
index c4a03fec..ce1b1cbd 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -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)
{