aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-21 11:17:47 -0800
committerChris Robinson <[email protected]>2017-02-21 11:17:47 -0800
commitcd24e42b3f7887867735db2cd35a0c4137163379 (patch)
tree90158d7958ea4e72826c231d97d37f6687dd2014 /Alc/ALu.c
parente0e6efbfeac7bb07dce82b63b7688648e1067da3 (diff)
Make the voices' Send[] array dynamically sized
The voices are still all allocated in one chunk to avoid memory fragmentation. But they're accessed as an array of pointers since the size isn't static.
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 1fca0ed0..edb23128 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1313,7 +1313,7 @@ static void CalcSourceParams(ALvoice *voice, ALCcontext *context, ALboolean forc
static void UpdateContextSources(ALCcontext *ctx, ALeffectslot *slot)
{
- ALvoice *voice, *voice_end;
+ ALvoice **voice, **voice_end;
ALsource *source;
IncrementRef(&ctx->UpdateCount);
@@ -1330,11 +1330,11 @@ static void UpdateContextSources(ALCcontext *ctx, ALeffectslot *slot)
voice_end = voice + ctx->VoiceCount;
for(;voice != voice_end;++voice)
{
- if(!(source=voice->Source)) continue;
+ if(!(source=(*voice)->Source)) continue;
if(!IsPlayingOrPaused(source))
- voice->Source = NULL;
+ (*voice)->Source = NULL;
else
- CalcSourceParams(voice, ctx, force);
+ CalcSourceParams(*voice, ctx, force);
}
}
IncrementRef(&ctx->UpdateCount);
@@ -1424,7 +1424,7 @@ DECL_TEMPLATE(ALbyte, aluF2B)
void aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
ALsizei SamplesToDo;
- ALvoice *voice, *voice_end;
+ ALvoice **voice, **voice_end;
ALeffectslot *slot;
ALsource *source;
ALCcontext *ctx;
@@ -1475,11 +1475,11 @@ void aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
voice_end = voice + ctx->VoiceCount;
for(;voice != voice_end;++voice)
{
- ALboolean IsVoiceInit = (voice->Step > 0);
- source = voice->Source;
+ ALboolean IsVoiceInit = ((*voice)->Step > 0);
+ source = (*voice)->Source;
if(IsVoiceInit && source &&
ATOMIC_LOAD(&source->state, almemory_order_relaxed) == AL_PLAYING)
- MixSource(voice, source, device, SamplesToDo);
+ MixSource(*voice, source, device, SamplesToDo);
}
/* effect slot processing */
@@ -1637,15 +1637,15 @@ void aluHandleDisconnect(ALCdevice *device)
Context = ATOMIC_LOAD_SEQ(&device->ContextList);
while(Context)
{
- ALvoice *voice, *voice_end;
+ ALvoice **voice, **voice_end;
voice = Context->Voices;
voice_end = voice + Context->VoiceCount;
while(voice != voice_end)
{
ALenum playing = AL_PLAYING;
- ALsource *source = voice->Source;
- voice->Source = NULL;
+ ALsource *source = (*voice)->Source;
+ (*voice)->Source = NULL;
if(source &&
ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(ALenum, &source->state, &playing, AL_STOPPED))