From ccd8cbc2a944a0822d1277b1524d05455564b0e5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 11 Sep 2011 01:26:09 -0700 Subject: Make some listener properties volatile --- Alc/ALu.c | 16 +++++++++++----- OpenAL32/Include/alListener.h | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 052a415a..3c80b7bc 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -378,9 +378,11 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) Frequency = Device->Frequency; //Get listener properties - ListenerGain = ALContext->Listener.Gain; - MetersPerUnit = ALContext->Listener.MetersPerUnit; - memcpy(ListenerVel, ALContext->Listener.Velocity, sizeof(ALContext->Listener.Velocity)); + ListenerGain = ALContext->Listener.Gain; + MetersPerUnit = ALContext->Listener.MetersPerUnit; + ListenerVel[0] = ALContext->Listener.Velocity[0]; + ListenerVel[1] = ALContext->Listener.Velocity[1]; + ListenerVel[2] = ALContext->Listener.Velocity[2]; //Get source properties SourceVolume = ALSource->flGain; @@ -452,9 +454,13 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext) ALfloat Matrix[4][4]; // Build transform matrix - memcpy(N, ALContext->Listener.Forward, sizeof(N)); // At-vector + N[0] = ALContext->Listener.Forward[0]; // At-vector + N[1] = ALContext->Listener.Forward[1]; + N[2] = ALContext->Listener.Forward[2]; aluNormalize(N); // Normalized At-vector - memcpy(V, ALContext->Listener.Up, sizeof(V)); // Up-vector + V[0] = ALContext->Listener.Up[0]; // Up-vector + V[1] = ALContext->Listener.Up[1]; + V[2] = ALContext->Listener.Up[2]; aluNormalize(V); // Normalized Up-vector aluCrossproduct(N, V, U); // Right-vector aluNormalize(U); // Normalized Right-vector diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index 2bda3197..0f399e5f 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -9,10 +9,10 @@ extern "C" { typedef struct ALlistener_struct { - ALfloat Position[3]; - ALfloat Velocity[3]; - ALfloat Forward[3]; - ALfloat Up[3]; + volatile ALfloat Position[3]; + volatile ALfloat Velocity[3]; + volatile ALfloat Forward[3]; + volatile ALfloat Up[3]; volatile ALfloat Gain; volatile ALfloat MetersPerUnit; } ALlistener; -- cgit v1.2.3