> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PartyLocalChatControl::SetTextToSpeechProfile

> 設定指定類型的文字轉語音作業所要使用的設定檔。

設定指定類型的文字轉語音作業所要使用的設定檔。

## 語法

```cpp theme={null}
PartyError SetTextToSpeechProfile(  
    PartySynthesizeTextToSpeechType type,  
    PartyString profileIdentifier,  
    void* asyncIdentifier  
)  
```

### 參數

**`type`**   [PartySynthesizeTextToSpeechType](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/enums/partysynthesizetexttospeechtype.md)

應使用指定設定檔的文字轉語音作業類型。

**`profileIdentifier`**   [PartyString](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/typedefs.md)

指定類型的文字轉語音作業應使用之設定檔的識別碼。

**`asyncIdentifier`**   void\*\
*選用*

選用的應用程式定義指標大小內容值，可用來將完成狀態變更與此呼叫相關聯。

### 傳回值

PartyError

`c_partyErrorSuccess` (如果設定文字轉語音設定檔的非同步作業已開始)，否則為錯誤碼。如果此方法失敗，將不會產生任何相關的狀態變更。可透過 [PartyManager::GetErrorMessage()](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage.md) 擷取錯誤碼的人類可讀形式。

## 備註

提供的設定檔會用於所有後續指定相同 `type` 值的 [SynthesizeTextToSpeech()](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_synthesizetexttospeech.md) 呼叫。在至少呼叫一次 SetTextToSpeechProfile() 之前，不會設定任何設定檔。因此，必須至少呼叫此方法一次，SynthesizeTextToSpeech() 的呼叫才能成功。 \
\
&#x20;此方法接受設定檔識別碼來表示設定檔選擇，讓遊戲可以傳入 [PartyTextToSpeechProfile::GetIdentifier()](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyTextToSpeechProfile/methods/partytexttospeechprofile_getidentifier.md) 的結果，或提供從先前 Party 程式庫工作階段快取的設定檔識別碼。   \
\
&#x20;可以起始多個 SetTextToSpeechProfile() 作業，它們會以非同步方式排入佇列。每個作業都會依序處理和完成。   \
\
&#x20;這是非同步作業；完成時，[PartyManager::StartProcessingStateChanges()](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_startprocessingstatechanges.md) 會提供 [PartySetTextToSpeechProfileCompletedStateChange](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/structs/partysettexttospeechprofilecompletedstatechange.md)。   \
\
&#x20;文字轉語音合成功能在內部會使用可用的區域和延遲測量估計值來最佳化服務使用量。如果使用 [PartyOption::RegionUpdateConfiguration](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/enums/partyoption.md) 選項將更新模式設定為 [PartyRegionUpdateMode::Deferred](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/enums/partyregionupdatemode.md)，則可能尚未開始擷取可用區域集合並測量與其之間的連線品質，或上次更新可能已超過設定的重新整理間隔時間。如果本機裝置目前未連線或未正在連線到任何網路，SetTextToSpeechProfile() 會確保任何延後的區域更新已開始，且相關聯的 [PartyRegionsChangedStateChange](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/structs/partyregionschangedstatechange.md) 會在此呼叫的 [PartySetTextToSpeechProfileCompletedStateChange](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/structs/partysettexttospeechprofilecompletedstatechange.md) 完成之前提供。

## 需求

**標頭：** Party.h

## 另請參閱

[PartyLocalChatControl](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/partylocalchatcontrol.md)\
[PartyLocalChatControl::GetTextToSpeechProfile](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_gettexttospeechprofile.md)


## Related topics

- [PartyLocalChatControl::PopulateAvailableTextToSpeechProfiles](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_populateavailabletexttospeechprofiles.md)
- [PartyLocalChatControl::GetTextToSpeechProfile](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_gettexttospeechprofile.md)
- [PartyTextToSpeechProfile](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyTextToSpeechProfile/partytexttospeechprofile.md)
- [PartyLocalChatControl::SynthesizeTextToSpeech](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_synthesizetexttospeech.md)
- [PartySynthesizeTextToSpeechType](https://docs.xbox.com/zh-TW/services/playfab/multiplayer/networking/reference/enums/partysynthesizetexttospeechtype.md)
