aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-07-21 23:14:48 -0700
committerChris Robinson <[email protected]>2014-07-22 00:20:28 -0700
commit5a339a2a5b12545c105a2a3dcfb1d8e466b0381f (patch)
tree95dab694ebe14d41e3e775dc651d07ee26cbe44a /OpenAL32
parent7b41ed7ec4bfb7e8ac3daef3eebc6831b96a8fa4 (diff)
Add macros for generic atomic functionality
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h2
-rw-r--r--OpenAL32/Include/alSource.h2
-rw-r--r--OpenAL32/alAuxEffectSlot.c4
-rw-r--r--OpenAL32/alListener.c10
-rw-r--r--OpenAL32/alSource.c54
-rw-r--r--OpenAL32/alState.c16
6 files changed, 44 insertions, 44 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index ba39405e..a444610f 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -748,7 +748,7 @@ struct ALCcontext_struct
volatile ALenum LastError;
- volatile ALenum UpdateSources;
+ ATOMIC(ALenum) UpdateSources;
volatile enum DistanceModel DistanceModel;
volatile ALboolean SourceDistanceModel;
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index e362f096..4b2ffe0b 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -124,7 +124,7 @@ typedef struct ALsource {
} Send[MAX_SENDS];
/** Source needs to update its mixing parameters. */
- volatile ALenum NeedsUpdate;
+ ATOMIC(ALenum) NeedsUpdate;
/** Self ID */
ALuint id;
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 08fa5a86..0eb79aec 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -183,7 +183,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
err = InitializeEffect(device, slot, effect);
if(err != AL_NO_ERROR)
SET_ERROR_AND_GOTO(context, err, done);
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
@@ -191,7 +191,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
slot->AuxSendAuto = value;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
break;
default:
diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c
index 87cd3c61..b98ea7c2 100644
--- a/OpenAL32/alListener.c
+++ b/OpenAL32/alListener.c
@@ -40,7 +40,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
context->Listener->Gain = value;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
break;
case AL_METERS_PER_UNIT:
@@ -48,7 +48,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
context->Listener->MetersPerUnit = value;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
break;
default:
@@ -77,7 +77,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val
context->Listener->Position[0] = value1;
context->Listener->Position[1] = value2;
context->Listener->Position[2] = value3;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
UnlockContext(context);
break;
@@ -89,7 +89,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val
context->Listener->Velocity[0] = value1;
context->Listener->Velocity[1] = value2;
context->Listener->Velocity[2] = value3;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
UnlockContext(context);
break;
@@ -142,7 +142,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values)
context->Listener->Up[0] = values[3];
context->Listener->Up[1] = values[4];
context->Listener->Up[2] = values[5];
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
UnlockContext(context);
break;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 9f6c6a8b..a0a7e504 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -375,98 +375,98 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SrcFloatProp
CHECKVAL(*values >= 0.0f);
Source->Pitch = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_CONE_INNER_ANGLE:
CHECKVAL(*values >= 0.0f && *values <= 360.0f);
Source->InnerAngle = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_CONE_OUTER_ANGLE:
CHECKVAL(*values >= 0.0f && *values <= 360.0f);
Source->OuterAngle = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_GAIN:
CHECKVAL(*values >= 0.0f);
Source->Gain = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_MAX_DISTANCE:
CHECKVAL(*values >= 0.0f);
Source->MaxDistance = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_ROLLOFF_FACTOR:
CHECKVAL(*values >= 0.0f);
Source->RollOffFactor = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_REFERENCE_DISTANCE:
CHECKVAL(*values >= 0.0f);
Source->RefDistance = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_MIN_GAIN:
CHECKVAL(*values >= 0.0f && *values <= 1.0f);
Source->MinGain = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_MAX_GAIN:
CHECKVAL(*values >= 0.0f && *values <= 1.0f);
Source->MaxGain = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_CONE_OUTER_GAIN:
CHECKVAL(*values >= 0.0f && *values <= 1.0f);
Source->OuterGain = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_CONE_OUTER_GAINHF:
CHECKVAL(*values >= 0.0f && *values <= 1.0f);
Source->OuterGainHF = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_AIR_ABSORPTION_FACTOR:
CHECKVAL(*values >= 0.0f && *values <= 10.0f);
Source->AirAbsorptionFactor = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_ROOM_ROLLOFF_FACTOR:
CHECKVAL(*values >= 0.0f && *values <= 10.0f);
Source->RoomRolloffFactor = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_DOPPLER_FACTOR:
CHECKVAL(*values >= 0.0f && *values <= 1.0f);
Source->DopplerFactor = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_SEC_OFFSET:
@@ -505,7 +505,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SrcFloatProp
Source->Position[1] = values[1];
Source->Position[2] = values[2];
UnlockContext(Context);
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_VELOCITY:
@@ -516,7 +516,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SrcFloatProp
Source->Velocity[1] = values[1];
Source->Velocity[2] = values[2];
UnlockContext(Context);
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_DIRECTION:
@@ -527,7 +527,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SrcFloatProp
Source->Orientation[1] = values[1];
Source->Orientation[2] = values[2];
UnlockContext(Context);
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
@@ -574,7 +574,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
CHECKVAL(*values == AL_FALSE || *values == AL_TRUE);
Source->HeadRelative = (ALboolean)*values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_LOOPING:
@@ -692,35 +692,35 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
Source->Direct.LFReference = filter->LFReference;
}
UnlockContext(Context);
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_DIRECT_FILTER_GAINHF_AUTO:
CHECKVAL(*values == AL_FALSE || *values == AL_TRUE);
Source->DryGainHFAuto = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO:
CHECKVAL(*values == AL_FALSE || *values == AL_TRUE);
Source->WetGainAuto = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO:
CHECKVAL(*values == AL_FALSE || *values == AL_TRUE);
Source->WetGainHFAuto = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_DIRECT_CHANNELS_SOFT:
CHECKVAL(*values == AL_FALSE || *values == AL_TRUE);
Source->DirectChannels = *values;
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
case AL_DISTANCE_MODEL:
@@ -734,7 +734,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
Source->DistanceModel = *values;
if(Context->SourceDistanceModel)
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
@@ -770,8 +770,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SrcIntProp p
Source->Send[values[1]].GainLF = filter->GainLF;
Source->Send[values[1]].LFReference = filter->LFReference;
}
- Source->NeedsUpdate = AL_TRUE;
UnlockContext(Context);
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
return AL_TRUE;
@@ -2435,7 +2435,7 @@ static ALvoid InitSourceParams(ALsource *Source)
Source->Send[i].LFReference = HIGHPASSFREQREF;
}
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE_UNSAFE(Source->NeedsUpdate, AL_TRUE);
}
@@ -2530,7 +2530,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
src->Send[i].Moving = AL_FALSE;
}
}
- Source->NeedsUpdate = AL_TRUE;
+ ATOMIC_STORE(Source->NeedsUpdate, AL_TRUE);
}
else if(state == AL_PAUSED)
{
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index d499fcd1..59619b0d 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -56,7 +56,7 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
{
case AL_SOURCE_DISTANCE_MODEL:
context->SourceDistanceModel = AL_TRUE;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
break;
default:
@@ -78,7 +78,7 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability)
{
case AL_SOURCE_DISTANCE_MODEL:
context->SourceDistanceModel = AL_FALSE;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
break;
default:
@@ -643,7 +643,7 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
context->DopplerFactor = value;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
done:
ALCcontext_DecRef(context);
@@ -660,7 +660,7 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
context->DopplerVelocity = value;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
done:
ALCcontext_DecRef(context);
@@ -677,7 +677,7 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value)
SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done);
context->SpeedOfSound = value;
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
done:
ALCcontext_DecRef(context);
@@ -698,7 +698,7 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
context->DistanceModel = value;
if(!context->SourceDistanceModel)
- context->UpdateSources = AL_TRUE;
+ ATOMIC_STORE(context->UpdateSources, AL_TRUE);
done:
ALCcontext_DecRef(context);
@@ -725,7 +725,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
context->DeferUpdates = AL_TRUE;
/* Make sure all pending updates are performed */
- UpdateSources = ExchangeInt(&context->UpdateSources, AL_FALSE);
+ UpdateSources = ATOMIC_EXCHANGE(ALenum, context->UpdateSources, AL_FALSE);
src = context->ActiveSources;
src_end = src + context->ActiveSourceCount;
@@ -742,7 +742,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
continue;
}
- if(ExchangeInt(&source->NeedsUpdate, AL_FALSE) || UpdateSources)
+ if(ATOMIC_EXCHANGE(ALenum, source->NeedsUpdate, AL_FALSE) || UpdateSources)
(*src)->Update(*src, context);
src++;