> ## 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.

# PartyLocalChatControl::SetAudioInput

> Configures the preferred microphone or recording device that the chat control will use for audio input.

Configures the preferred microphone or recording device that the chat control will use for audio input.

## Syntax

```cpp theme={null}
PartyError SetAudioInput(  
    PartyAudioDeviceSelectionType audioDeviceSelectionType,  
    PartyString audioDeviceSelectionContext,  
    void* asyncIdentifier  
)  
```

### Parameters

**`audioDeviceSelectionType`**   [PartyAudioDeviceSelectionType](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype)

If [PartyAudioDeviceSelectionType::None](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype) is specified, the audio input will be cleared. If [PartyAudioDeviceSelectionType::SystemDefault](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype) is specified, the Party library will attempt to use the system's default communication device. If [PartyAudioDeviceSelectionType::PlatformUserDefault](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype) is specified, the Party library will attempt to use the default communication device associated with `audioDeviceSelectionContext`. If [PartyAudioDeviceSelectionType::Manual](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype) is specified, the Party library will attempt to use the communication device whose device identifier matches. Note that `PartyAudioDeviceSelectionType::Manual` is not supported on Android, iOS, or macOS.

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

When using [PartyAudioDeviceSelectionType::None](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype) or [PartyAudioDeviceSelectionType::SystemDefault](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype), `audioDeviceSelectionContext` will be ignored. When using [PartyAudioDeviceSelectionType::PlatformUserDefault](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype), `audioDeviceSelectionContext` must be the non-null, non-empty platform-specific user context that the chat control should use when selecting the audio device. When using [PartyAudioDeviceSelectionType::Manual](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype), `audioDeviceSelectionContext` must be the non-null, non-empty identifier of the audio device that the chat control should 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.

### Return value

PartyError

`c_partyErrorSuccess` if the asynchronous operation to set the audio input 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

This method queues an asynchronous operation to configure the preferred recording device associated with this local chat control. If the method succeeds, a [PartyLocalChatAudioInputChangedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocalchataudioinputchangedstatechange) will be provided by [PartyManager::StartProcessingStateChanges()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_startprocessingstatechanges) with details about the input device status and a [PartySetChatAudioInputCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partysetchataudioinputcompletedstatechange) will be provided upon completion of the operation, indicating success or failure. After completion, an additional [PartyLocalChatAudioInputChangedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocalchataudioinputchangedstatechange) will be provided each time the audio device status changes, such as due to device removal. <br /><br /> If the specified device isn't present, the chat control will subscribe to audio device changes and use the device when it does appear.   <br /><br /> When using the `PlatformUserDefault` option on the XBOX platform, the XBOX User Identifier (XUID) must be passed as the `audioDeviceSelectionContext` value.

## Requirements

**Header:** Party.h

## See also

[PartyLocalChatControl](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/partylocalchatcontrol)\
[PartyLocalChatControl::GetAudioInput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getaudioinput)\
[PartyLocalChatControl::SetAudioOutput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_setaudiooutput)


## Related topics

- [PartyLocalChatControl::GetAudioInput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getaudioinput.md)
- [PartyLocalChatControl::SetAudioOutput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_setaudiooutput.md)
- [PartyAudioDeviceSelectionType](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype.md)
- [PartyLocalChatAudioInputChangedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocalchataudioinputchangedstatechange.md)
- [PartySetChatAudioInputCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partysetchataudioinputcompletedstatechange.md)
