Skip to main content

XUserGetDefaultAudioEndpointUtf16

检索特定用户的默认音频终结点。

语法

参数

user   
类型:XUserLocalId
要获取默认音频终结点的用户的本地 ID。
defaultAudioEndpointKind   
类型:XUserDefaultAudioEndpointKind
枚举值,用于指定用户的默认音频终结点是渲染音频还是捕获音频。
endpointIdUtf16Count   
类型:size_t
endpointIdUtf16 参数所指向的缓冲区的 wchar_t 数。传递 XUserAudioEndpointMaxUtf16Count
endpointIdUtf16   _Out_writes_to_(endpointIdUtf16Count,endpointIdUtf16Used)
类型:wchar_t

包含用户默认音频终结点的 ID。
endpointIdUtf16Used   _Out_opt_
类型:size_t*
包含 endpointIdUtf16 参数所返回 ID 的实际 wchar_t 数。

返回值

类型:HRESULT 如果成功,则返回 S_OK;否则返回错误代码。 有关错误代码列表,请参阅错误代码

注解

在时间敏感线程上调用此函数并不安全。有关详细信息,请参阅时间敏感线程
XUserGetDefaultAudioEndpointUtf16 函数接受 XUserDefaultAudioEndpointKind 枚举作为参数。 当特定用户的默认音频终结点发生更改时,会调用 XUserDefaultAudioEndpointUtf16ChangedCallback 回调函数。 若要在默认音频终结点更改时注册接收回调,请调用 XUserRegisterForDefaultAudioEndpointUtf16Changed 若要在默认音频终结点更改时取消注册回调,请调用 XUserUnregisterForDefaultAudioEndpointUtf16Changed 以下示例演示如何检索用户的默认音频终结点。

要求

头文件: XUser.h 库: xgameruntime.lib 支持的平台: Windows、XBOX One 系列主机和 XBOX Series 主机

概念文档

另请参阅

XUser XUserDefaultAudioEndpointUtf16ChangedCallback XUserRegisterForDefaultAudioEndpointUtf16Changed XUserUnregisterForDefaultAudioEndpointUtf16Changed
最后修改于 2026年8月24日