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

# XUserDefaultAudioEndpointKind

> XUserDefaultAudioEndpointKind

# XUserDefaultAudioEndpointKind

Especifica si el punto de conexión de audio predeterminado del usuario representa o captura audio.

## Sintaxis

```cpp theme={null}
enum class XUserDefaultAudioEndpointKind  : uint32_t  
{  
    CommunicationRender = 0,  
    CommunicationCapture = 1  
}  
```

## Constantes

| Constante            | Descripción                                                                |
| -------------------- | -------------------------------------------------------------------------- |
| CommunicationRender  | El punto de conexión de audio predeterminado del usuario representa audio. |
| CommunicationCapture | El punto de conexión de audio predeterminado del usuario captura audio.    |

## Comentarios

La función [XUserGetDefaultAudioEndpointUtf16](/reference/system/xuser/functions/xusergetdefaultaudioendpointutf16) usa un argumento de enumeración XUserDefaultAudioEndpointKind para obtener el punto de conexión de audio predeterminado de un usuario.
La función [XUserDefaultAudioEndpointUtf16ChangedCallback](/reference/system/xuser/functions/xuserdefaultaudioendpointutf16changedcallback) toma un argumento de enumeración XUserDefaultAudioEndpointKind y se invoca cuando cambia el punto de conexión de audio predeterminado de un usuario.

El siguiente ejemplo muestra cómo recuperar el punto de conexión de audio predeterminado de un usuario.

```cpp theme={null}
HRESULT GetAudioDeviceAssociation(
    IMMDeviceEnumerator* audioDeviceEnumerator,
    XUserLocalId user,
    XUserDefaultAudioEndpointKind defaultAudioEndpointKind,
    _Outptr_result_maybenull_ IMMDevice** endpoint)
{
    wchar_t audioDeviceId[XUserAudioEndpointMaxUtf16Count];
    RETURN_IF_FAILED_WITH_EXPECTED(XUserGetDefaultAudioEndpointUtf16(user, defaultAudioEndpointKind, std::size(audioDeviceId), audioDeviceId, nullptr), E_NOTFOUND);

    return audioDeviceEnumerator->GetDevice(audioDeviceId, endpoint);
}

HRESULT GetAudioAssociations()
{
    Mwrl::ComPtr<IMMDeviceEnumerator> audioDeviceEnumerator;

    RETURN_IF_FAILED(CoCreateInstance(
        __uuidof(MMDeviceEnumerator),
        nullptr,
        CLSCTX_ALL,
        __uuidof(IMMDeviceEnumerator),
        (void**)&audioDeviceEnumerator));

    XUserLocalId userLocalId;
    RETURN_IF_FAILED(XUserGetLocalId(_handle.get(), &userLocalId));

    {
        wil::unique_cotaskmem_string id;
        Mwrl::ComPtr<IMMDevice> device;
        if (SUCCEEDED(GetAudioDeviceAssociation(audioDeviceEnumerator.Get(), userLocalId, XUserDefaultAudioEndpointKind::CommunicationRender, &device)))
        {
            RETURN_IF_FAILED(device->GetId(&id));
        }
        appLog.AddLog("Preferred render communication device id: %S\n", id.get());
    }

    {
        wil::unique_cotaskmem_string id;
        Mwrl::ComPtr<IMMDevice> device;
        if (SUCCEEDED(GetAudioDeviceAssociation(audioDeviceEnumerator.Get(), userLocalId, XUserDefaultAudioEndpointKind::CommunicationCapture, &device)))
        {
            RETURN_IF_FAILED(device->GetId(&id));
        }
        appLog.AddLog("Preferred capture communication device id: %S\n", id.get());
    }

    return S_OK;
}
```

## Requisitos

**Encabezado:** XUser.h

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[XUser](/reference/system/xuser/xuser_members)

[XUserGetDefaultAudioEndpointUtf16](/reference/system/xuser/functions/xusergetdefaultaudioendpointutf16)

[XUserDefaultAudioEndpointUtf16ChangedCallback](/reference/system/xuser/functions/xuserdefaultaudioendpointutf16changedcallback)


## Related topics

- [XUserDefaultAudioEndpointUtf16ChangedCallback](/es/reference/system/xuser/functions/xuserdefaultaudioendpointutf16changedcallback.md)
- [XUserGetDefaultAudioEndpointUtf16](/es/reference/system/xuser/functions/xusergetdefaultaudioendpointutf16.md)
- [XUser](/es/reference/system/xuser/xuser_members.md)
- [XUserRegisterForDefaultAudioEndpointUtf16Changed](/es/reference/system/xuser/functions/xuserregisterfordefaultaudioendpointutf16changed.md)
- [XUserUnregisterForDefaultAudioEndpointUtf16Changed](/es/reference/system/xuser/functions/xuserunregisterfordefaultaudioendpointutf16changed.md)
