aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-08-23 19:17:17 -0700
committerChris Robinson <[email protected]>2016-08-23 19:17:17 -0700
commitc7eb0b7393231a137c31f75e0654214a08bc51a9 (patch)
tree478977dfab7d734ec68c8a35520ed2c4d3ab32fa /OpenAL32
parentdc8b7814c771d08abe61656b745e7763a010a3a3 (diff)
Don't pass the context's distance model as the source's
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alListener.h5
-rw-r--r--OpenAL32/alListener.c3
-rw-r--r--OpenAL32/alSource.c17
-rw-r--r--OpenAL32/alState.c6
4 files changed, 18 insertions, 13 deletions
diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h
index a10d6728..b89a00e7 100644
--- a/OpenAL32/Include/alListener.h
+++ b/OpenAL32/Include/alListener.h
@@ -19,6 +19,8 @@ struct ALlistenerProps {
ATOMIC(ALfloat) DopplerFactor;
ATOMIC(ALfloat) DopplerVelocity;
ATOMIC(ALfloat) SpeedOfSound;
+ ATOMIC(ALboolean) SourceDistanceModel;
+ ATOMIC(enum DistanceModel) DistanceModel;
ATOMIC(struct ALlistenerProps*) next;
};
@@ -49,6 +51,9 @@ typedef struct ALlistener {
ALfloat DopplerFactor;
ALfloat SpeedOfSound;
+
+ ALboolean SourceDistanceModel;
+ enum DistanceModel DistanceModel;
} Params;
} ALlistener;
diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c
index 3ea23732..08ece19d 100644
--- a/OpenAL32/alListener.c
+++ b/OpenAL32/alListener.c
@@ -496,6 +496,9 @@ void UpdateListenerProps(ALCcontext *context)
ATOMIC_STORE(&props->DopplerVelocity, context->DopplerVelocity, almemory_order_relaxed);
ATOMIC_STORE(&props->SpeedOfSound, context->SpeedOfSound, almemory_order_relaxed);
+ ATOMIC_STORE(&props->SourceDistanceModel, context->SourceDistanceModel, almemory_order_relaxed);
+ ATOMIC_STORE(&props->DistanceModel, context->DistanceModel, almemory_order_relaxed);
+
/* Set the new container for updating internal parameters. */
props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &listener->Update, props, almemory_order_acq_rel);
if(props)
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index fb2ada10..891286a2 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -49,7 +49,7 @@ extern inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id);
static void InitSourceParams(ALsource *Source);
static void DeinitSource(ALsource *source);
-static void UpdateSourceProps(ALsource *source, ALuint num_sends, ALCcontext *context);
+static void UpdateSourceProps(ALsource *source, ALuint num_sends);
static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime);
static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime);
static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device);
@@ -386,7 +386,7 @@ static ALint Int64ValsByProp(ALenum prop)
#define DO_UPDATEPROPS() do { \
if(SourceShouldUpdate(Source, Context)) \
- UpdateSourceProps(Source, device->NumAuxSends, Context); \
+ UpdateSourceProps(Source, device->NumAuxSends); \
} while(0)
static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values)
@@ -840,7 +840,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
/* We must force an update if the auxiliary slot changed on a
* playing source, in case the slot is about to be deleted.
*/
- UpdateSourceProps(Source, device->NumAuxSends, Context);
+ UpdateSourceProps(Source, device->NumAuxSends);
}
else
{
@@ -2813,7 +2813,7 @@ static void DeinitSource(ALsource *source)
}
}
-static void UpdateSourceProps(ALsource *source, ALuint num_sends, ALCcontext *context)
+static void UpdateSourceProps(ALsource *source, ALuint num_sends)
{
struct ALsourceProps *props;
size_t i;
@@ -2857,10 +2857,7 @@ static void UpdateSourceProps(ALsource *source, ALuint num_sends, ALCcontext *co
almemory_order_relaxed);
}
ATOMIC_STORE(&props->HeadRelative, source->HeadRelative, almemory_order_relaxed);
- ATOMIC_STORE(&props->DistanceModel,
- context->SourceDistanceModel ? source->DistanceModel : context->DistanceModel,
- almemory_order_relaxed
- );
+ ATOMIC_STORE(&props->DistanceModel, source->DistanceModel, almemory_order_relaxed);
ATOMIC_STORE(&props->DirectChannels, source->DirectChannels, almemory_order_relaxed);
ATOMIC_STORE(&props->DryGainHFAuto, source->DryGainHFAuto, almemory_order_relaxed);
@@ -2928,7 +2925,7 @@ void UpdateAllSourceProps(ALCcontext *context)
ALsource *source = voice->Source;
if(source != NULL && (source->state == AL_PLAYING ||
source->state == AL_PAUSED))
- UpdateSourceProps(source, num_sends, context);
+ UpdateSourceProps(source, num_sends);
}
/* Now with all updates declared, let the mixer continue applying them so
* they all happen at once.
@@ -3037,7 +3034,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
}
}
- UpdateSourceProps(Source, device->NumAuxSends, Context);
+ UpdateSourceProps(Source, device->NumAuxSends);
}
else if(state == AL_PAUSED)
{
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 59814a4b..fa3b190a 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -63,7 +63,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
- UpdateAllSourceProps(context);
+ UpdateListenerProps(context);
done:
WriteUnlock(&context->PropLock);
@@ -88,7 +88,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done);
}
if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
- UpdateAllSourceProps(context);
+ UpdateListenerProps(context);
done:
WriteUnlock(&context->PropLock);
@@ -622,7 +622,7 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
if(!context->SourceDistanceModel)
{
if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
- UpdateAllSourceProps(context);
+ UpdateListenerProps(context);
}
WriteUnlock(&context->PropLock);