aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
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 /OpenAL32
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 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h2
-rw-r--r--OpenAL32/Include/alSource.h2
-rw-r--r--OpenAL32/alSource.c16
3 files changed, 10 insertions, 10 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index bb8a57ce..76862f38 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -812,7 +812,7 @@ struct ALCcontext_struct {
ALfloat GainBoost;
- struct ALvoice *Voices;
+ struct ALvoice **Voices;
ALsizei VoiceCount;
ALsizei MaxVoices;
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index c63aef70..53e9a2f4 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -106,7 +106,7 @@ typedef struct ALvoice {
ALfloat (*Buffer)[BUFFERSIZE];
ALsizei Channels;
- } Send[MAX_SENDS];
+ } Send[];
} ALvoice;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 395bc8c2..c541884b 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -128,12 +128,12 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
static inline ALvoice *GetSourceVoice(const ALsource *source, const ALCcontext *context)
{
- ALvoice *voice = context->Voices;
- ALvoice *voice_end = voice + context->VoiceCount;
+ ALvoice **voice = context->Voices;
+ ALvoice **voice_end = voice + context->VoiceCount;
while(voice != voice_end)
{
- if(voice->Source == source)
- return voice;
+ if((*voice)->Source == source)
+ return *voice;
++voice;
}
return NULL;
@@ -2915,7 +2915,7 @@ void UpdateAllSourceProps(ALCcontext *context)
for(pos = 0;pos < context->VoiceCount;pos++)
{
- ALvoice *voice = &context->Voices[pos];
+ ALvoice *voice = context->Voices[pos];
ALsource *source = voice->Source;
if(source != NULL && source->NeedsUpdate && IsPlayingOrPaused(source))
{
@@ -2982,16 +2982,16 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
{
for(i = 0;i < Context->VoiceCount;i++)
{
- if(Context->Voices[i].Source == NULL)
+ if(Context->Voices[i]->Source == NULL)
{
- voice = &Context->Voices[i];
+ voice = Context->Voices[i];
voice->Source = Source;
break;
}
}
if(voice == NULL)
{
- voice = &Context->Voices[Context->VoiceCount++];
+ voice = Context->Voices[Context->VoiceCount++];
voice->Source = Source;
}
discontinuity = AL_TRUE;