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