Linux Haptic: Fix periodic.magnitude value

Ethan Lee 2018-12-06 14:26:18 -05:00
parent 39e8e3951c
commit 0b6e24f7e7
1 changed files with 1 additions and 2 deletions

View File

@ -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;