Skip to main content
配置聊天控件将用于音频输出的首选扬声器或耳机设备。

Syntax

Parameters

audioDeviceSelectionType   PartyAudioDeviceSelectionType 如果指定 PartyAudioDeviceSelectionType::None,则音频输出将被清除。如果指定 PartyAudioDeviceSelectionType::SystemDefault,Party 库将尝试使用系统的默认通信设备。如果指定 PartyAudioDeviceSelectionType::PlatformUserDefault,Party 库将尝试使用与 audioDeviceSelectionContext 关联的默认通信设备。如果指定 PartyAudioDeviceSelectionType::Manual,Party 库将尝试使用其设备标识符与 audioDeviceSelectionContext 匹配的通信设备。 audioDeviceSelectionContext   PartyString
optional
使用 PartyAudioDeviceSelectionType::NonePartyAudioDeviceSelectionType::SystemDefault 时,将忽略 audioDeviceSelectionContext。使用 PartyAudioDeviceSelectionType::PlatformUserDefault 时,audioDeviceSelectionContext 必须是非 null、非空的平台特定用户上下文,聊天控件在选择音频设备时应使用它。使用 PartyAudioDeviceSelectionType::Manual 时,audioDeviceSelectionContext 必须是聊天控件应使用的音频设备的非 null、非空的标识符。 asyncIdentifier   void*
optional
可选的、应用定义的指针大小上下文值,可用于将完成状态更改与此调用关联。

Return value

PartyError 如果设置音频输出的异步操作已开始,则返回 c_partyErrorSuccess;否则返回错误代码。如果此方法失败,则不会生成相关的状态更改。可通过 PartyManager::GetErrorMessage() 检索错误代码的可读形式。

Remarks

此方法将异步操作排队以配置与此本地聊天控件关联的首选扬声器或耳机设备。如果该方法成功,PartyManager::StartProcessingStateChanges() 将提供一个 PartyLocalChatAudioOutputChangedStateChange,其中包含关于输出设备状态的详细信息,并在操作完成时提供一个 PartySetChatAudioOutputCompletedStateChange,指示成功或失败。完成之后,每次音频设备状态发生变化(例如由于设备移除)时,都会额外提供一个 PartyLocalChatAudioOutputChangedStateChange

如果指定的设备不存在,聊天控件将订阅音频设备的更改,并在该设备出现时使用它。

在 XBOX 平台上使用 PlatformUserDefault 选项时,必须将 XBOX 用户标识符 (XUID) 作为 audioDeviceSelectionContext 值传递。

Requirements

Header: Party.h

See also

PartyLocalChatControl
PartyLocalChatControl::GetAudioOutput
PartyLocalChatControl::SetAudioInput
最后修改于 2026年8月24日