diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 6 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 6 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 8 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 67 | ||||
-rw-r--r-- | OpenAL32/alState.c | 16 |
5 files changed, 51 insertions, 52 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 0aea19e2..4113a70a 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -748,9 +748,9 @@ struct ALCcontext_struct volatile ALfloat SpeedOfSound; volatile ALenum DeferUpdates; - struct ALactivesource *ActiveSources; - ALsizei ActiveSourceCount; - ALsizei MaxActiveSources; + struct ALvoice *Voices; + ALsizei VoiceCount; + ALsizei MaxVoices; VECTOR(struct ALeffectslot*) ActiveAuxSlots; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 173db94e..39bb8185 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -27,11 +27,11 @@ typedef struct ALbufferlistitem { } ALbufferlistitem; -typedef struct ALactivesource { +typedef struct ALvoice { struct ALsource *volatile Source; /** Method to update mixing parameters. */ - ALvoid (*Update)(struct ALactivesource *self, const struct ALsource *source, const ALCcontext *context); + ALvoid (*Update)(struct ALvoice *self, const struct ALsource *source, const ALCcontext *context); /** Current target parameters used for mixing. */ ALint Step; @@ -42,7 +42,7 @@ typedef struct ALactivesource { DirectParams Direct; SendParams Send[MAX_SENDS]; -} ALactivesource; +} ALvoice; typedef struct ALsource { diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index ac09f89f..55d33988 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -42,7 +42,7 @@ extern "C" { #endif struct ALsource; -struct ALactivesource; +struct ALvoice; enum ActiveFilters { @@ -220,10 +220,10 @@ inline void SetGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[MaxC } -ALvoid CalcSourceParams(struct ALactivesource *src, const struct ALsource *source, const ALCcontext *ALContext); -ALvoid CalcNonAttnSourceParams(struct ALactivesource *src, const struct ALsource *source, const ALCcontext *ALContext); +ALvoid CalcSourceParams(struct ALvoice *voice, const struct ALsource *source, const ALCcontext *ALContext); +ALvoid CalcNonAttnSourceParams(struct ALvoice *voice, const struct ALsource *source, const ALCcontext *ALContext); -ALvoid MixSource(struct ALactivesource *src, struct ALsource *source, ALCdevice *Device, ALuint SamplesToDo); +ALvoid MixSource(struct ALvoice *voice, struct ALsource *source, ALCdevice *Device, ALuint SamplesToDo); ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size); /* Caller must lock the device. */ diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 09d61fc7..e47008c5 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1389,21 +1389,21 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) } for(i = 0;i < n;i++) { - ALactivesource *srclist, *srclistend; + ALvoice *voice, *voice_end; if((Source=RemoveSource(context, sources[i])) == NULL) continue; FreeThunkEntry(Source->id); LockContext(context); - srclist = context->ActiveSources; - srclistend = srclist + context->ActiveSourceCount; - while(srclist != srclistend) + voice = context->Voices; + voice_end = voice + context->VoiceCount; + while(voice != voice_end) { ALsource *old = Source; - if(COMPARE_EXCHANGE(&srclist->Source, &old, NULL)) + if(COMPARE_EXCHANGE(&voice->Source, &old, NULL)) break; - srclist++; + voice++; } UnlockContext(context); @@ -2015,24 +2015,23 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) } LockContext(context); - while(n > context->MaxActiveSources-context->ActiveSourceCount) + while(n > context->MaxVoices-context->VoiceCount) { - ALactivesource *temp = NULL; + ALvoice *temp = NULL; ALsizei newcount; - newcount = context->MaxActiveSources << 1; + newcount = context->MaxVoices << 1; if(newcount > 0) - temp = realloc(context->ActiveSources, - newcount * sizeof(context->ActiveSources[0])); + temp = realloc(context->Voices, newcount * sizeof(context->Voices[0])); if(!temp) { UnlockContext(context); SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); } - memset(&temp[context->MaxActiveSources], 0, (newcount-context->MaxActiveSources) * sizeof(temp[0])); + memset(&temp[context->MaxVoices], 0, (newcount-context->MaxVoices) * sizeof(temp[0])); - context->ActiveSources = temp; - context->MaxActiveSources = newcount; + context->Voices = temp; + context->MaxVoices = newcount; } for(i = 0;i < n;i++) @@ -2449,7 +2448,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) { ALCdevice *device = Context->Device; ALbufferlistitem *BufferList; - ALactivesource *src = NULL; + ALvoice *voice = NULL; ALsizei i; /* Check that there is a queue containing at least one valid, non zero @@ -2484,51 +2483,51 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) /* Make sure this source isn't already active, while looking for an * unused active source slot to put it in. */ - for(i = 0;i < Context->ActiveSourceCount;i++) + for(i = 0;i < Context->VoiceCount;i++) { ALsource *old = Source; - if(COMPARE_EXCHANGE(&Context->ActiveSources[i].Source, &old, NULL)) + if(COMPARE_EXCHANGE(&Context->Voices[i].Source, &old, NULL)) { - if(src == NULL) + if(voice == NULL) { - src = &Context->ActiveSources[i]; - src->Source = Source; + voice = &Context->Voices[i]; + voice->Source = Source; } break; } old = NULL; - if(src == NULL && COMPARE_EXCHANGE(&Context->ActiveSources[i].Source, &old, Source)) - src = &Context->ActiveSources[i]; + if(voice == NULL && COMPARE_EXCHANGE(&Context->Voices[i].Source, &old, Source)) + voice = &Context->Voices[i]; } - if(src == NULL) + if(voice == NULL) { - src = &Context->ActiveSources[Context->ActiveSourceCount++]; - src->Source = Source; + voice = &Context->Voices[Context->VoiceCount++]; + voice->Source = Source; } - src->Direct.Moving = AL_FALSE; - src->Direct.Counter = 0; + voice->Direct.Moving = AL_FALSE; + voice->Direct.Counter = 0; for(i = 0;i < MAX_INPUT_CHANNELS;i++) { ALsizei j; for(j = 0;j < SRC_HISTORY_LENGTH;j++) - src->Direct.Mix.Hrtf.State[i].History[j] = 0.0f; + voice->Direct.Mix.Hrtf.State[i].History[j] = 0.0f; for(j = 0;j < HRIR_LENGTH;j++) { - src->Direct.Mix.Hrtf.State[i].Values[j][0] = 0.0f; - src->Direct.Mix.Hrtf.State[i].Values[j][1] = 0.0f; + voice->Direct.Mix.Hrtf.State[i].Values[j][0] = 0.0f; + voice->Direct.Mix.Hrtf.State[i].Values[j][1] = 0.0f; } } for(i = 0;i < (ALsizei)device->NumAuxSends;i++) { - src->Send[i].Counter = 0; - src->Send[i].Moving = AL_FALSE; + voice->Send[i].Counter = 0; + voice->Send[i].Moving = AL_FALSE; } if(BufferList->buffer->FmtChannels == FmtMono) - src->Update = CalcSourceParams; + voice->Update = CalcSourceParams; else - src->Update = CalcNonAttnSourceParams; + voice->Update = CalcNonAttnSourceParams; ATOMIC_STORE(&Source->NeedsUpdate, AL_TRUE); } diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 77eefc8b..b001d3f4 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -715,7 +715,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) if(!context->DeferUpdates) { ALboolean UpdateSources; - ALactivesource *src, *src_end; + ALvoice *voice, *voice_end; ALeffectslot **slot, **slot_end; FPUCtl oldMode; @@ -727,23 +727,23 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) /* Make sure all pending updates are performed */ UpdateSources = ATOMIC_EXCHANGE(ALenum, &context->UpdateSources, AL_FALSE); - src = context->ActiveSources; - src_end = src + context->ActiveSourceCount; - while(src != src_end) + voice = context->Voices; + voice_end = voice + context->VoiceCount; + while(voice != voice_end) { - ALsource *source = src->Source; + ALsource *source = voice->Source; if(!source) goto next; if(source->state != AL_PLAYING && source->state != AL_PAUSED) { - src->Source = NULL; + voice->Source = NULL; continue; } if(ATOMIC_EXCHANGE(ALenum, &source->NeedsUpdate, AL_FALSE) || UpdateSources) - src->Update(src, source, context); + voice->Update(voice, source, context); next: - src++; + voice++; } slot = VECTOR_ITER_BEGIN(context->ActiveAuxSlots); |