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

# GameInputHapticInfo

> GameInputHapticInfo

# GameInputHapticInfo

描述觸覺功能和中繼資料。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
constexpr uint32_t GAMEINPUT_HAPTIC_MAX_LOCATIONS              = 8;
constexpr uint32_t GAMEINPUT_HAPTIC_MAX_AUDIO_ENDPOINT_ID_SIZE = 256;

DEFINE_GUID(GAMEINPUT_HAPTIC_LOCATION_NONE,          0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
DEFINE_GUID(GAMEINPUT_HAPTIC_LOCATION_GRIP_LEFT,     0x08c707c2, 0x66bb, 0x406c, 0xa8, 0x4a, 0xdf, 0xe0, 0x85, 0x12, 0x0a, 0x92);
DEFINE_GUID(GAMEINPUT_HAPTIC_LOCATION_GRIP_RIGHT,    0x155a0b77, 0x8bb2, 0x40db, 0x86, 0x90, 0xb6, 0xd4, 0x11, 0x26, 0xdf, 0xc1);
DEFINE_GUID(GAMEINPUT_HAPTIC_LOCATION_TRIGGER_LEFT,  0x8de4d896, 0x5559, 0x4081, 0x86, 0xe5, 0x17, 0x24, 0xcc, 0x07, 0xc6, 0xbc);
DEFINE_GUID(GAMEINPUT_HAPTIC_LOCATION_TRIGGER_RIGHT, 0xff0cb557, 0x3af5, 0x406b, 0x8b, 0x0f, 0x55, 0x5a, 0x2d, 0x92, 0xa2, 0x20);

struct GameInputHapticInfo
{
    wchar_t  audioEndpointId[GAMEINPUT_HAPTIC_MAX_AUDIO_ENDPOINT_ID_SIZE];
    uint32_t locationCount;
    GUID     locations[GAMEINPUT_HAPTIC_MAX_LOCATIONS];
};
```

<a id="membersSection" />

### 成員

*audioEndpointId*<br />
類型：wchar\_t

WASAPI 觸覺音訊端點識別碼。

*locationCount*<br />
類型：uint32\_t

觸覺位置的數目。

*locations*<br />
類型：GUID

觸覺位置的清單。

<a id="remarksSection" />

## 備註

支援觸覺的控制器與耳機或桌上型喇叭等一般用途音訊裝置非常相似；它們由 Windows 音訊系統驅動。`GameInputHapticInfo` 結構可讓您將觸覺音訊端點與特定的 GameInput 裝置配對。裝置回報其已就緒後，即可使用 [GetHapticInfo](/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gethapticinfo) 方法查詢此資訊。

`audioEndpointId` 是[端點識別碼字串](https://learn.microsoft.com/windows/win32/coreaudio/endpoint-id-strings)，可用來透過 [WASAPI](https://learn.microsoft.com/windows/win32/coreaudio/wasapi) 或數個較高階音訊 API 中的任何一個存取觸覺裝置。開啟端點後，您只需將觸覺波形串流至裝置即可。

傳統音訊裝置的喇叭具有明確定義的位置，例如左前、右前和中央。觸覺控制器的情況則較為細微，因為裝置可能在無法妥善對應到環繞音效系統概念的實體位置支援觸覺回饋。為了將現有的音訊聲道索引調整為觸覺位置，會提供裝置特定的對應。對於支援觸覺的控制器，觸覺位置的數目一律大於零。位置清單會包含與音訊聲道索引一對一的對應。不允許重複的位置，但 `GAMEINPUT_HAPTIC_LOCATION_NONE` 除外，它可用來填補同時包含音訊和觸覺端點的端點。為了說明，我們來看看下列位置清單：

```cpp theme={null}
{ GAMEINPUT_HAPTIC_LOCATION_NONE, GAMEINPUT_HAPTIC_LOCATION_NONE, GAMEINPUT_HAPTIC_LOCATION_GRIP_LEFT, GAMEINPUT_HAPTIC_LOCATION_GRIP_RIGHT }
```

在此範例中，聲道 0 和 1 未使用，而聲道 2 和 3 分別對應到左握把和右握把。觸覺位置清單可能會在未來的 GameInput 版本中擴充。

<a id="requirementsSection" />

## 需求

**標頭：** GameInput.h

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

<a id="seealsoSection" />

## 概念文件

* [GameInput 觸覺需求](/zh-TW/build/core-features/common/input/hardware/input-hardware-haptics)

## 另請參閱

[GameInput 概觀](/zh-TW/build/core-features/common/input/overviews/input-overview)<br />
[GetHapticInfo](/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gethapticinfo)<br />
[GameInput](/zh-TW/reference/input/gameinput/gameinput_members)<br />
[端點識別碼字串](https://learn.microsoft.com/windows/win32/coreaudio/endpoint-id-strings)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v2** | v2 中推出的**新結構**。 |
| **v1** | 不存在。 |
| **v0** | 不存在。 |


## Related topics

- [GameInputHapticInfo](/reference/input/gameinput/structs/gameinputhapticinfo.md)
- [Haptics in GameInput](/build/core-features/common/input/hardware/input-hardware-haptics.md)
- [GetHapticInfo](/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gethapticinfo.md)
- [GameInputHapticFeedbackMotorInfo](/reference/input/gameinput/deprecated/structs/gameinputhapticfeedbackmotorinfo.md)
- [Hápticos en GameInput](/es/build/core-features/common/input/hardware/input-hardware-haptics.md)
