aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
Diffstat (limited to 'al')
-rw-r--r--al/error.cpp11
-rw-r--r--al/state.cpp38
2 files changed, 43 insertions, 6 deletions
diff --git a/al/error.cpp b/al/error.cpp
index afa7019a..70081a2e 100644
--- a/al/error.cpp
+++ b/al/error.cpp
@@ -61,8 +61,13 @@ void ALCcontext::setError(ALenum errorCode, const char *msg, ...)
va_end(args2);
va_end(args);
- if(msglen >= 0) msg = message.data();
- else msg = "<internal error constructing message>";
+ if(msglen >= 0)
+ msg = message.data();
+ else
+ {
+ msg = "<internal error constructing message>";
+ msglen = static_cast<int>(strlen(msg));
+ }
WARN("Error generated on context %p, code 0x%04x, \"%s\"\n",
decltype(std::declval<void*>()){this}, errorCode, msg);
@@ -79,6 +84,8 @@ void ALCcontext::setError(ALenum errorCode, const char *msg, ...)
ALenum curerr{AL_NO_ERROR};
mLastError.compare_exchange_strong(curerr, errorCode);
+
+ debugMessage(DebugSource::API, DebugType::Error, 0, DebugSeverity::High, msglen, msg);
}
AL_API ALenum AL_APIENTRY alGetError(void)
diff --git a/al/state.cpp b/al/state.cpp
index 86d81b13..fc9acb25 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -170,6 +170,10 @@ START_API_FUNC
}
break;
+ case AL_DEBUG_OUTPUT_SOFT:
+ context->mDebugEnabled = true;
+ break;
+
case AL_STOP_SOURCES_ON_DISCONNECT_SOFT:
context->setError(AL_INVALID_OPERATION, "Re-enabling AL_STOP_SOURCES_ON_DISCONNECT_SOFT not yet supported");
break;
@@ -196,6 +200,10 @@ START_API_FUNC
}
break;
+ case AL_DEBUG_OUTPUT_SOFT:
+ context->mDebugEnabled = false;
+ break;
+
case AL_STOP_SOURCES_ON_DISCONNECT_SOFT:
context->mStopVoicesOnDisconnect = false;
break;
@@ -220,6 +228,10 @@ START_API_FUNC
value = context->mSourceDistanceModel ? AL_TRUE : AL_FALSE;
break;
+ case AL_DEBUG_OUTPUT_SOFT:
+ value = context->mDebugEnabled ? AL_TRUE : AL_FALSE;
+ break;
+
case AL_STOP_SOURCES_ON_DISCONNECT_SOFT:
value = context->mStopVoicesOnDisconnect ? AL_TRUE : AL_FALSE;
break;
@@ -546,6 +558,14 @@ START_API_FUNC
value = context->mEventParam;
break;
+ case AL_DEBUG_CALLBACK_FUNCTION_SOFT:
+ value = reinterpret_cast<void*>(context->mDebugCb);
+ break;
+
+ case AL_DEBUG_CALLBACK_USER_PARAM_SOFT:
+ value = context->mDebugParam;
+ break;
+
default:
context->setError(AL_INVALID_VALUE, "Invalid pointer property 0x%04x", pname);
}
@@ -726,10 +746,12 @@ START_API_FUNC
{
switch(pname)
{
- case AL_EVENT_CALLBACK_FUNCTION_SOFT:
- case AL_EVENT_CALLBACK_USER_PARAM_SOFT:
- values[0] = alGetPointerSOFT(pname);
- return;
+ case AL_EVENT_CALLBACK_FUNCTION_SOFT:
+ case AL_EVENT_CALLBACK_USER_PARAM_SOFT:
+ case AL_DEBUG_CALLBACK_FUNCTION_SOFT:
+ case AL_DEBUG_CALLBACK_USER_PARAM_SOFT:
+ values[0] = alGetPointerSOFT(pname);
+ return;
}
}
@@ -825,6 +847,14 @@ START_API_FUNC
ContextRef context{GetContextRef()};
if(!context) UNLIKELY return;
+ if(context->mDebugEnabled.load(std::memory_order_relaxed))
+ {
+ static constexpr char deprecatedMessage[] = "alDopplerVelocity is deprecated in AL 1.1";
+ context->sendDebugMessage(DebugSource::API, DebugType::DeprecatedBehavior, 0,
+ DebugSeverity::Medium, static_cast<int>(std::strlen(deprecatedMessage)),
+ deprecatedMessage);
+ }
+
if(!(value >= 0.0f && std::isfinite(value)))
context->setError(AL_INVALID_VALUE, "Doppler velocity %f out of range", value);
else