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

# PartyLocalDevice::CreateChatControl

> Queues an asynchronous operation to create a local chat control for the specified user.

Queues an asynchronous operation to create a local chat control for the specified user.

## Syntax

```cpp theme={null}
PartyError CreateChatControl(  
    const PartyLocalUser* localUser,  
    PartyString languageCode,  
    void* asyncIdentifier,  
    PartyLocalChatControl** localChatControl  
)  
```

### Parameters

**`localUser`**   [PartyLocalUser\*](/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/partylocaluser)

The local user for the new local chat control.

**`languageCode`**   [PartyString](/services/playfab/multiplayer/networking/reference/typedefs)\
*optional*

The optional language to use.

**`asyncIdentifier`**   void\*\
*optional*

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

**`localChatControl`**   [PartyLocalChatControl\*\*](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/partylocalchatcontrol)\
*optional, library-allocated output*

The optional, output local chat control.

### Return value

PartyError

`c_partyErrorSuccess` if the asynchronous operation to create a chat control began, or an error code otherwise. If this method fails, no related state changes will be generated. The human-readable form of the error code can be retrieved via [PartyManager::GetErrorMessage()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage).

## Remarks

If this method returns success, a [PartyCreateChatControlCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partycreatechatcontrolcompletedstatechange) will be generated to provide the result of the asynchronous operation. If the asynchronous operation succeeds, a [PartyChatControlCreatedStateChange](/services/playfab/multiplayer/networking/reference/structs/partychatcontrolcreatedstatechange) will be generated. If the operation fails, a [PartyChatControlDestroyedStateChange](/services/playfab/multiplayer/networking/reference/structs/partychatcontroldestroyedstatechange) will be generated. This method itself does not make the chat control visible to any remote devices. To announce this chat control to remote devices, the title should call [PartyNetwork::ConnectChatControl()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_connectchatcontrol). <br /><br /> On successful return, this method invalidates the memory for any array previously returned by [PartyManager::GetChatControls()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getchatcontrols) or [PartyDevice::GetChatControls()](/services/playfab/multiplayer/networking/reference/classes/PartyDevice/methods/partydevice_getchatcontrols) for the local device, as it synchronously adds the new chat control to the arrays. [PartyManager::StartProcessingStateChanges()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_startprocessingstatechanges) also invalidates the memory for these arrays. The returned `localChatControl` object will be valid until a PartyChatControlDestroyedStateChange has been generated and all state changes referencing the object have been returned to [PartyManager::FinishProcessingStateChanges()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_finishprocessingstatechanges).   <br /><br /> The language associated with this chat control can optionally be specified via the `languageCode` parameter. If no language is specified, the user's default, as determined by the platform, will be used. The language is used as the spoken language associated with this chat control for transcription and the target language for incoming translations. If the language code specified is en-US, for instance, the input audio to this chat control will be treated as the English (United States) language and transcribed as such. If translation is enabled via either [PartyLocalChatControl::SetTranscriptionOptions()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settranscriptionoptions) or [PartyLocalChatControl::SetTextChatOptions()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settextchatoptions), the incoming voice chat transcriptions and/or text chat will be translated to English (United States).   <br /><br /> The language code should be in BCP 47 format; supported language codes are enumerated in [Language support](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support). Specifying an unsupported or invalid language code will not cause this method to fail, but will result in failure to generate transcriptions associated with this chat control. The language code used with this method can be queried via [PartyLocalChatControl::GetLanguage()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getlanguage).

## Requirements

**Header:** Party.h

## See also

[PartyLocalDevice](/services/playfab/multiplayer/networking/reference/classes/PartyLocalDevice/partylocaldevice)\
[PartyCreateChatControlCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partycreatechatcontrolcompletedstatechange)\
[PartyChatControlCreatedStateChange](/services/playfab/multiplayer/networking/reference/structs/partychatcontrolcreatedstatechange)\
[PartyChatControlDestroyedStateChange](/services/playfab/multiplayer/networking/reference/structs/partychatcontroldestroyedstatechange)\
[PartyManager::GetChatControls](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getchatcontrols)\
[PartyDevice::GetChatControls](/services/playfab/multiplayer/networking/reference/classes/PartyDevice/methods/partydevice_getchatcontrols)\
[PartyNetwork::ConnectChatControl](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_connectchatcontrol)\
[PartyLocalChatControl::GetLanguage](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getlanguage)\
[PartyLocalChatControl::SetTranscriptionOptions](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settranscriptionoptions)\
[PartyLocalChatControl::SetTranscriptionOptions](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settranscriptionoptions)
