include/SDL_haptic.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 29 Nov 2014 11:49:58 -0800
changeset 9250 50fb32b7f2bd
parent 9249 35a4fab04296
child 9570 8681778c5ede
permissions -rw-r--r--
Fixed bug 2766 - Haptic coding bugs and fixes for Linux FF: periodic.phase handled as time instead of angle; + direction clarification

Elias Vanderstuyft

"Horizontal" is not very precise, use "Positive phase" instead.
"Positive" because it's actually waveform(2*pi*t + phase) instead of waveform(2*pi*t - phase).
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /**
    23  *  \file SDL_haptic.h
    24  *
    25  *  \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
    26  *         devices.
    27  *
    28  *  The basic usage is as follows:
    29  *   - Initialize the Subsystem (::SDL_INIT_HAPTIC).
    30  *   - Open a Haptic Device.
    31  *    - SDL_HapticOpen() to open from index.
    32  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
    33  *   - Create an effect (::SDL_HapticEffect).
    34  *   - Upload the effect with SDL_HapticNewEffect().
    35  *   - Run the effect with SDL_HapticRunEffect().
    36  *   - (optional) Free the effect with SDL_HapticDestroyEffect().
    37  *   - Close the haptic device with SDL_HapticClose().
    38  *
    39  * \par Simple rumble example:
    40  * \code
    41  *    SDL_Haptic *haptic;
    42  *
    43  *    // Open the device
    44  *    haptic = SDL_HapticOpen( 0 );
    45  *    if (haptic == NULL)
    46  *       return -1;
    47  *
    48  *    // Initialize simple rumble
    49  *    if (SDL_HapticRumbleInit( haptic ) != 0)
    50  *       return -1;
    51  *
    52  *    // Play effect at 50% strength for 2 seconds
    53  *    if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
    54  *       return -1;
    55  *    SDL_Delay( 2000 );
    56  *
    57  *    // Clean up
    58  *    SDL_HapticClose( haptic );
    59  * \endcode
    60  *
    61  * \par Complete example:
    62  * \code
    63  * int test_haptic( SDL_Joystick * joystick ) {
    64  *    SDL_Haptic *haptic;
    65  *    SDL_HapticEffect effect;
    66  *    int effect_id;
    67  *
    68  *    // Open the device
    69  *    haptic = SDL_HapticOpenFromJoystick( joystick );
    70  *    if (haptic == NULL) return -1; // Most likely joystick isn't haptic
    71  *
    72  *    // See if it can do sine waves
    73  *    if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
    74  *       SDL_HapticClose(haptic); // No sine effect
    75  *       return -1;
    76  *    }
    77  *
    78  *    // Create the effect
    79  *    memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
    80  *    effect.type = SDL_HAPTIC_SINE;
    81  *    effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
    82  *    effect.periodic.direction.dir[0] = 18000; // Force comes from south
    83  *    effect.periodic.period = 1000; // 1000 ms
    84  *    effect.periodic.magnitude = 20000; // 20000/32767 strength
    85  *    effect.periodic.length = 5000; // 5 seconds long
    86  *    effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
    87  *    effect.periodic.fade_length = 1000; // Takes 1 second to fade away
    88  *
    89  *    // Upload the effect
    90  *    effect_id = SDL_HapticNewEffect( haptic, &effect );
    91  *
    92  *    // Test the effect
    93  *    SDL_HapticRunEffect( haptic, effect_id, 1 );
    94  *    SDL_Delay( 5000); // Wait for the effect to finish
    95  *
    96  *    // We destroy the effect, although closing the device also does this
    97  *    SDL_HapticDestroyEffect( haptic, effect_id );
    98  *
    99  *    // Close the device
   100  *    SDL_HapticClose(haptic);
   101  *
   102  *    return 0; // Success
   103  * }
   104  * \endcode
   105  *
   106  * You can also find out more information on my blog:
   107  * http://bobbens.dyndns.org/journal/2010/sdl_haptic/
   108  *
   109  * \author Edgar Simo Serra
   110  */
   111 
   112 #ifndef _SDL_haptic_h
   113 #define _SDL_haptic_h
   114 
   115 #include "SDL_stdinc.h"
   116 #include "SDL_error.h"
   117 #include "SDL_joystick.h"
   118 
   119 #include "begin_code.h"
   120 /* Set up for C function definitions, even when using C++ */
   121 #ifdef __cplusplus
   122 extern "C" {
   123 #endif /* __cplusplus */
   124 
   125 /**
   126  *  \typedef SDL_Haptic
   127  *
   128  *  \brief The haptic structure used to identify an SDL haptic.
   129  *
   130  *  \sa SDL_HapticOpen
   131  *  \sa SDL_HapticOpenFromJoystick
   132  *  \sa SDL_HapticClose
   133  */
   134 struct _SDL_Haptic;
   135 typedef struct _SDL_Haptic SDL_Haptic;
   136 
   137 
   138 /**
   139  *  \name Haptic features
   140  *
   141  *  Different haptic features a device can have.
   142  */
   143 /* @{ */
   144 
   145 /**
   146  *  \name Haptic effects
   147  */
   148 /* @{ */
   149 
   150 /**
   151  *  \brief Constant effect supported.
   152  *
   153  *  Constant haptic effect.
   154  *
   155  *  \sa SDL_HapticCondition
   156  */
   157 #define SDL_HAPTIC_CONSTANT   (1<<0)
   158 
   159 /**
   160  *  \brief Sine wave effect supported.
   161  *
   162  *  Periodic haptic effect that simulates sine waves.
   163  *
   164  *  \sa SDL_HapticPeriodic
   165  */
   166 #define SDL_HAPTIC_SINE       (1<<1)
   167 
   168 /**
   169  *  \brief Left/Right effect supported.
   170  *
   171  *  Haptic effect for direct control over high/low frequency motors.
   172  *
   173  *  \sa SDL_HapticLeftRight
   174  * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
   175  *          we ran out of bits, and this is important for XInput devices.
   176  */
   177 #define SDL_HAPTIC_LEFTRIGHT     (1<<2)
   178 
   179 /* !!! FIXME: put this back when we have more bits in 2.1 */
   180 /* #define SDL_HAPTIC_SQUARE     (1<<2) */
   181 
   182 /**
   183  *  \brief Triangle wave effect supported.
   184  *
   185  *  Periodic haptic effect that simulates triangular waves.
   186  *
   187  *  \sa SDL_HapticPeriodic
   188  */
   189 #define SDL_HAPTIC_TRIANGLE   (1<<3)
   190 
   191 /**
   192  *  \brief Sawtoothup wave effect supported.
   193  *
   194  *  Periodic haptic effect that simulates saw tooth up waves.
   195  *
   196  *  \sa SDL_HapticPeriodic
   197  */
   198 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
   199 
   200 /**
   201  *  \brief Sawtoothdown wave effect supported.
   202  *
   203  *  Periodic haptic effect that simulates saw tooth down waves.
   204  *
   205  *  \sa SDL_HapticPeriodic
   206  */
   207 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
   208 
   209 /**
   210  *  \brief Ramp effect supported.
   211  *
   212  *  Ramp haptic effect.
   213  *
   214  *  \sa SDL_HapticRamp
   215  */
   216 #define SDL_HAPTIC_RAMP       (1<<6)
   217 
   218 /**
   219  *  \brief Spring effect supported - uses axes position.
   220  *
   221  *  Condition haptic effect that simulates a spring.  Effect is based on the
   222  *  axes position.
   223  *
   224  *  \sa SDL_HapticCondition
   225  */
   226 #define SDL_HAPTIC_SPRING     (1<<7)
   227 
   228 /**
   229  *  \brief Damper effect supported - uses axes velocity.
   230  *
   231  *  Condition haptic effect that simulates dampening.  Effect is based on the
   232  *  axes velocity.
   233  *
   234  *  \sa SDL_HapticCondition
   235  */
   236 #define SDL_HAPTIC_DAMPER     (1<<8)
   237 
   238 /**
   239  *  \brief Inertia effect supported - uses axes acceleration.
   240  *
   241  *  Condition haptic effect that simulates inertia.  Effect is based on the axes
   242  *  acceleration.
   243  *
   244  *  \sa SDL_HapticCondition
   245  */
   246 #define SDL_HAPTIC_INERTIA    (1<<9)
   247 
   248 /**
   249  *  \brief Friction effect supported - uses axes movement.
   250  *
   251  *  Condition haptic effect that simulates friction.  Effect is based on the
   252  *  axes movement.
   253  *
   254  *  \sa SDL_HapticCondition
   255  */
   256 #define SDL_HAPTIC_FRICTION   (1<<10)
   257 
   258 /**
   259  *  \brief Custom effect is supported.
   260  *
   261  *  User defined custom haptic effect.
   262  */
   263 #define SDL_HAPTIC_CUSTOM     (1<<11)
   264 
   265 /* @} *//* Haptic effects */
   266 
   267 /* These last few are features the device has, not effects */
   268 
   269 /**
   270  *  \brief Device can set global gain.
   271  *
   272  *  Device supports setting the global gain.
   273  *
   274  *  \sa SDL_HapticSetGain
   275  */
   276 #define SDL_HAPTIC_GAIN       (1<<12)
   277 
   278 /**
   279  *  \brief Device can set autocenter.
   280  *
   281  *  Device supports setting autocenter.
   282  *
   283  *  \sa SDL_HapticSetAutocenter
   284  */
   285 #define SDL_HAPTIC_AUTOCENTER (1<<13)
   286 
   287 /**
   288  *  \brief Device can be queried for effect status.
   289  *
   290  *  Device can be queried for effect status.
   291  *
   292  *  \sa SDL_HapticGetEffectStatus
   293  */
   294 #define SDL_HAPTIC_STATUS     (1<<14)
   295 
   296 /**
   297  *  \brief Device can be paused.
   298  *
   299  *  \sa SDL_HapticPause
   300  *  \sa SDL_HapticUnpause
   301  */
   302 #define SDL_HAPTIC_PAUSE      (1<<15)
   303 
   304 
   305 /**
   306  * \name Direction encodings
   307  */
   308 /* @{ */
   309 
   310 /**
   311  *  \brief Uses polar coordinates for the direction.
   312  *
   313  *  \sa SDL_HapticDirection
   314  */
   315 #define SDL_HAPTIC_POLAR      0
   316 
   317 /**
   318  *  \brief Uses cartesian coordinates for the direction.
   319  *
   320  *  \sa SDL_HapticDirection
   321  */
   322 #define SDL_HAPTIC_CARTESIAN  1
   323 
   324 /**
   325  *  \brief Uses spherical coordinates for the direction.
   326  *
   327  *  \sa SDL_HapticDirection
   328  */
   329 #define SDL_HAPTIC_SPHERICAL  2
   330 
   331 /* @} *//* Direction encodings */
   332 
   333 /* @} *//* Haptic features */
   334 
   335 /*
   336  * Misc defines.
   337  */
   338 
   339 /**
   340  * \brief Used to play a device an infinite number of times.
   341  *
   342  * \sa SDL_HapticRunEffect
   343  */
   344 #define SDL_HAPTIC_INFINITY   4294967295U
   345 
   346 
   347 /**
   348  *  \brief Structure that represents a haptic direction.
   349  *
   350  *  This is the direction where the force comes from,
   351  *  instead of the direction in which the force is exerted.
   352  *
   353  *  Directions can be specified by:
   354  *   - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
   355  *   - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
   356  *   - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
   357  *
   358  *  Cardinal directions of the haptic device are relative to the positioning
   359  *  of the device.  North is considered to be away from the user.
   360  *
   361  *  The following diagram represents the cardinal directions:
   362  *  \verbatim
   363                  .--.
   364                  |__| .-------.
   365                  |=.| |.-----.|
   366                  |--| ||     ||
   367                  |  | |'-----'|
   368                  |__|~')_____('
   369                    [ COMPUTER ]
   370 
   371 
   372                      North (0,-1)
   373                          ^
   374                          |
   375                          |
   376    (-1,0)  West <----[ HAPTIC ]----> East (1,0)
   377                          |
   378                          |
   379                          v
   380                       South (0,1)
   381 
   382 
   383                       [ USER ]
   384                         \|||/
   385                         (o o)
   386                   ---ooO-(_)-Ooo---
   387     \endverbatim
   388  *
   389  *  If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
   390  *  degree starting north and turning clockwise.  ::SDL_HAPTIC_POLAR only uses
   391  *  the first \c dir parameter.  The cardinal directions would be:
   392  *   - North: 0 (0 degrees)
   393  *   - East: 9000 (90 degrees)
   394  *   - South: 18000 (180 degrees)
   395  *   - West: 27000 (270 degrees)
   396  *
   397  *  If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
   398  *  (X axis, Y axis and Z axis (with 3 axes)).  ::SDL_HAPTIC_CARTESIAN uses
   399  *  the first three \c dir parameters.  The cardinal directions would be:
   400  *   - North:  0,-1, 0
   401  *   - East:   1, 0, 0
   402  *   - South:  0, 1, 0
   403  *   - West:  -1, 0, 0
   404  *
   405  *  The Z axis represents the height of the effect if supported, otherwise
   406  *  it's unused.  In cartesian encoding (1, 2) would be the same as (2, 4), you
   407  *  can use any multiple you want, only the direction matters.
   408  *
   409  *  If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
   410  *  The first two \c dir parameters are used.  The \c dir parameters are as
   411  *  follows (all values are in hundredths of degrees):
   412  *   - Degrees from (1, 0) rotated towards (0, 1).
   413  *   - Degrees towards (0, 0, 1) (device needs at least 3 axes).
   414  *
   415  *
   416  *  Example of force coming from the south with all encodings (force coming
   417  *  from the south means the user will have to pull the stick to counteract):
   418  *  \code
   419  *  SDL_HapticDirection direction;
   420  *
   421  *  // Cartesian directions
   422  *  direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding.
   423  *  direction.dir[0] = 0; // X position
   424  *  direction.dir[1] = 1; // Y position
   425  *  // Assuming the device has 2 axes, we don't need to specify third parameter.
   426  *
   427  *  // Polar directions
   428  *  direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding.
   429  *  direction.dir[0] = 18000; // Polar only uses first parameter
   430  *
   431  *  // Spherical coordinates
   432  *  direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
   433  *  direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
   434  *  \endcode
   435  *
   436  *  \sa SDL_HAPTIC_POLAR
   437  *  \sa SDL_HAPTIC_CARTESIAN
   438  *  \sa SDL_HAPTIC_SPHERICAL
   439  *  \sa SDL_HapticEffect
   440  *  \sa SDL_HapticNumAxes
   441  */
   442 typedef struct SDL_HapticDirection
   443 {
   444     Uint8 type;         /**< The type of encoding. */
   445     Sint32 dir[3];      /**< The encoded direction. */
   446 } SDL_HapticDirection;
   447 
   448 
   449 /**
   450  *  \brief A structure containing a template for a Constant effect.
   451  *
   452  *  The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect.
   453  *
   454  *  A constant effect applies a constant force in the specified direction
   455  *  to the joystick.
   456  *
   457  *  \sa SDL_HAPTIC_CONSTANT
   458  *  \sa SDL_HapticEffect
   459  */
   460 typedef struct SDL_HapticConstant
   461 {
   462     /* Header */
   463     Uint16 type;            /**< ::SDL_HAPTIC_CONSTANT */
   464     SDL_HapticDirection direction;  /**< Direction of the effect. */
   465 
   466     /* Replay */
   467     Uint32 length;          /**< Duration of the effect. */
   468     Uint16 delay;           /**< Delay before starting the effect. */
   469 
   470     /* Trigger */
   471     Uint16 button;          /**< Button that triggers the effect. */
   472     Uint16 interval;        /**< How soon it can be triggered again after button. */
   473 
   474     /* Constant */
   475     Sint16 level;           /**< Strength of the constant effect. */
   476 
   477     /* Envelope */
   478     Uint16 attack_length;   /**< Duration of the attack. */
   479     Uint16 attack_level;    /**< Level at the start of the attack. */
   480     Uint16 fade_length;     /**< Duration of the fade. */
   481     Uint16 fade_level;      /**< Level at the end of the fade. */
   482 } SDL_HapticConstant;
   483 
   484 /**
   485  *  \brief A structure containing a template for a Periodic effect.
   486  *
   487  *  The struct handles the following effects:
   488  *   - ::SDL_HAPTIC_SINE
   489  *   - ::SDL_HAPTIC_LEFTRIGHT
   490  *   - ::SDL_HAPTIC_TRIANGLE
   491  *   - ::SDL_HAPTIC_SAWTOOTHUP
   492  *   - ::SDL_HAPTIC_SAWTOOTHDOWN
   493  *
   494  *  A periodic effect consists in a wave-shaped effect that repeats itself
   495  *  over time.  The type determines the shape of the wave and the parameters
   496  *  determine the dimensions of the wave.
   497  *
   498  *  Phase is given by hundredth of a degree meaning that giving the phase a value
   499  *  of 9000 will displace it 25% of its period.  Here are sample values:
   500  *   -     0: No phase displacement.
   501  *   -  9000: Displaced 25% of its period.
   502  *   - 18000: Displaced 50% of its period.
   503  *   - 27000: Displaced 75% of its period.
   504  *   - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
   505  *
   506  *  Examples:
   507  *  \verbatim
   508     SDL_HAPTIC_SINE
   509       __      __      __      __
   510      /  \    /  \    /  \    /
   511     /    \__/    \__/    \__/
   512 
   513     SDL_HAPTIC_SQUARE
   514      __    __    __    __    __
   515     |  |  |  |  |  |  |  |  |  |
   516     |  |__|  |__|  |__|  |__|  |
   517 
   518     SDL_HAPTIC_TRIANGLE
   519       /\    /\    /\    /\    /\
   520      /  \  /  \  /  \  /  \  /
   521     /    \/    \/    \/    \/
   522 
   523     SDL_HAPTIC_SAWTOOTHUP
   524       /|  /|  /|  /|  /|  /|  /|
   525      / | / | / | / | / | / | / |
   526     /  |/  |/  |/  |/  |/  |/  |
   527 
   528     SDL_HAPTIC_SAWTOOTHDOWN
   529     \  |\  |\  |\  |\  |\  |\  |
   530      \ | \ | \ | \ | \ | \ | \ |
   531       \|  \|  \|  \|  \|  \|  \|
   532     \endverbatim
   533  *
   534  *  \sa SDL_HAPTIC_SINE
   535  *  \sa SDL_HAPTIC_LEFTRIGHT
   536  *  \sa SDL_HAPTIC_TRIANGLE
   537  *  \sa SDL_HAPTIC_SAWTOOTHUP
   538  *  \sa SDL_HAPTIC_SAWTOOTHDOWN
   539  *  \sa SDL_HapticEffect
   540  */
   541 typedef struct SDL_HapticPeriodic
   542 {
   543     /* Header */
   544     Uint16 type;        /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
   545                              ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
   546                              ::SDL_HAPTIC_SAWTOOTHDOWN */
   547     SDL_HapticDirection direction;  /**< Direction of the effect. */
   548 
   549     /* Replay */
   550     Uint32 length;      /**< Duration of the effect. */
   551     Uint16 delay;       /**< Delay before starting the effect. */
   552 
   553     /* Trigger */
   554     Uint16 button;      /**< Button that triggers the effect. */
   555     Uint16 interval;    /**< How soon it can be triggered again after button. */
   556 
   557     /* Periodic */
   558     Uint16 period;      /**< Period of the wave. */
   559     Sint16 magnitude;   /**< Peak value; if negative, equivalent to 180 degrees extra phase shift. */
   560     Sint16 offset;      /**< Mean value of the wave. */
   561     Uint16 phase;       /**< Positive phase shift given by hundredth of a degree. */
   562 
   563     /* Envelope */
   564     Uint16 attack_length;   /**< Duration of the attack. */
   565     Uint16 attack_level;    /**< Level at the start of the attack. */
   566     Uint16 fade_length; /**< Duration of the fade. */
   567     Uint16 fade_level;  /**< Level at the end of the fade. */
   568 } SDL_HapticPeriodic;
   569 
   570 /**
   571  *  \brief A structure containing a template for a Condition effect.
   572  *
   573  *  The struct handles the following effects:
   574  *   - ::SDL_HAPTIC_SPRING: Effect based on axes position.
   575  *   - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
   576  *   - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
   577  *   - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
   578  *
   579  *  Direction is handled by condition internals instead of a direction member.
   580  *  The condition effect specific members have three parameters.  The first
   581  *  refers to the X axis, the second refers to the Y axis and the third
   582  *  refers to the Z axis.  The right terms refer to the positive side of the
   583  *  axis and the left terms refer to the negative side of the axis.  Please
   584  *  refer to the ::SDL_HapticDirection diagram for which side is positive and
   585  *  which is negative.
   586  *
   587  *  \sa SDL_HapticDirection
   588  *  \sa SDL_HAPTIC_SPRING
   589  *  \sa SDL_HAPTIC_DAMPER
   590  *  \sa SDL_HAPTIC_INERTIA
   591  *  \sa SDL_HAPTIC_FRICTION
   592  *  \sa SDL_HapticEffect
   593  */
   594 typedef struct SDL_HapticCondition
   595 {
   596     /* Header */
   597     Uint16 type;            /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
   598                                  ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
   599     SDL_HapticDirection direction;  /**< Direction of the effect - Not used ATM. */
   600 
   601     /* Replay */
   602     Uint32 length;          /**< Duration of the effect. */
   603     Uint16 delay;           /**< Delay before starting the effect. */
   604 
   605     /* Trigger */
   606     Uint16 button;          /**< Button that triggers the effect. */
   607     Uint16 interval;        /**< How soon it can be triggered again after button. */
   608 
   609     /* Condition */
   610     Uint16 right_sat[3];    /**< Level when joystick is to the positive side; max 0xFFFF. */
   611     Uint16 left_sat[3];     /**< Level when joystick is to the negative side; max 0xFFFF. */
   612     Sint16 right_coeff[3];  /**< How fast to increase the force towards the positive side. */
   613     Sint16 left_coeff[3];   /**< How fast to increase the force towards the negative side. */
   614     Uint16 deadband[3];     /**< Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. */
   615     Sint16 center[3];       /**< Position of the dead zone. */
   616 } SDL_HapticCondition;
   617 
   618 /**
   619  *  \brief A structure containing a template for a Ramp effect.
   620  *
   621  *  This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
   622  *
   623  *  The ramp effect starts at start strength and ends at end strength.
   624  *  It augments in linear fashion.  If you use attack and fade with a ramp
   625  *  the effects get added to the ramp effect making the effect become
   626  *  quadratic instead of linear.
   627  *
   628  *  \sa SDL_HAPTIC_RAMP
   629  *  \sa SDL_HapticEffect
   630  */
   631 typedef struct SDL_HapticRamp
   632 {
   633     /* Header */
   634     Uint16 type;            /**< ::SDL_HAPTIC_RAMP */
   635     SDL_HapticDirection direction;  /**< Direction of the effect. */
   636 
   637     /* Replay */
   638     Uint32 length;          /**< Duration of the effect. */
   639     Uint16 delay;           /**< Delay before starting the effect. */
   640 
   641     /* Trigger */
   642     Uint16 button;          /**< Button that triggers the effect. */
   643     Uint16 interval;        /**< How soon it can be triggered again after button. */
   644 
   645     /* Ramp */
   646     Sint16 start;           /**< Beginning strength level. */
   647     Sint16 end;             /**< Ending strength level. */
   648 
   649     /* Envelope */
   650     Uint16 attack_length;   /**< Duration of the attack. */
   651     Uint16 attack_level;    /**< Level at the start of the attack. */
   652     Uint16 fade_length;     /**< Duration of the fade. */
   653     Uint16 fade_level;      /**< Level at the end of the fade. */
   654 } SDL_HapticRamp;
   655 
   656 /**
   657  * \brief A structure containing a template for a Left/Right effect.
   658  *
   659  * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
   660  *
   661  * The Left/Right effect is used to explicitly control the large and small
   662  * motors, commonly found in modern game controllers. One motor is high
   663  * frequency, the other is low frequency.
   664  *
   665  * \sa SDL_HAPTIC_LEFTRIGHT
   666  * \sa SDL_HapticEffect
   667  */
   668 typedef struct SDL_HapticLeftRight
   669 {
   670     /* Header */
   671     Uint16 type;            /**< ::SDL_HAPTIC_LEFTRIGHT */
   672 
   673     /* Replay */
   674     Uint32 length;          /**< Duration of the effect. */
   675 
   676     /* Rumble */
   677     Uint16 large_magnitude; /**< Control of the large controller motor. */
   678     Uint16 small_magnitude; /**< Control of the small controller motor. */
   679 } SDL_HapticLeftRight;
   680 
   681 /**
   682  *  \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
   683  *
   684  *  A custom force feedback effect is much like a periodic effect, where the
   685  *  application can define its exact shape.  You will have to allocate the
   686  *  data yourself.  Data should consist of channels * samples Uint16 samples.
   687  *
   688  *  If channels is one, the effect is rotated using the defined direction.
   689  *  Otherwise it uses the samples in data for the different axes.
   690  *
   691  *  \sa SDL_HAPTIC_CUSTOM
   692  *  \sa SDL_HapticEffect
   693  */
   694 typedef struct SDL_HapticCustom
   695 {
   696     /* Header */
   697     Uint16 type;            /**< ::SDL_HAPTIC_CUSTOM */
   698     SDL_HapticDirection direction;  /**< Direction of the effect. */
   699 
   700     /* Replay */
   701     Uint32 length;          /**< Duration of the effect. */
   702     Uint16 delay;           /**< Delay before starting the effect. */
   703 
   704     /* Trigger */
   705     Uint16 button;          /**< Button that triggers the effect. */
   706     Uint16 interval;        /**< How soon it can be triggered again after button. */
   707 
   708     /* Custom */
   709     Uint8 channels;         /**< Axes to use, minimum of one. */
   710     Uint16 period;          /**< Sample periods. */
   711     Uint16 samples;         /**< Amount of samples. */
   712     Uint16 *data;           /**< Should contain channels*samples items. */
   713 
   714     /* Envelope */
   715     Uint16 attack_length;   /**< Duration of the attack. */
   716     Uint16 attack_level;    /**< Level at the start of the attack. */
   717     Uint16 fade_length;     /**< Duration of the fade. */
   718     Uint16 fade_level;      /**< Level at the end of the fade. */
   719 } SDL_HapticCustom;
   720 
   721 /**
   722  *  \brief The generic template for any haptic effect.
   723  *
   724  *  All values max at 32767 (0x7FFF).  Signed values also can be negative.
   725  *  Time values unless specified otherwise are in milliseconds.
   726  *
   727  *  You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
   728  *  value.  Neither delay, interval, attack_length nor fade_length support
   729  *  ::SDL_HAPTIC_INFINITY.  Fade will also not be used since effect never ends.
   730  *
   731  *  Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
   732  *  ::SDL_HAPTIC_INFINITY.
   733  *
   734  *  Button triggers may not be supported on all devices, it is advised to not
   735  *  use them if possible.  Buttons start at index 1 instead of index 0 like
   736  *  the joystick.
   737  *
   738  *  If both attack_length and fade_level are 0, the envelope is not used,
   739  *  otherwise both values are used.
   740  *
   741  *  Common parts:
   742  *  \code
   743  *  // Replay - All effects have this
   744  *  Uint32 length;        // Duration of effect (ms).
   745  *  Uint16 delay;         // Delay before starting effect.
   746  *
   747  *  // Trigger - All effects have this
   748  *  Uint16 button;        // Button that triggers effect.
   749  *  Uint16 interval;      // How soon before effect can be triggered again.
   750  *
   751  *  // Envelope - All effects except condition effects have this
   752  *  Uint16 attack_length; // Duration of the attack (ms).
   753  *  Uint16 attack_level;  // Level at the start of the attack.
   754  *  Uint16 fade_length;   // Duration of the fade out (ms).
   755  *  Uint16 fade_level;    // Level at the end of the fade.
   756  *  \endcode
   757  *
   758  *
   759  *  Here we have an example of a constant effect evolution in time:
   760  *  \verbatim
   761     Strength
   762     ^
   763     |
   764     |    effect level -->  _________________
   765     |                     /                 \
   766     |                    /                   \
   767     |                   /                     \
   768     |                  /                       \
   769     | attack_level --> |                        \
   770     |                  |                        |  <---  fade_level
   771     |
   772     +--------------------------------------------------> Time
   773                        [--]                 [---]
   774                        attack_length        fade_length
   775 
   776     [------------------][-----------------------]
   777     delay               length
   778     \endverbatim
   779  *
   780  *  Note either the attack_level or the fade_level may be above the actual
   781  *  effect level.
   782  *
   783  *  \sa SDL_HapticConstant
   784  *  \sa SDL_HapticPeriodic
   785  *  \sa SDL_HapticCondition
   786  *  \sa SDL_HapticRamp
   787  *  \sa SDL_HapticLeftRight
   788  *  \sa SDL_HapticCustom
   789  */
   790 typedef union SDL_HapticEffect
   791 {
   792     /* Common for all force feedback effects */
   793     Uint16 type;                    /**< Effect type. */
   794     SDL_HapticConstant constant;    /**< Constant effect. */
   795     SDL_HapticPeriodic periodic;    /**< Periodic effect. */
   796     SDL_HapticCondition condition;  /**< Condition effect. */
   797     SDL_HapticRamp ramp;            /**< Ramp effect. */
   798     SDL_HapticLeftRight leftright;  /**< Left/Right effect. */
   799     SDL_HapticCustom custom;        /**< Custom effect. */
   800 } SDL_HapticEffect;
   801 
   802 
   803 /* Function prototypes */
   804 /**
   805  *  \brief Count the number of haptic devices attached to the system.
   806  *
   807  *  \return Number of haptic devices detected on the system.
   808  */
   809 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
   810 
   811 /**
   812  *  \brief Get the implementation dependent name of a Haptic device.
   813  *
   814  *  This can be called before any joysticks are opened.
   815  *  If no name can be found, this function returns NULL.
   816  *
   817  *  \param device_index Index of the device to get its name.
   818  *  \return Name of the device or NULL on error.
   819  *
   820  *  \sa SDL_NumHaptics
   821  */
   822 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
   823 
   824 /**
   825  *  \brief Opens a Haptic device for usage.
   826  *
   827  *  The index passed as an argument refers to the N'th Haptic device on this
   828  *  system.
   829  *
   830  *  When opening a haptic device, its gain will be set to maximum and
   831  *  autocenter will be disabled.  To modify these values use
   832  *  SDL_HapticSetGain() and SDL_HapticSetAutocenter().
   833  *
   834  *  \param device_index Index of the device to open.
   835  *  \return Device identifier or NULL on error.
   836  *
   837  *  \sa SDL_HapticIndex
   838  *  \sa SDL_HapticOpenFromMouse
   839  *  \sa SDL_HapticOpenFromJoystick
   840  *  \sa SDL_HapticClose
   841  *  \sa SDL_HapticSetGain
   842  *  \sa SDL_HapticSetAutocenter
   843  *  \sa SDL_HapticPause
   844  *  \sa SDL_HapticStopAll
   845  */
   846 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
   847 
   848 /**
   849  *  \brief Checks if the haptic device at index has been opened.
   850  *
   851  *  \param device_index Index to check to see if it has been opened.
   852  *  \return 1 if it has been opened or 0 if it hasn't.
   853  *
   854  *  \sa SDL_HapticOpen
   855  *  \sa SDL_HapticIndex
   856  */
   857 extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
   858 
   859 /**
   860  *  \brief Gets the index of a haptic device.
   861  *
   862  *  \param haptic Haptic device to get the index of.
   863  *  \return The index of the haptic device or -1 on error.
   864  *
   865  *  \sa SDL_HapticOpen
   866  *  \sa SDL_HapticOpened
   867  */
   868 extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
   869 
   870 /**
   871  *  \brief Gets whether or not the current mouse has haptic capabilities.
   872  *
   873  *  \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
   874  *
   875  *  \sa SDL_HapticOpenFromMouse
   876  */
   877 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
   878 
   879 /**
   880  *  \brief Tries to open a haptic device from the current mouse.
   881  *
   882  *  \return The haptic device identifier or NULL on error.
   883  *
   884  *  \sa SDL_MouseIsHaptic
   885  *  \sa SDL_HapticOpen
   886  */
   887 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
   888 
   889 /**
   890  *  \brief Checks to see if a joystick has haptic features.
   891  *
   892  *  \param joystick Joystick to test for haptic capabilities.
   893  *  \return 1 if the joystick is haptic, 0 if it isn't
   894  *          or -1 if an error ocurred.
   895  *
   896  *  \sa SDL_HapticOpenFromJoystick
   897  */
   898 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
   899 
   900 /**
   901  *  \brief Opens a Haptic device for usage from a Joystick device.
   902  *
   903  *  You must still close the haptic device seperately.  It will not be closed
   904  *  with the joystick.
   905  *
   906  *  When opening from a joystick you should first close the haptic device before
   907  *  closing the joystick device.  If not, on some implementations the haptic
   908  *  device will also get unallocated and you'll be unable to use force feedback
   909  *  on that device.
   910  *
   911  *  \param joystick Joystick to create a haptic device from.
   912  *  \return A valid haptic device identifier on success or NULL on error.
   913  *
   914  *  \sa SDL_HapticOpen
   915  *  \sa SDL_HapticClose
   916  */
   917 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
   918                                                                joystick);
   919 
   920 /**
   921  *  \brief Closes a Haptic device previously opened with SDL_HapticOpen().
   922  *
   923  *  \param haptic Haptic device to close.
   924  */
   925 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
   926 
   927 /**
   928  *  \brief Returns the number of effects a haptic device can store.
   929  *
   930  *  On some platforms this isn't fully supported, and therefore is an
   931  *  approximation.  Always check to see if your created effect was actually
   932  *  created and do not rely solely on SDL_HapticNumEffects().
   933  *
   934  *  \param haptic The haptic device to query effect max.
   935  *  \return The number of effects the haptic device can store or
   936  *          -1 on error.
   937  *
   938  *  \sa SDL_HapticNumEffectsPlaying
   939  *  \sa SDL_HapticQuery
   940  */
   941 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
   942 
   943 /**
   944  *  \brief Returns the number of effects a haptic device can play at the same
   945  *         time.
   946  *
   947  *  This is not supported on all platforms, but will always return a value.
   948  *  Added here for the sake of completeness.
   949  *
   950  *  \param haptic The haptic device to query maximum playing effects.
   951  *  \return The number of effects the haptic device can play at the same time
   952  *          or -1 on error.
   953  *
   954  *  \sa SDL_HapticNumEffects
   955  *  \sa SDL_HapticQuery
   956  */
   957 extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
   958 
   959 /**
   960  *  \brief Gets the haptic devices supported features in bitwise matter.
   961  *
   962  *  Example:
   963  *  \code
   964  *  if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) {
   965  *      printf("We have constant haptic effect!");
   966  *  }
   967  *  \endcode
   968  *
   969  *  \param haptic The haptic device to query.
   970  *  \return Haptic features in bitwise manner (OR'd).
   971  *
   972  *  \sa SDL_HapticNumEffects
   973  *  \sa SDL_HapticEffectSupported
   974  */
   975 extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
   976 
   977 
   978 /**
   979  *  \brief Gets the number of haptic axes the device has.
   980  *
   981  *  \sa SDL_HapticDirection
   982  */
   983 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
   984 
   985 /**
   986  *  \brief Checks to see if effect is supported by haptic.
   987  *
   988  *  \param haptic Haptic device to check on.
   989  *  \param effect Effect to check to see if it is supported.
   990  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
   991  *
   992  *  \sa SDL_HapticQuery
   993  *  \sa SDL_HapticNewEffect
   994  */
   995 extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
   996                                                       SDL_HapticEffect *
   997                                                       effect);
   998 
   999 /**
  1000  *  \brief Creates a new haptic effect on the device.
  1001  *
  1002  *  \param haptic Haptic device to create the effect on.
  1003  *  \param effect Properties of the effect to create.
  1004  *  \return The id of the effect on success or -1 on error.
  1005  *
  1006  *  \sa SDL_HapticUpdateEffect
  1007  *  \sa SDL_HapticRunEffect
  1008  *  \sa SDL_HapticDestroyEffect
  1009  */
  1010 extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
  1011                                                 SDL_HapticEffect * effect);
  1012 
  1013 /**
  1014  *  \brief Updates the properties of an effect.
  1015  *
  1016  *  Can be used dynamically, although behaviour when dynamically changing
  1017  *  direction may be strange.  Specifically the effect may reupload itself
  1018  *  and start playing from the start.  You cannot change the type either when
  1019  *  running SDL_HapticUpdateEffect().
  1020  *
  1021  *  \param haptic Haptic device that has the effect.
  1022  *  \param effect Effect to update.
  1023  *  \param data New effect properties to use.
  1024  *  \return 0 on success or -1 on error.
  1025  *
  1026  *  \sa SDL_HapticNewEffect
  1027  *  \sa SDL_HapticRunEffect
  1028  *  \sa SDL_HapticDestroyEffect
  1029  */
  1030 extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
  1031                                                    int effect,
  1032                                                    SDL_HapticEffect * data);
  1033 
  1034 /**
  1035  *  \brief Runs the haptic effect on its associated haptic device.
  1036  *
  1037  *  If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
  1038  *  repeating the envelope (attack and fade) every time.  If you only want the
  1039  *  effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
  1040  *  parameter.
  1041  *
  1042  *  \param haptic Haptic device to run the effect on.
  1043  *  \param effect Identifier of the haptic effect to run.
  1044  *  \param iterations Number of iterations to run the effect. Use
  1045  *         ::SDL_HAPTIC_INFINITY for infinity.
  1046  *  \return 0 on success or -1 on error.
  1047  *
  1048  *  \sa SDL_HapticStopEffect
  1049  *  \sa SDL_HapticDestroyEffect
  1050  *  \sa SDL_HapticGetEffectStatus
  1051  */
  1052 extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
  1053                                                 int effect,
  1054                                                 Uint32 iterations);
  1055 
  1056 /**
  1057  *  \brief Stops the haptic effect on its associated haptic device.
  1058  *
  1059  *  \param haptic Haptic device to stop the effect on.
  1060  *  \param effect Identifier of the effect to stop.
  1061  *  \return 0 on success or -1 on error.
  1062  *
  1063  *  \sa SDL_HapticRunEffect
  1064  *  \sa SDL_HapticDestroyEffect
  1065  */
  1066 extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
  1067                                                  int effect);
  1068 
  1069 /**
  1070  *  \brief Destroys a haptic effect on the device.
  1071  *
  1072  *  This will stop the effect if it's running.  Effects are automatically
  1073  *  destroyed when the device is closed.
  1074  *
  1075  *  \param haptic Device to destroy the effect on.
  1076  *  \param effect Identifier of the effect to destroy.
  1077  *
  1078  *  \sa SDL_HapticNewEffect
  1079  */
  1080 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
  1081                                                      int effect);
  1082 
  1083 /**
  1084  *  \brief Gets the status of the current effect on the haptic device.
  1085  *
  1086  *  Device must support the ::SDL_HAPTIC_STATUS feature.
  1087  *
  1088  *  \param haptic Haptic device to query the effect status on.
  1089  *  \param effect Identifier of the effect to query its status.
  1090  *  \return 0 if it isn't playing, 1 if it is playing or -1 on error.
  1091  *
  1092  *  \sa SDL_HapticRunEffect
  1093  *  \sa SDL_HapticStopEffect
  1094  */
  1095 extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
  1096                                                       int effect);
  1097 
  1098 /**
  1099  *  \brief Sets the global gain of the device.
  1100  *
  1101  *  Device must support the ::SDL_HAPTIC_GAIN feature.
  1102  *
  1103  *  The user may specify the maximum gain by setting the environment variable
  1104  *  SDL_HAPTIC_GAIN_MAX which should be between 0 and 100.  All calls to
  1105  *  SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the
  1106  *  maximum.
  1107  *
  1108  *  \param haptic Haptic device to set the gain on.
  1109  *  \param gain Value to set the gain to, should be between 0 and 100.
  1110  *  \return 0 on success or -1 on error.
  1111  *
  1112  *  \sa SDL_HapticQuery
  1113  */
  1114 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
  1115 
  1116 /**
  1117  *  \brief Sets the global autocenter of the device.
  1118  *
  1119  *  Autocenter should be between 0 and 100.  Setting it to 0 will disable
  1120  *  autocentering.
  1121  *
  1122  *  Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
  1123  *
  1124  *  \param haptic Haptic device to set autocentering on.
  1125  *  \param autocenter Value to set autocenter to, 0 disables autocentering.
  1126  *  \return 0 on success or -1 on error.
  1127  *
  1128  *  \sa SDL_HapticQuery
  1129  */
  1130 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
  1131                                                     int autocenter);
  1132 
  1133 /**
  1134  *  \brief Pauses a haptic device.
  1135  *
  1136  *  Device must support the ::SDL_HAPTIC_PAUSE feature.  Call
  1137  *  SDL_HapticUnpause() to resume playback.
  1138  *
  1139  *  Do not modify the effects nor add new ones while the device is paused.
  1140  *  That can cause all sorts of weird errors.
  1141  *
  1142  *  \param haptic Haptic device to pause.
  1143  *  \return 0 on success or -1 on error.
  1144  *
  1145  *  \sa SDL_HapticUnpause
  1146  */
  1147 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
  1148 
  1149 /**
  1150  *  \brief Unpauses a haptic device.
  1151  *
  1152  *  Call to unpause after SDL_HapticPause().
  1153  *
  1154  *  \param haptic Haptic device to unpause.
  1155  *  \return 0 on success or -1 on error.
  1156  *
  1157  *  \sa SDL_HapticPause
  1158  */
  1159 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
  1160 
  1161 /**
  1162  *  \brief Stops all the currently playing effects on a haptic device.
  1163  *
  1164  *  \param haptic Haptic device to stop.
  1165  *  \return 0 on success or -1 on error.
  1166  */
  1167 extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
  1168 
  1169 /**
  1170  *  \brief Checks to see if rumble is supported on a haptic device.
  1171  *
  1172  *  \param haptic Haptic device to check to see if it supports rumble.
  1173  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
  1174  *
  1175  *  \sa SDL_HapticRumbleInit
  1176  *  \sa SDL_HapticRumblePlay
  1177  *  \sa SDL_HapticRumbleStop
  1178  */
  1179 extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
  1180 
  1181 /**
  1182  *  \brief Initializes the haptic device for simple rumble playback.
  1183  *
  1184  *  \param haptic Haptic device to initialize for simple rumble playback.
  1185  *  \return 0 on success or -1 on error.
  1186  *
  1187  *  \sa SDL_HapticOpen
  1188  *  \sa SDL_HapticRumbleSupported
  1189  *  \sa SDL_HapticRumblePlay
  1190  *  \sa SDL_HapticRumbleStop
  1191  */
  1192 extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
  1193 
  1194 /**
  1195  *  \brief Runs simple rumble on a haptic device
  1196  *
  1197  *  \param haptic Haptic device to play rumble effect on.
  1198  *  \param strength Strength of the rumble to play as a 0-1 float value.
  1199  *  \param length Length of the rumble to play in milliseconds.
  1200  *  \return 0 on success or -1 on error.
  1201  *
  1202  *  \sa SDL_HapticRumbleSupported
  1203  *  \sa SDL_HapticRumbleInit
  1204  *  \sa SDL_HapticRumbleStop
  1205  */
  1206 extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
  1207 
  1208 /**
  1209  *  \brief Stops the simple rumble on a haptic device.
  1210  *
  1211  *  \param haptic Haptic to stop the rumble on.
  1212  *  \return 0 on success or -1 on error.
  1213  *
  1214  *  \sa SDL_HapticRumbleSupported
  1215  *  \sa SDL_HapticRumbleInit
  1216  *  \sa SDL_HapticRumblePlay
  1217  */
  1218 extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
  1219 
  1220 /* Ends C function definitions when using C++ */
  1221 #ifdef __cplusplus
  1222 }
  1223 #endif
  1224 #include "close_code.h"
  1225 
  1226 #endif /* _SDL_haptic_h */
  1227 
  1228 /* vi: set ts=4 sw=4 expandtab: */