We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1855 - [Post-2.0] [Patch] SDL_HapticRumble Support
Summary: [Post-2.0] [Patch] SDL_HapticRumble Support
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: haptic (show other bugs)
Version: HG 2.1
Hardware: All All
: P2 enhancement
Assignee: Edgar Simo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-19 04:52 UTC by Ethan Lee
Modified: 2013-08-13 20:37 UTC (History)
0 users

See Also:


Attachments
SDL_HapticRumble Patch (7.44 KB, application/octet-stream)
2013-05-19 04:52 UTC, Ethan Lee
Details
SDL_HapticRumble Patch (r2) (7.48 KB, patch)
2013-05-20 21:05 UTC, Ethan Lee
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ethan Lee 2013-05-19 04:52:44 UTC
Created attachment 1141 [details]
SDL_HapticRumble Patch

In XInput, you can use XINPUT_VIBRATION to control the left and right (or high-frequency and low-frequency) motors on a controller. On Linux, we have FF_RUMBLE.

This patch adds a HapticRumble struct and a new HapticEffect type, SDL_HAPTIC_RUMBLE.

While the addition itself seems trivial, the problem is that we already use all 16 bits for the type, so adding SDL_HAPTIC_RUMBLE requires changing type's type, which breaks the API. For something this trivial, I don't know if it's worth making that kind of change at the last minute... maybe for the next release?

You'll also notice that this only affects Windows and Linux. As far as I know, Apple's Force Feedback API does not have a feature like this, so on OSX, this will simply be unsupported for all Haptic devices.
Comment 1 Ethan Lee 2013-05-20 21:05:41 UTC
Created attachment 1146 [details]
SDL_HapticRumble Patch (r2)

Fix tabbing on struct SDL_HapticRumble
Comment 2 Edgar Simo 2013-05-21 12:31:54 UTC
Hello,


I never implemented FF_RUMBLE because of the following note [1]:

Note: In most cases you should use FF_PERIODIC instead of FF_RUMBLE. All
      devices that support FF_RUMBLE support FF_PERIODIC (square, triangle,
      sine) and the other way around.

I guess I didn't realize either that we were out of bits, or I would have gone with int32_t.

@sam You changed the version to HG2.1. I'm not sure how you guys are handling HG these days (totally out of the loop), I'm guessing you wouldn't want it for this months release yet?


[1]: https://www.kernel.org/doc/Documentation/input/ff.txt
Comment 3 Sam Lantinga 2013-05-21 23:49:25 UTC
I changed the version to 2.1 because SDL is ABI frozen for release.
Comment 4 Ethan Lee 2013-08-13 20:37:28 UTC
This now exists in SDL 2.0.0 as SDL_HAPTIC_LEFTRIGHT.