Skip to content

Commit

Permalink
Linux Haptic: Fix periodic.magnitude value
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Dec 6, 2018
1 parent 39e8e39 commit 0b6e24f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/haptic/linux/SDL_syshaptic.c
Expand Up @@ -801,8 +801,7 @@ SDL_SYS_ToFFEffect(struct ff_effect *dest, SDL_HapticEffect * src)
else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN)
dest->u.periodic.waveform = FF_SAW_DOWN;
dest->u.periodic.period = CLAMP(periodic->period);
/* Linux expects 0-65535, so multiply by 2 */
dest->u.periodic.magnitude = CLAMP(periodic->magnitude) * 2;
dest->u.periodic.magnitude = periodic->magnitude;
dest->u.periodic.offset = periodic->offset;
/* Linux phase is defined in interval "[0x0000, 0x10000[", corresponds with "[0deg, 360deg[" phase shift. */
dest->u.periodic.phase = ((Uint32)periodic->phase * 0x10000U) / 36000;
Expand Down

0 comments on commit 0b6e24f

Please sign in to comment.