---
name: "SDL_SetHapticGain"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_SetHapticGain"
---

# SDL\_SetHapticGain(3)

Set the global gain of the specified haptic device.

## NAME

SDL\_SetHapticGain - Set the global gain of the specified haptic device.

## HEADER FILE

Defined in SDL3/SDL\_haptic.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**bool SDL\_SetHapticGain(SDL\_Haptic \*haptic, int gain);**

## DESCRIPTION

Device must support the  **SDL\_HAPTIC\_GAIN**\
  feature.

The user may specify the maximum gain by setting the environment variable

**SDL\_HAPTIC\_GAIN\_MAX** which should be between 0 and 100. All calls to  **SDL\_SetHapticGain** () will scale linearly using  **SDL\_HAPTIC\_GAIN\_MAX** as the maximum.

## FUNCTION PARAMETERS

- *haptic*

  the  **SDL\_Haptic**\
    device to set the gain on.

- *gain*

  value to set the gain to, should be between 0 and 100 (0 - 100).

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_GetHapticFeatures**(3)](/SDL_GetHapticFeatures/3.md)
