diff options
author | Chris Robinson <[email protected]> | 2017-02-21 11:17:47 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-02-21 11:17:47 -0800 |
commit | cd24e42b3f7887867735db2cd35a0c4137163379 (patch) | |
tree | 90158d7958ea4e72826c231d97d37f6687dd2014 /OpenAL32/alSource.c | |
parent | e0e6efbfeac7bb07dce82b63b7688648e1067da3 (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/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 16 |
1 files changed, 8 insertions, 8 deletions
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; |