diff options
author | Chris Robinson <[email protected]> | 2018-11-17 23:41:11 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-17 23:41:11 -0800 |
commit | 38d6df9c1d10ac74af3454c67147dd21bb0a7bb8 (patch) | |
tree | feb4277bb655062c9fc2df25f83d58fa7170fb98 | |
parent | e79d9bdd1a6aa6d6d9852bf5a380a8cd01cbc315 (diff) |
Store the listener directly in the context
-rw-r--r-- | Alc/alc.cpp | 68 | ||||
-rw-r--r-- | Alc/alcontext.h | 8 | ||||
-rw-r--r-- | Alc/alu.cpp | 68 | ||||
-rw-r--r-- | Alc/effects/reverb.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alListener.h | 2 | ||||
-rw-r--r-- | OpenAL32/alListener.cpp | 58 |
6 files changed, 104 insertions, 104 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index daa0818d..7b55f120 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1623,7 +1623,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) if(!ATOMIC_EXCHANGE(&context->PropsClean, AL_TRUE, almemory_order_acq_rel)) UpdateContextProps(context); - if(!ATOMIC_EXCHANGE(&context->Listener->PropsClean, AL_TRUE, almemory_order_acq_rel)) + if(!ATOMIC_EXCHANGE(&context->Listener.PropsClean, AL_TRUE, almemory_order_acq_rel)) UpdateListenerProps(context); UpdateAllEffectSlotProps(context); UpdateAllSourceProps(context); @@ -2368,7 +2368,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ATOMIC_STORE(&context->PropsClean, AL_TRUE, almemory_order_release); UpdateContextProps(context); - ATOMIC_STORE(&context->Listener->PropsClean, AL_TRUE, almemory_order_release); + ATOMIC_STORE(&context->Listener.PropsClean, AL_TRUE, almemory_order_release); UpdateListenerProps(context); UpdateAllSourceProps(context); almtx_unlock(&context->PropLock); @@ -2585,26 +2585,26 @@ static ALCboolean VerifyDevice(ALCdevice **device) */ static ALvoid InitContext(ALCcontext *Context) { - ALlistener *listener = Context->Listener; + ALlistener &listener = Context->Listener; struct ALeffectslotArray *auxslots; //Initialise listener - listener->Gain = 1.0f; - listener->Position[0] = 0.0f; - listener->Position[1] = 0.0f; - listener->Position[2] = 0.0f; - listener->Velocity[0] = 0.0f; - listener->Velocity[1] = 0.0f; - listener->Velocity[2] = 0.0f; - listener->Forward[0] = 0.0f; - listener->Forward[1] = 0.0f; - listener->Forward[2] = -1.0f; - listener->Up[0] = 0.0f; - listener->Up[1] = 1.0f; - listener->Up[2] = 0.0f; - ATOMIC_INIT(&listener->PropsClean, AL_TRUE); - - ATOMIC_INIT(&listener->Update, static_cast<ALlistenerProps*>(nullptr)); + listener.Gain = 1.0f; + listener.Position[0] = 0.0f; + listener.Position[1] = 0.0f; + listener.Position[2] = 0.0f; + listener.Velocity[0] = 0.0f; + listener.Velocity[1] = 0.0f; + listener.Velocity[2] = 0.0f; + listener.Forward[0] = 0.0f; + listener.Forward[1] = 0.0f; + listener.Forward[2] = -1.0f; + listener.Up[0] = 0.0f; + listener.Up[1] = 1.0f; + listener.Up[2] = 0.0f; + ATOMIC_INIT(&listener.PropsClean, AL_TRUE); + + ATOMIC_INIT(&listener.Update, static_cast<ALlistenerProps*>(nullptr)); //Validate Context InitRef(&Context->UpdateCount, 0); @@ -2658,16 +2658,16 @@ static ALvoid InitContext(ALCcontext *Context) Context->ExtensionList = alExtList; - listener->Params.Matrix = aluMatrixf::Identity; - aluVectorSet(&listener->Params.Velocity, 0.0f, 0.0f, 0.0f, 0.0f); - listener->Params.Gain = listener->Gain; - listener->Params.MetersPerUnit = Context->MetersPerUnit; - listener->Params.DopplerFactor = Context->DopplerFactor; - listener->Params.SpeedOfSound = Context->SpeedOfSound * Context->DopplerVelocity; - listener->Params.ReverbSpeedOfSound = listener->Params.SpeedOfSound * - listener->Params.MetersPerUnit; - listener->Params.SourceDistanceModel = Context->SourceDistanceModel; - listener->Params.DistanceModel = Context->DistanceModel; + listener.Params.Matrix = aluMatrixf::Identity; + aluVectorSet(&listener.Params.Velocity, 0.0f, 0.0f, 0.0f, 0.0f); + listener.Params.Gain = listener.Gain; + listener.Params.MetersPerUnit = Context->MetersPerUnit; + listener.Params.DopplerFactor = Context->DopplerFactor; + listener.Params.SpeedOfSound = Context->SpeedOfSound * Context->DopplerVelocity; + listener.Params.ReverbSpeedOfSound = listener.Params.SpeedOfSound * + listener.Params.MetersPerUnit; + listener.Params.SourceDistanceModel = Context->SourceDistanceModel; + listener.Params.DistanceModel = Context->DistanceModel; Context->AsyncEvents = ll_ringbuffer_create(63, sizeof(AsyncEvent), false); @@ -2683,7 +2683,7 @@ static ALvoid InitContext(ALCcontext *Context) */ static void FreeContext(ALCcontext *context) { - ALlistener *listener = context->Listener; + ALlistener &listener = context->Listener; struct ALeffectslotProps *eprops; struct ALlistenerProps *lprops; struct ALcontextProps *cprops; @@ -2764,7 +2764,7 @@ static void FreeContext(ALCcontext *context) context->VoiceCount = 0; context->MaxVoices = 0; - if((lprops=ATOMIC_LOAD(&listener->Update, almemory_order_acquire)) != nullptr) + if((lprops=ATOMIC_LOAD(&listener.Update, almemory_order_acquire)) != nullptr) { TRACE("Freed unapplied listener update %p\n", lprops); al_free(lprops); @@ -3806,7 +3806,6 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin } InitRef(&ALContext->ref, 1); - ALContext->Listener = (ALlistener*)ALContext->_listener_mem; ALContext->DefaultSlot = nullptr; ALContext->Voices = nullptr; @@ -3835,9 +3834,10 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin } AllocateVoices(ALContext, 256, device->NumAuxSends); - if(DefaultEffect.type != AL_EFFECT_NULL && device->Type == Playback) + // FIXME: Reenable after the default effect slot is handled again + if(0 && DefaultEffect.type != AL_EFFECT_NULL && device->Type == Playback) { - ALContext->DefaultSlot = (ALeffectslot*)(ALContext->_listener_mem + sizeof(ALlistener)); + ALContext->DefaultSlot = nullptr; if(InitEffectSlot(ALContext->DefaultSlot) == AL_NO_ERROR) aluInitEffectPanning(ALContext->DefaultSlot); else diff --git a/Alc/alcontext.h b/Alc/alcontext.h index 9ef2db3b..16a5e909 100644 --- a/Alc/alcontext.h +++ b/Alc/alcontext.h @@ -10,8 +10,9 @@ #include "vector.h" #include "threads.h" +#include "alListener.h" + -struct ALlistener; struct ALsource; struct ALeffectslot; struct ALcontextProps; @@ -49,8 +50,6 @@ TYPEDEF_VECTOR(ALeffectslotPtr, vector_ALeffectslotPtr) struct ALCcontext_struct { RefCount ref; - ALlistener *Listener; - vector_SourceSubList SourceList; ALuint NumSources; almtx_t SourceLock; @@ -113,8 +112,7 @@ struct ALCcontext_struct { ATOMIC(ALCcontext*) next; - /* Memory space used by the listener (and possibly default effect slot) */ - alignas(16) ALCbyte _listener_mem[]; + ALlistener Listener; }; ALCcontext *GetContextRef(void); diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 2a6dcfe0..91d9e758 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -312,23 +312,23 @@ void BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *t static bool CalcContextParams(ALCcontext *Context) { - ALlistener *Listener = Context->Listener; + ALlistener &Listener = Context->Listener; struct ALcontextProps *props; props = static_cast<ALcontextProps*>(ATOMIC_EXCHANGE_PTR(&Context->Update, static_cast<ALcontextProps*>(nullptr), almemory_order_acq_rel)); if(!props) return false; - Listener->Params.MetersPerUnit = props->MetersPerUnit; + Listener.Params.MetersPerUnit = props->MetersPerUnit; - Listener->Params.DopplerFactor = props->DopplerFactor; - Listener->Params.SpeedOfSound = props->SpeedOfSound * props->DopplerVelocity; + Listener.Params.DopplerFactor = props->DopplerFactor; + Listener.Params.SpeedOfSound = props->SpeedOfSound * props->DopplerVelocity; if(!OverrideReverbSpeedOfSound) - Listener->Params.ReverbSpeedOfSound = Listener->Params.SpeedOfSound * - Listener->Params.MetersPerUnit; + Listener.Params.ReverbSpeedOfSound = Listener.Params.SpeedOfSound * + Listener.Params.MetersPerUnit; - Listener->Params.SourceDistanceModel = props->SourceDistanceModel; - Listener->Params.DistanceModel = props->DistanceModel; + Listener.Params.SourceDistanceModel = props->SourceDistanceModel; + Listener.Params.DistanceModel = props->DistanceModel; ATOMIC_REPLACE_HEAD(struct ALcontextProps*, &Context->FreeContextProps, props); return true; @@ -336,12 +336,12 @@ static bool CalcContextParams(ALCcontext *Context) static bool CalcListenerParams(ALCcontext *Context) { - ALlistener *Listener = Context->Listener; + ALlistener &Listener = Context->Listener; ALfloat N[3], V[3], U[3], P[3]; struct ALlistenerProps *props; aluVector vel; - props = static_cast<ALlistenerProps*>(ATOMIC_EXCHANGE_PTR(&Listener->Update, + props = static_cast<ALlistenerProps*>(ATOMIC_EXCHANGE_PTR(&Listener.Update, static_cast<ALlistenerProps*>(nullptr), almemory_order_acq_rel)); if(!props) return false; @@ -358,7 +358,7 @@ static bool CalcListenerParams(ALCcontext *Context) aluCrossproduct(N, V, U); aluNormalize(U); - aluMatrixfSet(&Listener->Params.Matrix, + aluMatrixfSet(&Listener.Params.Matrix, U[0], V[0], -N[0], 0.0, U[1], V[1], -N[1], 0.0, U[2], V[2], -N[2], 0.0, @@ -368,13 +368,13 @@ static bool CalcListenerParams(ALCcontext *Context) P[0] = props->Position[0]; P[1] = props->Position[1]; P[2] = props->Position[2]; - aluMatrixfFloat3(P, 1.0, &Listener->Params.Matrix); - aluMatrixfSetRow(&Listener->Params.Matrix, 3, -P[0], -P[1], -P[2], 1.0f); + aluMatrixfFloat3(P, 1.0, &Listener.Params.Matrix); + aluMatrixfSetRow(&Listener.Params.Matrix, 3, -P[0], -P[1], -P[2], 1.0f); aluVectorSet(&vel, props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f); - Listener->Params.Velocity = aluMatrixfVector(&Listener->Params.Matrix, &vel); + Listener.Params.Velocity = aluMatrixfVector(&Listener.Params.Matrix, &vel); - Listener->Params.Gain = props->Gain * Context->GainBoost; + Listener.Params.Gain = props->Gain * Context->GainBoost; ATOMIC_REPLACE_HEAD(struct ALlistenerProps*, &Context->FreeListenerProps, props); return true; @@ -501,7 +501,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo const ALfloat DryGainLF, const ALfloat *WetGain, const ALfloat *WetGainLF, const ALfloat *WetGainHF, ALeffectslot **SendSlots, const ALbuffer *Buffer, - const struct ALvoiceProps *props, const ALlistener *Listener, + const struct ALvoiceProps *props, const ALlistener &Listener, const ALCdevice *Device) { struct ChanMap StereoMap[2] = { @@ -609,7 +609,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo if(Device->AvgSpeakerDist > 0.0f) { - ALfloat mdist = Distance * Listener->Params.MetersPerUnit; + ALfloat mdist = Distance * Listener.Params.MetersPerUnit; ALfloat w0 = SPEEDOFSOUNDMETRESPERSEC / (mdist * (ALfloat)Device->Frequency); ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / @@ -680,7 +680,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo aluNormalize(V); if(!props->HeadRelative) { - const aluMatrixf *lmatrix = &Listener->Params.Matrix; + const aluMatrixf *lmatrix = &Listener.Params.Matrix; aluMatrixfFloat3(N, 0.0f, lmatrix); aluMatrixfFloat3(V, 0.0f, lmatrix); } @@ -852,7 +852,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo /* Calculate NFC filter coefficient if needed. */ if(Device->AvgSpeakerDist > 0.0f) { - ALfloat mdist = Distance * Listener->Params.MetersPerUnit; + ALfloat mdist = Distance * Listener.Params.MetersPerUnit; ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); w0 = SPEEDOFSOUNDMETRESPERSEC / @@ -1022,7 +1022,7 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALflo static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) { const ALCdevice *Device = ALContext->Device; - const ALlistener *Listener = ALContext->Listener; + const ALlistener &Listener = ALContext->Listener; ALfloat DryGain, DryGainHF, DryGainLF; ALfloat WetGain[MAX_SENDS]; ALfloat WetGainHF[MAX_SENDS]; @@ -1065,14 +1065,14 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *p /* Calculate gains */ DryGain = clampf(props->Gain, props->MinGain, props->MaxGain); - DryGain *= props->Direct.Gain * Listener->Params.Gain; + DryGain *= props->Direct.Gain * Listener.Params.Gain; DryGain = minf(DryGain, GAIN_MIX_MAX); DryGainHF = props->Direct.GainHF; DryGainLF = props->Direct.GainLF; for(i = 0;i < Device->NumAuxSends;i++) { WetGain[i] = clampf(props->Gain, props->MinGain, props->MaxGain); - WetGain[i] *= props->Send[i].Gain * Listener->Params.Gain; + WetGain[i] *= props->Send[i].Gain * Listener.Params.Gain; WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); WetGainHF[i] = props->Send[i].GainHF; WetGainLF[i] = props->Send[i].GainLF; @@ -1085,7 +1085,7 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *p static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) { const ALCdevice *Device = ALContext->Device; - const ALlistener *Listener = ALContext->Listener; + const ALlistener &Listener = ALContext->Listener; const ALsizei NumSends = Device->NumAuxSends; aluVector Position, Velocity, Direction, SourceToListener; ALfloat Distance, ClampedDist, DopplerFactor; @@ -1127,7 +1127,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop * -60dB. */ DecayDistance[i] = SendSlots[i]->Params.DecayTime * - Listener->Params.ReverbSpeedOfSound; + Listener.Params.ReverbSpeedOfSound; DecayLFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayLFRatio; DecayHFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayHFRatio; if(SendSlots[i]->Params.DecayHFLimit) @@ -1173,7 +1173,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop aluVectorSet(&Velocity, props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f); if(props->HeadRelative == AL_FALSE) { - const aluMatrixf *Matrix = &Listener->Params.Matrix; + const aluMatrixf *Matrix = &Listener.Params.Matrix; /* Transform source vectors */ Position = aluMatrixfVector(Matrix, &Position); Velocity = aluMatrixfVector(Matrix, &Velocity); @@ -1181,7 +1181,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop } else { - const aluVector *lvelocity = &Listener->Params.Velocity; + const aluVector *lvelocity = &Listener.Params.Velocity; /* Offset the source velocity to be relative of the listener velocity */ Velocity.v[0] += lvelocity->v[0]; Velocity.v[1] += lvelocity->v[1]; @@ -1209,8 +1209,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop /* Calculate distance attenuation */ ClampedDist = Distance; - switch(Listener->Params.SourceDistanceModel ? - props->DistanceModel : Listener->Params.DistanceModel) + switch(Listener.Params.SourceDistanceModel ? + props->DistanceModel : Listener.Params.DistanceModel) { case DistanceModel::InverseClamped: ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); @@ -1319,13 +1319,13 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop /* Apply gain and frequency filters */ DryGain = clampf(DryGain, props->MinGain, props->MaxGain); - DryGain = minf(DryGain*props->Direct.Gain*Listener->Params.Gain, GAIN_MIX_MAX); + DryGain = minf(DryGain*props->Direct.Gain*Listener.Params.Gain, GAIN_MIX_MAX); DryGainHF *= props->Direct.GainHF; DryGainLF *= props->Direct.GainLF; for(i = 0;i < NumSends;i++) { WetGain[i] = clampf(WetGain[i], props->MinGain, props->MaxGain); - WetGain[i] = minf(WetGain[i]*props->Send[i].Gain*Listener->Params.Gain, GAIN_MIX_MAX); + WetGain[i] = minf(WetGain[i]*props->Send[i].Gain*Listener.Params.Gain, GAIN_MIX_MAX); WetGainHF[i] *= props->Send[i].GainHF; WetGainLF[i] *= props->Send[i].GainLF; } @@ -1334,7 +1334,7 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop if(ClampedDist > props->RefDistance && props->RolloffFactor > 0.0f) { ALfloat meters_base = (ClampedDist-props->RefDistance) * props->RolloffFactor * - Listener->Params.MetersPerUnit; + Listener.Params.MetersPerUnit; if(props->AirAbsorptionFactor > 0.0f) { ALfloat hfattn = powf(AIRABSORBGAINHF, meters_base * props->AirAbsorptionFactor); @@ -1377,11 +1377,11 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop Pitch = props->Pitch; /* Calculate velocity-based doppler effect */ - DopplerFactor = props->DopplerFactor * Listener->Params.DopplerFactor; + DopplerFactor = props->DopplerFactor * Listener.Params.DopplerFactor; if(DopplerFactor > 0.0f) { - const aluVector *lvelocity = &Listener->Params.Velocity; - const ALfloat SpeedOfSound = Listener->Params.SpeedOfSound; + const aluVector *lvelocity = &Listener.Params.Velocity; + const ALfloat SpeedOfSound = Listener.Params.SpeedOfSound; ALfloat vss, vls; vss = aluDotproduct(&Velocity, &SourceToListener) * DopplerFactor; diff --git a/Alc/effects/reverb.cpp b/Alc/effects/reverb.cpp index ebb9b7da..702a8cdd 100644 --- a/Alc/effects/reverb.cpp +++ b/Alc/effects/reverb.cpp @@ -951,7 +951,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection static void ReverbState_update(ReverbState *State, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props) { const ALCdevice *Device = Context->Device; - const ALlistener *Listener = Context->Listener; + const ALlistener &Listener = Context->Listener; ALuint frequency = Device->Frequency; ALfloat lf0norm, hf0norm, hfRatio; ALfloat lfDecayTime, hfDecayTime; @@ -994,7 +994,7 @@ static void ReverbState_update(ReverbState *State, const ALCcontext *Context, co hfRatio = props->Reverb.DecayHFRatio; if(props->Reverb.DecayHFLimit && props->Reverb.AirAbsorptionGainHF < 1.0f) hfRatio = CalcLimitedHfRatio(hfRatio, props->Reverb.AirAbsorptionGainHF, - props->Reverb.DecayTime, Listener->Params.ReverbSpeedOfSound + props->Reverb.DecayTime, Listener.Params.ReverbSpeedOfSound ); /* Calculate the LF/HF decay times. */ diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index ec6ee509..096a747e 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -8,6 +8,8 @@ #include "atomic.h" #include "vecmat.h" +enum class DistanceModel; + struct ALlistenerProps { ALfloat Position[3]; diff --git a/OpenAL32/alListener.cpp b/OpenAL32/alListener.cpp index f2fdf3c1..1be5bf48 100644 --- a/OpenAL32/alListener.cpp +++ b/OpenAL32/alListener.cpp @@ -43,7 +43,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value) context = GetContextRef(); if(!context) return; - listener = context->Listener; + listener = &context->Listener; almtx_lock(&context->PropLock); switch(param) { @@ -82,7 +82,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val context = GetContextRef(); if(!context) return; - listener = context->Listener; + listener = &context->Listener; almtx_lock(&context->PropLock); switch(param) { @@ -138,7 +138,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) context = GetContextRef(); if(!context) return; - listener = context->Listener; + listener = &context->Listener; almtx_lock(&context->PropLock); if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); switch(param) @@ -269,7 +269,7 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) else switch(param) { case AL_GAIN: - *value = context->Listener->Gain; + *value = context->Listener.Gain; break; case AL_METERS_PER_UNIT: @@ -298,15 +298,15 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat else switch(param) { case AL_POSITION: - *value1 = context->Listener->Position[0]; - *value2 = context->Listener->Position[1]; - *value3 = context->Listener->Position[2]; + *value1 = context->Listener.Position[0]; + *value2 = context->Listener.Position[1]; + *value3 = context->Listener.Position[2]; break; case AL_VELOCITY: - *value1 = context->Listener->Velocity[0]; - *value2 = context->Listener->Velocity[1]; - *value3 = context->Listener->Velocity[2]; + *value1 = context->Listener.Velocity[0]; + *value2 = context->Listener.Velocity[1]; + *value3 = context->Listener.Velocity[2]; break; default: @@ -345,12 +345,12 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) { case AL_ORIENTATION: // AT then UP - values[0] = context->Listener->Forward[0]; - values[1] = context->Listener->Forward[1]; - values[2] = context->Listener->Forward[2]; - values[3] = context->Listener->Up[0]; - values[4] = context->Listener->Up[1]; - values[5] = context->Listener->Up[2]; + values[0] = context->Listener.Forward[0]; + values[1] = context->Listener.Forward[1]; + values[2] = context->Listener.Forward[2]; + values[3] = context->Listener.Up[0]; + values[4] = context->Listener.Up[1]; + values[5] = context->Listener.Up[2]; break; default: @@ -396,15 +396,15 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu else switch(param) { case AL_POSITION: - *value1 = (ALint)context->Listener->Position[0]; - *value2 = (ALint)context->Listener->Position[1]; - *value3 = (ALint)context->Listener->Position[2]; + *value1 = (ALint)context->Listener.Position[0]; + *value2 = (ALint)context->Listener.Position[1]; + *value3 = (ALint)context->Listener.Position[2]; break; case AL_VELOCITY: - *value1 = (ALint)context->Listener->Velocity[0]; - *value2 = (ALint)context->Listener->Velocity[1]; - *value3 = (ALint)context->Listener->Velocity[2]; + *value1 = (ALint)context->Listener.Velocity[0]; + *value2 = (ALint)context->Listener.Velocity[1]; + *value3 = (ALint)context->Listener.Velocity[2]; break; default: @@ -438,12 +438,12 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) { case AL_ORIENTATION: // AT then UP - values[0] = (ALint)context->Listener->Forward[0]; - values[1] = (ALint)context->Listener->Forward[1]; - values[2] = (ALint)context->Listener->Forward[2]; - values[3] = (ALint)context->Listener->Up[0]; - values[4] = (ALint)context->Listener->Up[1]; - values[5] = (ALint)context->Listener->Up[2]; + values[0] = (ALint)context->Listener.Forward[0]; + values[1] = (ALint)context->Listener.Forward[1]; + values[2] = (ALint)context->Listener.Forward[2]; + values[3] = (ALint)context->Listener.Up[0]; + values[4] = (ALint)context->Listener.Up[1]; + values[5] = (ALint)context->Listener.Up[2]; break; default: @@ -457,7 +457,7 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) void UpdateListenerProps(ALCcontext *context) { - ALlistener *listener = context->Listener; + ALlistener *listener{&context->Listener}; struct ALlistenerProps *props; /* Get an unused proprty container, or allocate a new one as needed. */ |