diff options
author | Chris Robinson <[email protected]> | 2023-05-03 10:42:32 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-03 12:18:42 -0700 |
commit | ce588ea5a3c3ee6c7fce64ec501a03ebaca373d4 (patch) | |
tree | 56bdc75dc41cc4d59b88f086c974bd7a648dbc2a /al/state.cpp | |
parent | 90b0840d62a123e946e81f514bbe331897da8838 (diff) |
Implement a context debug flag
Setting the debug flag at context creation enables more debug messages for the
created context, and enables debug messages by default.
Diffstat (limited to 'al/state.cpp')
-rw-r--r-- | al/state.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/al/state.cpp b/al/state.cpp index 71c9b703..efc6398d 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -150,6 +150,7 @@ enum PropertyValue : ALenum { MaxDebugMessageLength = AL_MAX_DEBUG_MESSAGE_LENGTH_EXT, MaxDebugLoggedMessages = AL_MAX_DEBUG_LOGGED_MESSAGES_EXT, MaxDebugGroupDepth = AL_MAX_DEBUG_GROUP_STACK_DEPTH_EXT, + ContextFlags = AL_CONTEXT_FLAGS_EXT, #ifdef ALSOFT_EAX EaxRamSize = AL_EAX_RAM_SIZE, EaxRamFree = AL_EAX_RAM_FREE, @@ -183,10 +184,11 @@ void GetValue(ALCcontext *context, ALenum pname, T *values) return; case AL_DOPPLER_VELOCITY: - context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, - DebugSeverity::Medium, -1, - "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " - "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); + if(context->mContextFlags.test(ContextFlags::DebugBit)) UNLIKELY + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "AL_DOPPLER_VELOCITY is deprecated in AL 1.1, use AL_SPEED_OF_SOUND; " + "AL_DOPPLER_VELOCITY -> AL_SPEED_OF_SOUND / 343.3f"); *values = cast_value(context->mDopplerVelocity); return; @@ -241,6 +243,10 @@ void GetValue(ALCcontext *context, ALenum pname, T *values) *values = cast_value(MaxDebugGroupDepth); return; + case AL_CONTEXT_FLAGS_EXT: + *values = cast_value(context->mContextFlags.to_ulong()); + return; + #ifdef ALSOFT_EAX #define EAX_ERROR "[alGetInteger] EAX not enabled." @@ -618,10 +624,11 @@ START_API_FUNC ContextRef context{GetContextRef()}; if(!context) UNLIKELY return; - context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, - DebugSeverity::Medium, -1, - "alDopplerVelocity is deprecated in AL 1.1, use alSpeedOfSound; " - "alDopplerVelocity(x) -> alSpeedOfSound(343.3f * x)"); + if(context->mContextFlags.test(ContextFlags::DebugBit)) UNLIKELY + context->debugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0, + DebugSeverity::Medium, -1, + "alDopplerVelocity is deprecated in AL 1.1, use alSpeedOfSound; " + "alDopplerVelocity(x) -> alSpeedOfSound(343.3f * x)"); if(!(value >= 0.0f && std::isfinite(value))) context->setError(AL_INVALID_VALUE, "Doppler velocity %f out of range", value); |