aboutsummaryrefslogtreecommitdiffstats
path: root/al/state.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-05-08 16:02:36 -0700
committerChris Robinson <[email protected]>2023-05-08 16:28:19 -0700
commitd4cef1994324efed7040e5cb2bca82a33888a35f (patch)
tree2855c5873144c472e24823b7f83b5f2e21a99c9a /al/state.cpp
parente42681c4472b8a149a8f1e68614e4f5ee5d04fb0 (diff)
Use an inline function instead of a macro
Diffstat (limited to 'al/state.cpp')
-rw-r--r--al/state.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/al/state.cpp b/al/state.cpp
index cb2afd6c..f749af50 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -279,6 +279,15 @@ void GetValue(ALCcontext *context, ALenum pname, T *values)
context->setError(AL_INVALID_ENUM, "Invalid context property 0x%04x", pname);
}
+
+inline void UpdateProps(ALCcontext *context)
+{
+ if(!context->mDeferUpdates)
+ UpdateContextProps(context);
+ else
+ context->mPropsDirty = true;
+}
+
} // namespace
/* WARNING: Non-standard export! Not part of any extension, or exposed in the
@@ -293,13 +302,6 @@ START_API_FUNC
}
END_API_FUNC
-#define DO_UPDATEPROPS() do { \
- if(!context->mDeferUpdates) \
- UpdateContextProps(context.get()); \
- else \
- context->mPropsDirty = true; \
-} while(0)
-
AL_API void AL_APIENTRY alEnable(ALenum capability)
START_API_FUNC
@@ -313,7 +315,7 @@ START_API_FUNC
{
std::lock_guard<std::mutex> _{context->mPropLock};
context->mSourceDistanceModel = true;
- DO_UPDATEPROPS();
+ UpdateProps(context.get());
}
break;
@@ -343,7 +345,7 @@ START_API_FUNC
{
std::lock_guard<std::mutex> _{context->mPropLock};
context->mSourceDistanceModel = false;
- DO_UPDATEPROPS();
+ UpdateProps(context.get());
}
break;
@@ -614,7 +616,7 @@ START_API_FUNC
{
std::lock_guard<std::mutex> _{context->mPropLock};
context->mDopplerFactor = value;
- DO_UPDATEPROPS();
+ UpdateProps(context.get());
}
}
END_API_FUNC
@@ -637,7 +639,7 @@ START_API_FUNC
{
std::lock_guard<std::mutex> _{context->mPropLock};
context->mDopplerVelocity = value;
- DO_UPDATEPROPS();
+ UpdateProps(context.get());
}
}
END_API_FUNC
@@ -654,7 +656,7 @@ START_API_FUNC
{
std::lock_guard<std::mutex> _{context->mPropLock};
context->mSpeedOfSound = value;
- DO_UPDATEPROPS();
+ UpdateProps(context.get());
}
}
END_API_FUNC
@@ -670,7 +672,7 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mPropLock};
context->mDistanceModel = *model;
if(!context->mSourceDistanceModel)
- DO_UPDATEPROPS();
+ UpdateProps(context.get());
}
else
context->setError(AL_INVALID_VALUE, "Distance model 0x%04x out of range", value);