aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c33
-rw-r--r--Alc/ALu.c264
-rw-r--r--Alc/mixer.c18
-rw-r--r--OpenAL32/Include/alMain.h6
-rw-r--r--OpenAL32/Include/alSource.h6
-rw-r--r--OpenAL32/Include/alu.h8
-rw-r--r--OpenAL32/alSource.c67
-rw-r--r--OpenAL32/alState.c16
8 files changed, 208 insertions, 210 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 7eefd9d1..52c98405 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1922,23 +1922,23 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
}
UnlockUIntMapRead(&context->SourceMap);
- for(pos = 0;pos < context->ActiveSourceCount;pos++)
+ for(pos = 0;pos < context->VoiceCount;pos++)
{
- ALactivesource *src = &context->ActiveSources[pos];
- ALsource *source = src->Source;
+ ALvoice *voice = &context->Voices[pos];
+ ALsource *source = voice->Source;
ALuint s = device->NumAuxSends;
while(s < MAX_SENDS)
{
- src->Send[s].Moving = AL_FALSE;
- src->Send[s].Counter = 0;
+ voice->Send[s].Moving = AL_FALSE;
+ voice->Send[s].Counter = 0;
s++;
}
if(source)
{
ATOMIC_STORE(&source->NeedsUpdate, AL_FALSE);
- src->Update(src, source, context);
+ voice->Update(voice, source, context);
}
}
@@ -2120,7 +2120,6 @@ static ALvoid InitContext(ALCcontext *Context)
//Validate Context
ATOMIC_INIT(&Context->LastError, AL_NO_ERROR);
ATOMIC_INIT(&Context->UpdateSources, AL_FALSE);
- Context->ActiveSourceCount = 0;
InitUIntMap(&Context->SourceMap, Context->Device->MaxNoOfSources);
InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax);
@@ -2159,10 +2158,10 @@ static void FreeContext(ALCcontext *context)
}
ResetUIntMap(&context->EffectSlotMap);
- free(context->ActiveSources);
- context->ActiveSources = NULL;
- context->ActiveSourceCount = 0;
- context->MaxActiveSources = 0;
+ free(context->Voices);
+ context->Voices = NULL;
+ context->VoiceCount = 0;
+ context->MaxVoices = 0;
VECTOR_DEINIT(context->ActiveAuxSlots);
@@ -2884,11 +2883,11 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
VECTOR_INIT(ALContext->ActiveAuxSlots);
- ALContext->MaxActiveSources = 256;
- ALContext->ActiveSources = calloc(ALContext->MaxActiveSources,
- sizeof(ALContext->ActiveSources[0]));
+ ALContext->VoiceCount = 0;
+ ALContext->MaxVoices = 256;
+ ALContext->Voices = calloc(ALContext->MaxVoices, sizeof(ALContext->Voices[0]));
}
- if(!ALContext || !ALContext->ActiveSources)
+ if(!ALContext || !ALContext->Voices)
{
if(!ATOMIC_LOAD(&device->ContextList))
{
@@ -2899,8 +2898,8 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
if(ALContext)
{
- free(ALContext->ActiveSources);
- ALContext->ActiveSources = NULL;
+ free(ALContext->Voices);
+ ALContext->Voices = NULL;
VECTOR_DEINIT(ALContext->ActiveAuxSlots);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ce1b1cbd..b7311d8a 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -166,7 +166,7 @@ static ALvoid CalcListenerParams(ALlistener *Listener)
aluMatrixVector(Listener->Params.Velocity, 0.0f, Listener->Params.Matrix);
}
-ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, const ALCcontext *ALContext)
+ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCcontext *ALContext)
{
static const struct ChanMap MonoMap[1] = { { FrontCenter, 0.0f } };
static const struct ChanMap StereoMap[2] = {
@@ -245,16 +245,16 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
Pitch = ALSource->Pitch;
DirectChannels = ALSource->DirectChannels;
- src->Direct.OutBuffer = Device->DryBuffer;
+ voice->Direct.OutBuffer = Device->DryBuffer;
for(i = 0;i < NumSends;i++)
{
ALeffectslot *Slot = ALSource->Send[i].Slot;
if(!Slot && i == 0)
Slot = Device->DefaultSlot;
if(!Slot || Slot->EffectType == AL_EFFECT_NULL)
- src->Send[i].OutBuffer = NULL;
+ voice->Send[i].OutBuffer = NULL;
else
- src->Send[i].OutBuffer = Slot->WetBuffer;
+ voice->Send[i].OutBuffer = Slot->WetBuffer;
}
/* Calculate the stepping value */
@@ -267,12 +267,12 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
{
Pitch = Pitch * ALBuffer->Frequency / Frequency;
if(Pitch > (ALfloat)MAX_PITCH)
- src->Step = MAX_PITCH<<FRACTIONBITS;
+ voice->Step = MAX_PITCH<<FRACTIONBITS;
else
{
- src->Step = fastf2i(Pitch*FRACTIONONE);
- if(src->Step == 0)
- src->Step = 1;
+ voice->Step = fastf2i(Pitch*FRACTIONONE);
+ if(voice->Step == 0)
+ voice->Step = 1;
}
Channels = ALBuffer->FmtChannels;
@@ -350,14 +350,14 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
{
for(c = 0;c < num_channels;c++)
{
- MixGains *gains = src->Direct.Mix.Gains[c];
+ MixGains *gains = voice->Direct.Mix.Gains[c];
for(j = 0;j < MaxChannels;j++)
gains[j].Target = 0.0f;
}
for(c = 0;c < num_channels;c++)
{
- MixGains *gains = src->Direct.Mix.Gains[c];
+ MixGains *gains = voice->Direct.Mix.Gains[c];
for(i = 0;i < (ALint)Device->NumChan;i++)
{
enum Channel chan = Device->Speaker2Chan[i];
@@ -369,25 +369,25 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
}
}
- if(!src->Direct.Moving)
+ if(!voice->Direct.Moving)
{
for(i = 0;i < num_channels;i++)
{
- MixGains *gains = src->Direct.Mix.Gains[i];
+ MixGains *gains = voice->Direct.Mix.Gains[i];
for(j = 0;j < MaxChannels;j++)
{
gains[j].Current = gains[j].Target;
gains[j].Step = 1.0f;
}
}
- src->Direct.Counter = 0;
- src->Direct.Moving = AL_TRUE;
+ voice->Direct.Counter = 0;
+ voice->Direct.Moving = AL_TRUE;
}
else
{
for(i = 0;i < num_channels;i++)
{
- MixGains *gains = src->Direct.Mix.Gains[i];
+ MixGains *gains = voice->Direct.Mix.Gains[i];
for(j = 0;j < MaxChannels;j++)
{
ALfloat cur = maxf(gains[j].Current, FLT_EPSILON);
@@ -399,10 +399,10 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
gains[j].Current = cur;
}
}
- src->Direct.Counter = 64;
+ voice->Direct.Counter = 64;
}
- src->IsHrtf = AL_FALSE;
+ voice->IsHrtf = AL_FALSE;
}
else if(Device->Hrtf)
{
@@ -411,12 +411,12 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
if(chans[c].channel == LFE)
{
/* Skip LFE */
- src->Direct.Mix.Hrtf.Params[c].Delay[0] = 0;
- src->Direct.Mix.Hrtf.Params[c].Delay[1] = 0;
+ voice->Direct.Mix.Hrtf.Params[c].Delay[0] = 0;
+ voice->Direct.Mix.Hrtf.Params[c].Delay[1] = 0;
for(i = 0;i < HRIR_LENGTH;i++)
{
- src->Direct.Mix.Hrtf.Params[c].Coeffs[i][0] = 0.0f;
- src->Direct.Mix.Hrtf.Params[c].Coeffs[i][1] = 0.0f;
+ voice->Direct.Mix.Hrtf.Params[c].Coeffs[i][0] = 0.0f;
+ voice->Direct.Mix.Hrtf.Params[c].Coeffs[i][1] = 0.0f;
}
}
else
@@ -425,21 +425,21 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
* channel. */
GetLerpedHrtfCoeffs(Device->Hrtf,
0.0f, chans[c].angle, 1.0f, DryGain,
- src->Direct.Mix.Hrtf.Params[c].Coeffs,
- src->Direct.Mix.Hrtf.Params[c].Delay);
+ voice->Direct.Mix.Hrtf.Params[c].Coeffs,
+ voice->Direct.Mix.Hrtf.Params[c].Delay);
}
}
- src->Direct.Counter = 0;
- src->Direct.Moving = AL_TRUE;
- src->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
+ voice->Direct.Counter = 0;
+ voice->Direct.Moving = AL_TRUE;
+ voice->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
- src->IsHrtf = AL_TRUE;
+ voice->IsHrtf = AL_TRUE;
}
else
{
for(i = 0;i < num_channels;i++)
{
- MixGains *gains = src->Direct.Mix.Gains[i];
+ MixGains *gains = voice->Direct.Mix.Gains[i];
for(j = 0;j < MaxChannels;j++)
gains[j].Target = 0.0f;
}
@@ -447,7 +447,7 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
DryGain *= lerp(1.0f, 1.0f/sqrtf((float)Device->NumChan), hwidth/F_PI);
for(c = 0;c < num_channels;c++)
{
- MixGains *gains = src->Direct.Mix.Gains[c];
+ MixGains *gains = voice->Direct.Mix.Gains[c];
ALfloat Target[MaxChannels];
/* Special-case LFE */
@@ -461,25 +461,25 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
gains[i].Target = Target[i];
}
- if(!src->Direct.Moving)
+ if(!voice->Direct.Moving)
{
for(i = 0;i < num_channels;i++)
{
- MixGains *gains = src->Direct.Mix.Gains[i];
+ MixGains *gains = voice->Direct.Mix.Gains[i];
for(j = 0;j < MaxChannels;j++)
{
gains[j].Current = gains[j].Target;
gains[j].Step = 1.0f;
}
}
- src->Direct.Counter = 0;
- src->Direct.Moving = AL_TRUE;
+ voice->Direct.Counter = 0;
+ voice->Direct.Moving = AL_TRUE;
}
else
{
for(i = 0;i < num_channels;i++)
{
- MixGains *gains = src->Direct.Mix.Gains[i];
+ MixGains *gains = voice->Direct.Mix.Gains[i];
for(j = 0;j < MaxChannels;j++)
{
ALfloat trg = maxf(gains[j].Target, FLT_EPSILON);
@@ -491,31 +491,31 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
gains[j].Current = cur;
}
}
- src->Direct.Counter = 64;
+ voice->Direct.Counter = 64;
}
- src->IsHrtf = AL_FALSE;
+ voice->IsHrtf = AL_FALSE;
}
for(i = 0;i < NumSends;i++)
{
- src->Send[i].Gain.Target = WetGain[i];
- if(!src->Send[i].Moving)
+ voice->Send[i].Gain.Target = WetGain[i];
+ if(!voice->Send[i].Moving)
{
- src->Send[i].Gain.Current = src->Send[i].Gain.Target;
- src->Send[i].Gain.Step = 1.0f;
- src->Send[i].Counter = 0;
- src->Send[i].Moving = AL_TRUE;
+ voice->Send[i].Gain.Current = voice->Send[i].Gain.Target;
+ voice->Send[i].Gain.Step = 1.0f;
+ voice->Send[i].Counter = 0;
+ voice->Send[i].Moving = AL_TRUE;
}
else
{
- ALfloat cur = maxf(src->Send[i].Gain.Current, FLT_EPSILON);
- ALfloat trg = maxf(src->Send[i].Gain.Target, FLT_EPSILON);
+ ALfloat cur = maxf(voice->Send[i].Gain.Current, FLT_EPSILON);
+ ALfloat trg = maxf(voice->Send[i].Gain.Target, FLT_EPSILON);
if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
- src->Send[i].Gain.Step = powf(trg/cur, 1.0f/64.0f);
+ voice->Send[i].Gain.Step = powf(trg/cur, 1.0f/64.0f);
else
- src->Send[i].Gain.Step = 1.0f;
- src->Send[i].Gain.Current = cur;
- src->Send[i].Counter = 64;
+ voice->Send[i].Gain.Step = 1.0f;
+ voice->Send[i].Gain.Current = cur;
+ voice->Send[i].Counter = 64;
}
}
@@ -526,15 +526,15 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
ALfloat lfscale = ALSource->Direct.LFReference / Frequency;
for(c = 0;c < num_channels;c++)
{
- src->Direct.Filters[c].ActiveType = AF_None;
- if(gainhf != 1.0f) src->Direct.Filters[c].ActiveType |= AF_LowPass;
- if(gainlf != 1.0f) src->Direct.Filters[c].ActiveType |= AF_HighPass;
+ voice->Direct.Filters[c].ActiveType = AF_None;
+ if(gainhf != 1.0f) voice->Direct.Filters[c].ActiveType |= AF_LowPass;
+ if(gainlf != 1.0f) voice->Direct.Filters[c].ActiveType |= AF_HighPass;
ALfilterState_setParams(
- &src->Direct.Filters[c].LowPass, ALfilterType_HighShelf, gainhf,
+ &voice->Direct.Filters[c].LowPass, ALfilterType_HighShelf, gainhf,
hfscale, 0.0f
);
ALfilterState_setParams(
- &src->Direct.Filters[c].HighPass, ALfilterType_LowShelf, gainlf,
+ &voice->Direct.Filters[c].HighPass, ALfilterType_LowShelf, gainlf,
lfscale, 0.0f
);
}
@@ -547,22 +547,22 @@ ALvoid CalcNonAttnSourceParams(ALactivesource *src, const ALsource *ALSource, co
ALfloat lfscale = ALSource->Send[i].LFReference / Frequency;
for(c = 0;c < num_channels;c++)
{
- src->Send[i].Filters[c].ActiveType = AF_None;
- if(gainhf != 1.0f) src->Send[i].Filters[c].ActiveType |= AF_LowPass;
- if(gainlf != 1.0f) src->Send[i].Filters[c].ActiveType |= AF_HighPass;
+ voice->Send[i].Filters[c].ActiveType = AF_None;
+ if(gainhf != 1.0f) voice->Send[i].Filters[c].ActiveType |= AF_LowPass;
+ if(gainlf != 1.0f) voice->Send[i].Filters[c].ActiveType |= AF_HighPass;
ALfilterState_setParams(
- &src->Send[i].Filters[c].LowPass, ALfilterType_HighShelf, gainhf,
+ &voice->Send[i].Filters[c].LowPass, ALfilterType_HighShelf, gainhf,
hfscale, 0.0f
);
ALfilterState_setParams(
- &src->Send[i].Filters[c].HighPass, ALfilterType_LowShelf, gainlf,
+ &voice->Send[i].Filters[c].HighPass, ALfilterType_LowShelf, gainlf,
lfscale, 0.0f
);
}
}
}
-ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALCcontext *ALContext)
+ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCcontext *ALContext)
{
ALCdevice *Device = ALContext->Device;
ALfloat Velocity[3],Direction[3],Position[3],SourceToListener[3];
@@ -636,7 +636,7 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
WetGainHFAuto = ALSource->WetGainHFAuto;
RoomRolloffBase = ALSource->RoomRolloffFactor;
- src->Direct.OutBuffer = Device->DryBuffer;
+ voice->Direct.OutBuffer = Device->DryBuffer;
for(i = 0;i < NumSends;i++)
{
ALeffectslot *Slot = ALSource->Send[i].Slot;
@@ -676,9 +676,9 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
}
if(!Slot || Slot->EffectType == AL_EFFECT_NULL)
- src->Send[i].OutBuffer = NULL;
+ voice->Send[i].OutBuffer = NULL;
else
- src->Send[i].OutBuffer = Slot->WetBuffer;
+ voice->Send[i].OutBuffer = Slot->WetBuffer;
}
/* Transform source to listener space (convert to head relative) */
@@ -880,12 +880,12 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
* frequency, and output frequency. */
Pitch = Pitch * ALBuffer->Frequency / Frequency;
if(Pitch > (ALfloat)MAX_PITCH)
- src->Step = MAX_PITCH<<FRACTIONBITS;
+ voice->Step = MAX_PITCH<<FRACTIONBITS;
else
{
- src->Step = fastf2i(Pitch*FRACTIONONE);
- if(src->Step == 0)
- src->Step = 1;
+ voice->Step = fastf2i(Pitch*FRACTIONONE);
+ if(voice->Step == 0)
+ voice->Step = 1;
}
break;
@@ -918,47 +918,47 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
dirfact *= Distance / radius;
/* Check to see if the HRIR is already moving. */
- if(src->Direct.Moving)
+ if(voice->Direct.Moving)
{
/* Calculate the normalized HRTF transition factor (delta). */
- delta = CalcHrtfDelta(src->Direct.Mix.Hrtf.Gain, DryGain,
- src->Direct.Mix.Hrtf.Dir, Position);
+ delta = CalcHrtfDelta(voice->Direct.Mix.Hrtf.Gain, DryGain,
+ voice->Direct.Mix.Hrtf.Dir, Position);
/* If the delta is large enough, get the moving HRIR target
* coefficients, target delays, steppping values, and counter. */
if(delta > 0.001f)
{
ALuint counter = GetMovingHrtfCoeffs(Device->Hrtf,
- ev, az, dirfact, DryGain, delta, src->Direct.Counter,
- src->Direct.Mix.Hrtf.Params[0].Coeffs, src->Direct.Mix.Hrtf.Params[0].Delay,
- src->Direct.Mix.Hrtf.Params[0].CoeffStep, src->Direct.Mix.Hrtf.Params[0].DelayStep
+ ev, az, dirfact, DryGain, delta, voice->Direct.Counter,
+ voice->Direct.Mix.Hrtf.Params[0].Coeffs, voice->Direct.Mix.Hrtf.Params[0].Delay,
+ voice->Direct.Mix.Hrtf.Params[0].CoeffStep, voice->Direct.Mix.Hrtf.Params[0].DelayStep
);
- src->Direct.Counter = counter;
- src->Direct.Mix.Hrtf.Gain = DryGain;
- src->Direct.Mix.Hrtf.Dir[0] = Position[0];
- src->Direct.Mix.Hrtf.Dir[1] = Position[1];
- src->Direct.Mix.Hrtf.Dir[2] = Position[2];
+ voice->Direct.Counter = counter;
+ voice->Direct.Mix.Hrtf.Gain = DryGain;
+ voice->Direct.Mix.Hrtf.Dir[0] = Position[0];
+ voice->Direct.Mix.Hrtf.Dir[1] = Position[1];
+ voice->Direct.Mix.Hrtf.Dir[2] = Position[2];
}
}
else
{
/* Get the initial (static) HRIR coefficients and delays. */
GetLerpedHrtfCoeffs(Device->Hrtf, ev, az, dirfact, DryGain,
- src->Direct.Mix.Hrtf.Params[0].Coeffs,
- src->Direct.Mix.Hrtf.Params[0].Delay);
- src->Direct.Counter = 0;
- src->Direct.Moving = AL_TRUE;
- src->Direct.Mix.Hrtf.Gain = DryGain;
- src->Direct.Mix.Hrtf.Dir[0] = Position[0];
- src->Direct.Mix.Hrtf.Dir[1] = Position[1];
- src->Direct.Mix.Hrtf.Dir[2] = Position[2];
+ voice->Direct.Mix.Hrtf.Params[0].Coeffs,
+ voice->Direct.Mix.Hrtf.Params[0].Delay);
+ voice->Direct.Counter = 0;
+ voice->Direct.Moving = AL_TRUE;
+ voice->Direct.Mix.Hrtf.Gain = DryGain;
+ voice->Direct.Mix.Hrtf.Dir[0] = Position[0];
+ voice->Direct.Mix.Hrtf.Dir[1] = Position[1];
+ voice->Direct.Mix.Hrtf.Dir[2] = Position[2];
}
- src->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
+ voice->Direct.Mix.Hrtf.IrSize = GetHrtfIrSize(Device->Hrtf);
- src->IsHrtf = AL_TRUE;
+ voice->IsHrtf = AL_TRUE;
}
else
{
- MixGains *gains = src->Direct.Mix.Gains[0];
+ MixGains *gains = voice->Direct.Mix.Gains[0];
ALfloat DirGain = 0.0f;
ALfloat AmbientGain;
@@ -991,15 +991,15 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
gains[chan].Target = maxf(gains[chan].Target, AmbientGain);
}
- if(!src->Direct.Moving)
+ if(!voice->Direct.Moving)
{
for(j = 0;j < MaxChannels;j++)
{
gains[j].Current = gains[j].Target;
gains[j].Step = 1.0f;
}
- src->Direct.Counter = 0;
- src->Direct.Moving = AL_TRUE;
+ voice->Direct.Counter = 0;
+ voice->Direct.Moving = AL_TRUE;
}
else
{
@@ -1013,31 +1013,31 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
gains[j].Step = 1.0f;
gains[j].Current = cur;
}
- src->Direct.Counter = 64;
+ voice->Direct.Counter = 64;
}
- src->IsHrtf = AL_FALSE;
+ voice->IsHrtf = AL_FALSE;
}
for(i = 0;i < NumSends;i++)
{
- src->Send[i].Gain.Target = WetGain[i];
- if(!src->Send[i].Moving)
+ voice->Send[i].Gain.Target = WetGain[i];
+ if(!voice->Send[i].Moving)
{
- src->Send[i].Gain.Current = src->Send[i].Gain.Target;
- src->Send[i].Gain.Step = 1.0f;
- src->Send[i].Counter = 0;
- src->Send[i].Moving = AL_TRUE;
+ voice->Send[i].Gain.Current = voice->Send[i].Gain.Target;
+ voice->Send[i].Gain.Step = 1.0f;
+ voice->Send[i].Counter = 0;
+ voice->Send[i].Moving = AL_TRUE;
}
else
{
- ALfloat cur = maxf(src->Send[i].Gain.Current, FLT_EPSILON);
- ALfloat trg = maxf(src->Send[i].Gain.Target, FLT_EPSILON);
+ ALfloat cur = maxf(voice->Send[i].Gain.Current, FLT_EPSILON);
+ ALfloat trg = maxf(voice->Send[i].Gain.Target, FLT_EPSILON);
if(fabs(trg - cur) >= GAIN_SILENCE_THRESHOLD)
- src->Send[i].Gain.Step = powf(trg/cur, 1.0f/64.0f);
+ voice->Send[i].Gain.Step = powf(trg/cur, 1.0f/64.0f);
else
- src->Send[i].Gain.Step = 1.0f;
- src->Send[i].Gain.Current = cur;
- src->Send[i].Counter = 64;
+ voice->Send[i].Gain.Step = 1.0f;
+ voice->Send[i].Gain.Current = cur;
+ voice->Send[i].Counter = 64;
}
}
@@ -1046,15 +1046,15 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
ALfloat gainlf = maxf(0.01f, DryGainLF);
ALfloat hfscale = ALSource->Direct.HFReference / Frequency;
ALfloat lfscale = ALSource->Direct.LFReference / Frequency;
- src->Direct.Filters[0].ActiveType = AF_None;
- if(gainhf != 1.0f) src->Direct.Filters[0].ActiveType |= AF_LowPass;
- if(gainlf != 1.0f) src->Direct.Filters[0].ActiveType |= AF_HighPass;
+ voice->Direct.Filters[0].ActiveType = AF_None;
+ if(gainhf != 1.0f) voice->Direct.Filters[0].ActiveType |= AF_LowPass;
+ if(gainlf != 1.0f) voice->Direct.Filters[0].ActiveType |= AF_HighPass;
ALfilterState_setParams(
- &src->Direct.Filters[0].LowPass, ALfilterType_HighShelf, gainhf,
+ &voice->Direct.Filters[0].LowPass, ALfilterType_HighShelf, gainhf,
hfscale, 0.0f
);
ALfilterState_setParams(
- &src->Direct.Filters[0].HighPass, ALfilterType_LowShelf, gainlf,
+ &voice->Direct.Filters[0].HighPass, ALfilterType_LowShelf, gainlf,
lfscale, 0.0f
);
}
@@ -1064,15 +1064,15 @@ ALvoid CalcSourceParams(ALactivesource *src, const ALsource *ALSource, const ALC
ALfloat gainlf = maxf(0.01f, WetGainLF[i]);
ALfloat hfscale = ALSource->Send[i].HFReference / Frequency;
ALfloat lfscale = ALSource->Send[i].LFReference / Frequency;
- src->Send[i].Filters[0].ActiveType = AF_None;
- if(gainhf != 1.0f) src->Send[i].Filters[0].ActiveType |= AF_LowPass;
- if(gainlf != 1.0f) src->Send[i].Filters[0].ActiveType |= AF_HighPass;
+ voice->Send[i].Filters[0].ActiveType = AF_None;
+ if(gainhf != 1.0f) voice->Send[i].Filters[0].ActiveType |= AF_LowPass;
+ if(gainlf != 1.0f) voice->Send[i].Filters[0].ActiveType |= AF_HighPass;
ALfilterState_setParams(
- &src->Send[i].Filters[0].LowPass, ALfilterType_HighShelf, gainhf,
+ &voice->Send[i].Filters[0].LowPass, ALfilterType_HighShelf, gainhf,
hfscale, 0.0f
);
ALfilterState_setParams(
- &src->Send[i].Filters[0].HighPass, ALfilterType_LowShelf, gainlf,
+ &voice->Send[i].Filters[0].HighPass, ALfilterType_LowShelf, gainlf,
lfscale, 0.0f
);
}
@@ -1140,7 +1140,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
ALuint SamplesToDo;
ALeffectslot **slot, **slot_end;
- ALactivesource *src, *src_end;
+ ALvoice *voice, *voice_end;
ALCcontext *ctx;
FPUCtl oldMode;
ALuint i, c;
@@ -1171,27 +1171,27 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
CalcListenerParams(ctx->Listener);
/* source processing */
- src = ctx->ActiveSources;
- src_end = src + ctx->ActiveSourceCount;
- while(src != src_end)
+ voice = ctx->Voices;
+ voice_end = voice + ctx->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;
goto next;
}
if(!DeferUpdates && (ATOMIC_EXCHANGE(ALenum, &source->NeedsUpdate, AL_FALSE) ||
UpdateSources))
- src->Update(src, source, ctx);
+ voice->Update(voice, source, ctx);
if(source->state != AL_PAUSED)
- MixSource(src, source, device, SamplesToDo);
+ MixSource(voice, source, device, SamplesToDo);
next:
- src++;
+ voice++;
}
/* effect slot processing */
@@ -1295,14 +1295,14 @@ ALvoid aluHandleDisconnect(ALCdevice *device)
Context = ATOMIC_LOAD(&device->ContextList);
while(Context)
{
- ALactivesource *src, *src_end;
+ ALvoice *voice, *voice_end;
- 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;
- src->Source = NULL;
+ ALsource *source = voice->Source;
+ voice->Source = NULL;
if(source && source->state == AL_PLAYING)
{
@@ -1312,9 +1312,9 @@ ALvoid aluHandleDisconnect(ALCdevice *device)
source->position_fraction = 0;
}
- src++;
+ voice++;
}
- Context->ActiveSourceCount = 0;
+ Context->VoiceCount = 0;
Context = Context->next;
}
diff --git a/Alc/mixer.c b/Alc/mixer.c
index e4c7a39e..1cc3fe9d 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -178,7 +178,7 @@ static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter
}
-ALvoid MixSource(ALactivesource *src, ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
+ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
{
MixerFunc Mix;
HrtfMixerFunc HrtfMix;
@@ -201,7 +201,7 @@ ALvoid MixSource(ALactivesource *src, ALsource *Source, ALCdevice *Device, ALuin
DataPosInt = Source->position;
DataPosFrac = Source->position_fraction;
Looping = Source->Looping;
- increment = src->Step;
+ increment = voice->Step;
Resampler = (increment==FRACTIONONE) ? PointResampler : Source->Resampler;
NumChannels = Source->NumChannels;
SampleSize = Source->SampleSize;
@@ -411,7 +411,7 @@ ALvoid MixSource(ALactivesource *src, ALsource *Source, ALCdevice *Device, ALuin
Device->ResampledData, DstBufferSize
);
{
- DirectParams *parms = &src->Direct;
+ DirectParams *parms = &voice->Direct;
const ALfloat *samples;
samples = DoFilters(
@@ -419,18 +419,18 @@ ALvoid MixSource(ALactivesource *src, ALsource *Source, ALCdevice *Device, ALuin
Device->FilteredData, ResampledData, DstBufferSize,
parms->Filters[chan].ActiveType
);
- if(!src->IsHrtf)
+ if(!voice->IsHrtf)
Mix(samples, MaxChannels, parms->OutBuffer, parms->Mix.Gains[chan],
parms->Counter, OutPos, DstBufferSize);
else
- HrtfMix(parms->OutBuffer, samples, parms->Counter, src->Offset,
+ HrtfMix(parms->OutBuffer, samples, parms->Counter, voice->Offset,
OutPos, parms->Mix.Hrtf.IrSize, &parms->Mix.Hrtf.Params[chan],
&parms->Mix.Hrtf.State[chan], DstBufferSize);
}
for(j = 0;j < Device->NumAuxSends;j++)
{
- SendParams *parms = &src->Send[j];
+ SendParams *parms = &voice->Send[j];
const ALfloat *samples;
if(!parms->OutBuffer)
@@ -451,10 +451,10 @@ ALvoid MixSource(ALactivesource *src, ALsource *Source, ALCdevice *Device, ALuin
DataPosFrac &= FRACTIONMASK;
OutPos += DstBufferSize;
- src->Offset += DstBufferSize;
- src->Direct.Counter = maxu(src->Direct.Counter, DstBufferSize) - DstBufferSize;
+ voice->Offset += DstBufferSize;
+ voice->Direct.Counter = maxu(voice->Direct.Counter, DstBufferSize) - DstBufferSize;
for(j = 0;j < Device->NumAuxSends;j++)
- src->Send[j].Counter = maxu(src->Send[j].Counter, DstBufferSize) - DstBufferSize;
+ voice->Send[j].Counter = maxu(voice->Send[j].Counter, DstBufferSize) - DstBufferSize;
/* Handle looping sources */
while(1)
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);