> ## 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::SetAudioOutput

> Configures the preferred speakers or headset device that the chat control will use for audio output.

Configures the preferred speakers or headset device that the chat control will use for audio output.

## Syntax

```cpp theme={null}
PartyError SetAudioOutput(  
    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 output 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 `audioDeviceSelectionContext`.

**`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 output 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 speakers or headset device associated with this local chat control. If the method succeeds, a [PartyLocalChatAudioOutputChangedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocalchataudiooutputchangedstatechange) will be provided by [PartyManager::StartProcessingStateChanges()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_startprocessingstatechanges) with details about the output device status and a [PartySetChatAudioOutputCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partysetchataudiooutputcompletedstatechange) will be provided upon completion of the operation, indicating success or failure. After completion, an additional [PartyLocalChatAudioOutputChangedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocalchataudiooutputchangedstatechange) 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::GetAudioOutput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getaudiooutput)\
[PartyLocalChatControl::SetAudioInput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_setaudioinput)


## Related topics

- [PartyLocalChatControl::GetAudioOutput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getaudiooutput.md)
- [PartyLocalChatControl::SetAudioInput](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_setaudioinput.md)
- [PartyAudioDeviceSelectionType](/services/playfab/multiplayer/networking/reference/enums/partyaudiodeviceselectiontype.md)
- [PartyLocalChatAudioOutputChangedStateChange](/services/playfab/multiplayer/networking/reference/structs/partylocalchataudiooutputchangedstatechange.md)
- [PartySetChatAudioOutputCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partysetchataudiooutputcompletedstatechange.md)
