PartyLocalChatControl::SetAudioOutput
配置聊天控件用于音频输出的首选扬声器或耳机设备。
语法
PartyError SetAudioOutput(
PartyAudioDeviceSelectionType audioDeviceSelectionType,
PartyString audioDeviceSelectionContext,
void* asyncIdentifier
)
参数
audioDeviceSelectionType
PartyAudioDeviceSelectionType
如果 PartyAudioDeviceSelectionType:: ,将清除音频输出。 如果 PartyAudioDeviceSelectionType::SystemDefault ,则群库将尝试使用系统的默认通信设备。 如果 PartyAudioDeviceSelectionType::P formUserDefault ,则群库将尝试使用与 audioDeviceSelectionContext
相关联的默认通信设备。 如果指定了 PartyAudioDeviceSelectionType::Manual ,则群库将尝试使用设备标识符匹配 audioDeviceSelectionContext
的通信设备。
audioDeviceSelectionContext
PartyString
可选
使用PartyAudioDeviceSelectionType::None 或 PartyAudioDeviceSelectionType::SystemDefault, audioDeviceSelectionContext
将被忽略。 使用 PartyAudioDeviceSelectionType::P formUserDefault时, audioDeviceSelectionContext
必须是非空的,和非空平台特定用户上下文,聊天控件在选择音频设备时应该使用。 使用 PartyAudioDeviceSelectionType::Manual, audioDeviceSelectionContext
必须为聊天控件应使用的音频设备的非空标识符。
asyncIdentifier
void*
可选
一个可选应用定义的指针大小的上下文值,可用于将完成状态更改与此调用关联起来。
返回值
PartyError
c_partyErrorSuccess
如果异步操作开始设置音频输出,否则为错误代码。 如果此方法失败,则不会生成任何相关的状态更改。 可通过 PartyManager::GetErrorMessage() 检索错误代码的可读形式。
备注
此方法对异步操作进行排队,以配置与此本地聊天控件相关联的首选扬声器或耳机设备。 如果方法成功,PartyManager::StartProcessingStateChanges() 将提供一个 PartyLocalAudioAudioOutputChange,包含输出设备状态的详细信息,并且在操作完成后将提供PartySetAudioOutputCompletedStateChange,指示成功或失败。 完成后,每次音频设备状态更改(例如由于设备删除)时,将提供一个额外的PartyLocalChatAudioOutputChangedStateChange 。
如果指定的设备不存在,聊天控件将订阅音频设备更改,并使用该设备(若显示)。
在 Xbox 平台上使用 PlatformUserDefault
选项时,Xbox 用户标识符 (XUID) 必须作为 audioDeviceSelectionContext
值传递。
要求
标题: Party.h
另请参阅
PartyLocalChatControl
PartyLocalChatControl::GetAudioOutput
PartyLocalChatControl::SetAudioInput