public bool SetVibration(int index, float left, float right) { left = Math.Max(Math.Min(left, 1f), 0f); right = Math.Max(Math.Min(right, 1f), 0f); XInputVibration vibration = new XInputVibration( (ushort)(left * UInt16.MaxValue), (ushort)(right * UInt16.MaxValue)); return SetState((XInputUserIndex)index, ref vibration) == XInputErrorCode.Success; }