跳轉到主要內容
設定聊天控制項將用於音訊輸出的慣用喇叭或耳機裝置。

語法

參數

audioDeviceSelectionType   PartyAudioDeviceSelectionType 如果指定 PartyAudioDeviceSelectionType::None,則會清除音訊輸出。如果指定 PartyAudioDeviceSelectionType::SystemDefault,Party 程式庫會嘗試使用系統的預設通訊裝置。如果指定 PartyAudioDeviceSelectionType::PlatformUserDefault,Party 程式庫會嘗試使用與 audioDeviceSelectionContext 相關聯的預設通訊裝置。如果指定 PartyAudioDeviceSelectionType::Manual,Party 程式庫會嘗試使用裝置識別碼與 audioDeviceSelectionContext 相符的通訊裝置。 audioDeviceSelectionContext   PartyString
選用
使用 PartyAudioDeviceSelectionType::None 或 PartyAudioDeviceSelectionType::SystemDefault 時,會忽略 audioDeviceSelectionContext。使用 PartyAudioDeviceSelectionType::PlatformUserDefault 時,audioDeviceSelectionContext 必須是聊天控制項選取音訊裝置時應使用的非 null、非空白平台專屬使用者內容。使用 PartyAudioDeviceSelectionType::Manual 時,audioDeviceSelectionContext 必須是聊天控制項應使用之音訊裝置的非 null、非空白識別碼。 asyncIdentifier   void*
選用
選用的應用程式定義指標大小內容值,可用來將完成狀態變更與此呼叫相關聯。

傳回值

PartyError c_partyErrorSuccess (如果設定音訊輸出的非同步作業已開始),否則為錯誤碼。如果此方法失敗,將不會產生任何相關的狀態變更。可透過 PartyManager::GetErrorMessage() 擷取錯誤碼的人類可讀形式。

備註

此方法會將非同步作業排入佇列,以設定與此本機聊天控制項相關聯的慣用喇叭或耳機裝置。如果方法成功,PartyManager::StartProcessingStateChanges() 會提供包含輸出裝置狀態詳細資料的 PartyLocalChatAudioOutputChangedStateChange,並在作業完成時提供 PartySetChatAudioOutputCompletedStateChange,表示成功或失敗。完成後,每當音訊裝置狀態變更 (例如因裝置移除) 時,都會再提供 PartyLocalChatAudioOutputChangedStateChange。

如果指定的裝置不存在,聊天控制項會訂閱音訊裝置變更,並在裝置出現時使用該裝置。

在 XBOX 平台上使用 PlatformUserDefault 選項時,必須將 XBOX 使用者識別碼 (XUID) 作為 audioDeviceSelectionContext 值傳遞。

需求

標頭: Party.h

另請參閱

PartyLocalChatControl
PartyLocalChatControl::GetAudioOutput
PartyLocalChatControl::SetAudioInput
最後修改於 2026年10月8日