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

# SetForceFeedbackMotorGain

> IGameInputDevice::SetForceFeedbackMotorGain

# IGameInputDevice::SetForceFeedbackMotorGain

对电机上所有已加载的效果应用一个全局衰减因子。

## 语法

```cpp theme={null}
void SetForceFeedbackMotorGain(
    uint32_t motorIndex,
    float masterGain
);
```

### 参数

\u0001\u0001\u0001*motorIndex*   \_In\_\
类型:uint32\_t

要变更的电机索引。

*masterGain*   \_In\_\
类型:float

对电机上所有已加载效果的全局衰减因子，取值范围为 0.0 到 1.0。

### 返回值

无。

## 注解

此方法对电机上所有已加载的效果应用一个全局衰减因子。`masterGain` 指针接受 0.0 到 1.0 之间的值。此值用于应用程序的力反馈强度设置。有关更多信息，请参见 [GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)。

## 要求

**头文件:** GameInput.h

[GameInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/gameinput_members.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## 版本历史

| 版本 | 变更 |
| - | - |
| **v0** | 引入。 |


## Related topics

- [IGameInputForceFeedbackEffect::SetGain](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_setgain.md)
- [IGameInputForceFeedbackEffect::GetGain](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_getgain.md)
- [IGameInputDevice::SetHapticMotorState（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_sethapticmotorstate.md)
- [IsForceFeedbackMotorPoweredOn](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_isforcefeedbackmotorpoweredon.md)
- [GetMotorIndex](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_getmotorindex.md)
