include/SDL_haptic.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 20 Feb 2011 10:54:44 -0800
changeset 5360 220d3af9121f
parent 5126 ad4141d88412
child 5535 96594ac5fd1a
permissions -rw-r--r--
Simple rumble API for haptic

Edgar Simo 2011-02-20 10:27:52 PST

Adding patch that adds a simplified API for the haptic subsystem built ontop of
the "real one" for those who want simple rumble without jumping through hoops.

Adds 4 functions:

- extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
- extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
- extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float
strength, Uint32 length );
- extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);

Also provided is test/testrumble.c which does test this.

This has all been tested on linux and has worked, but due to being built ontop
of the other haptic API it should work on all OS the same.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 2008 Edgar Simo
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  *  \file SDL_haptic.h
    25  *  
    26  *  \brief The SDL Haptic subsystem allows you to control haptic (force feedback)
    27  *         devices.
    28  * 
    29  *  The basic usage is as follows:
    30  *   - Initialize the Subsystem (::SDL_INIT_HAPTIC).
    31  *   - Open a Haptic Device.
    32  *    - SDL_HapticOpen() to open from index.
    33  *    - SDL_HapticOpenFromJoystick() to open from an existing joystick.
    34  *   - Create an effect (::SDL_HapticEffect).
    35  *   - Upload the effect with SDL_HapticNewEffect().
    36  *   - Run the effect with SDL_HapticRunEffect().
    37  *   - (optional) Free the effect with SDL_HapticDestroyEffect().
    38  *   - Close the haptic device with SDL_HapticClose().
    39  *
    40  * \par Simple rumble example:
    41  * \code
    42  *    SDL_Haptic *haptic;
    43  *
    44  *    // Open the device
    45  *    haptic = SDL_HapticOpen( 0 );
    46  *    if (haptic == NULL)
    47  *       return -1;
    48  *
    49  *    // Initialize simple rumble
    50  *    if (SDL_HapticRumbleInit( haptic ) != 0)
    51  *       return -1;
    52  *
    53  *    // Play effect at 50% strength for 2 seconds
    54  *    if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
    55  *       return -1;
    56  *    SDL_Delay( 2000 );
    57  *
    58  *    // Clean up
    59  *    SDL_HapticClose( haptic );
    60  * \endcode
    61  *
    62  * \par Complete example:
    63  * \code
    64  * int test_haptic( SDL_Joystick * joystick ) {
    65  *    SDL_Haptic *haptic;
    66  *    SDL_HapticEffect effect;
    67  *    int effect_id;
    68  *
    69  *    // Open the device
    70  *    haptic = SDL_HapticOpenFromJoystick( joystick );
    71  *    if (haptic == NULL) return -1; // Most likely joystick isn't haptic
    72  *
    73  *    // See if it can do sine waves
    74  *    if ((SDL_HapticQuery(haptic) & SDL_HAPTIC_SINE)==0) {
    75  *       SDL_HapticClose(haptic); // No sine effect
    76  *       return -1;
    77  *    }
    78  *
    79  *    // Create the effect
    80  *    memset( &effect, 0, sizeof(SDL_HapticEffect) ); // 0 is safe default
    81  *    effect.type = SDL_HAPTIC_SINE;
    82  *    effect.periodic.direction.type = SDL_HAPTIC_POLAR; // Polar coordinates
    83  *    effect.periodic.direction.dir[0] = 18000; // Force comes from south
    84  *    effect.periodic.period = 1000; // 1000 ms
    85  *    effect.periodic.magnitude = 20000; // 20000/32767 strength
    86  *    effect.periodic.length = 5000; // 5 seconds long
    87  *    effect.periodic.attack_length = 1000; // Takes 1 second to get max strength
    88  *    effect.periodic.fade_length = 1000; // Takes 1 second to fade away
    89  *
    90  *    // Upload the effect
    91  *    effect_id = SDL_HapticNewEffect( haptic, &effect );
    92  *
    93  *    // Test the effect
    94  *    SDL_HapticRunEffect( haptic, effect_id, 1 );
    95  *    SDL_Delay( 5000); // Wait for the effect to finish
    96  *
    97  *    // We destroy the effect, although closing the device also does this
    98  *    SDL_HapticDestroyEffect( haptic, effect_id );
    99  *
   100  *    // Close the device
   101  *    SDL_HapticClose(haptic);
   102  *
   103  *    return 0; // Success
   104  * }
   105  * \endcode
   106  *
   107  * You can also find out more information on my blog:
   108  * http://bobbens.dyndns.org/journal/2010/sdl_haptic/
   109  *
   110  * \author Edgar Simo Serra
   111  */
   112 
   113 #ifndef _SDL_haptic_h
   114 #define _SDL_haptic_h
   115 
   116 #include "SDL_stdinc.h"
   117 #include "SDL_error.h"
   118 #include "SDL_joystick.h"
   119 
   120 #include "begin_code.h"
   121 /* Set up for C function definitions, even when using C++ */
   122 #ifdef __cplusplus
   123 /* *INDENT-OFF* */
   124 extern "C" {
   125    /* *INDENT-ON* */                                                         
   126 #endif /* __cplusplus */
   127 
   128 /**
   129  *  \typedef SDL_Haptic
   130  *  
   131  *  \brief The haptic structure used to identify an SDL haptic.
   132  *  
   133  *  \sa SDL_HapticOpen
   134  *  \sa SDL_HapticOpenFromJoystick
   135  *  \sa SDL_HapticClose
   136  */
   137 struct _SDL_Haptic;
   138 typedef struct _SDL_Haptic SDL_Haptic;
   139 
   140 
   141 /**
   142  *  \name Haptic features
   143  *  
   144  *  Different haptic features a device can have.
   145  */
   146 /*@{*/
   147 
   148 /**
   149  *  \name Haptic effects
   150  */
   151 /*@{*/
   152 
   153 /**
   154  *  \brief Constant effect supported.
   155  *
   156  *  Constant haptic effect.
   157  *  
   158  *  \sa SDL_HapticCondition
   159  */
   160 #define SDL_HAPTIC_CONSTANT   (1<<0)
   161 
   162 /**
   163  *  \brief Sine wave effect supported.
   164  *  
   165  *  Periodic haptic effect that simulates sine waves.
   166  *  
   167  *  \sa SDL_HapticPeriodic
   168  */
   169 #define SDL_HAPTIC_SINE       (1<<1)
   170 
   171 /**
   172  *  \brief Square wave effect supported.
   173  *  
   174  *  Periodic haptic effect that simulates square waves.
   175  * 
   176  *  \sa SDL_HapticPeriodic
   177  */
   178 #define SDL_HAPTIC_SQUARE     (1<<2)
   179 
   180 /**
   181  *  \brief Triangle wave effect supported.
   182  *  
   183  *  Periodic haptic effect that simulates triangular waves.
   184  *  
   185  *  \sa SDL_HapticPeriodic
   186  */
   187 #define SDL_HAPTIC_TRIANGLE   (1<<3)
   188 
   189 /**
   190  *  \brief Sawtoothup wave effect supported.
   191  *  
   192  *  Periodic haptic effect that simulates saw tooth up waves.
   193  *  
   194  *  \sa SDL_HapticPeriodic
   195  */
   196 #define SDL_HAPTIC_SAWTOOTHUP (1<<4)
   197 
   198 /**
   199  *  \brief Sawtoothdown wave effect supported.
   200  *  
   201  *  Periodic haptic effect that simulates saw tooth down waves.
   202  *  
   203  *  \sa SDL_HapticPeriodic
   204  */
   205 #define SDL_HAPTIC_SAWTOOTHDOWN (1<<5)
   206 
   207 /**
   208  *  \brief Ramp effect supported.
   209  *  
   210  *  Ramp haptic effect.
   211  *  
   212  *  \sa SDL_HapticRamp
   213  */
   214 #define SDL_HAPTIC_RAMP       (1<<6)
   215 
   216 /**
   217  *  \brief Spring effect supported - uses axes position.
   218  *  
   219  *  Condition haptic effect that simulates a spring.  Effect is based on the
   220  *  axes position.
   221  *
   222  *  \sa SDL_HapticCondition
   223  */
   224 #define SDL_HAPTIC_SPRING     (1<<7)
   225 
   226 /**
   227  *  \brief Damper effect supported - uses axes velocity.
   228  *  
   229  *  Condition haptic effect that simulates dampening.  Effect is based on the
   230  *  axes velocity.
   231  *  
   232  *  \sa SDL_HapticCondition
   233  */
   234 #define SDL_HAPTIC_DAMPER     (1<<8)
   235 
   236 /**
   237  *  \brief Inertia effect supported - uses axes acceleration.
   238  *  
   239  *  Condition haptic effect that simulates inertia.  Effect is based on the axes
   240  *  acceleration.
   241  *
   242  *  \sa SDL_HapticCondition
   243  */
   244 #define SDL_HAPTIC_INERTIA    (1<<9)
   245 
   246 /**
   247  *  \brief Friction effect supported - uses axes movement.
   248  *  
   249  *  Condition haptic effect that simulates friction.  Effect is based on the 
   250  *  axes movement.
   251  *  
   252  *  \sa SDL_HapticCondition
   253  */
   254 #define SDL_HAPTIC_FRICTION   (1<<10)
   255 
   256 /**
   257  *  \brief Custom effect is supported.
   258  *  
   259  *  User defined custom haptic effect.
   260  */
   261 #define SDL_HAPTIC_CUSTOM     (1<<11)
   262 
   263 /*@}*//*Haptic effects*/
   264 
   265 /* These last few are features the device has, not effects */
   266 
   267 /**
   268  *  \brief Device can set global gain.
   269  *  
   270  *  Device supports setting the global gain.
   271  *  
   272  *  \sa SDL_HapticSetGain
   273  */
   274 #define SDL_HAPTIC_GAIN       (1<<12)
   275 
   276 /**
   277  *  \brief Device can set autocenter.
   278  *  
   279  *  Device supports setting autocenter.
   280  *  
   281  *  \sa SDL_HapticSetAutocenter
   282  */
   283 #define SDL_HAPTIC_AUTOCENTER (1<<13)
   284 
   285 /**
   286  *  \brief Device can be queried for effect status.
   287  *  
   288  *  Device can be queried for effect status.
   289  *  
   290  *  \sa SDL_HapticGetEffectStatus
   291  */
   292 #define SDL_HAPTIC_STATUS     (1<<14)
   293 
   294 /**
   295  *  \brief Device can be paused.
   296  *  
   297  *  \sa SDL_HapticPause
   298  *  \sa SDL_HapticUnpause
   299  */
   300 #define SDL_HAPTIC_PAUSE      (1<<15)
   301 
   302 
   303 /**
   304  * \name Direction encodings
   305  */
   306 /*@{*/
   307 
   308 /**
   309  *  \brief Uses polar coordinates for the direction.
   310  *  
   311  *  \sa SDL_HapticDirection
   312  */
   313 #define SDL_HAPTIC_POLAR      0
   314 
   315 /**
   316  *  \brief Uses cartesian coordinates for the direction.
   317  *  
   318  *  \sa SDL_HapticDirection
   319  */
   320 #define SDL_HAPTIC_CARTESIAN  1
   321 
   322 /**
   323  *  \brief Uses spherical coordinates for the direction.
   324  *  
   325  *  \sa SDL_HapticDirection
   326  */
   327 #define SDL_HAPTIC_SPHERICAL  2
   328 
   329 /*@}*//*Direction encodings*/
   330 
   331 /*@}*//*Haptic features*/
   332 
   333 /*
   334  * Misc defines.
   335  */
   336 
   337 /**
   338  * \brief Used to play a device an infinite number of times.
   339  *
   340  * \sa SDL_HapticRunEffect
   341  */
   342 #define SDL_HAPTIC_INFINITY   4294967295U
   343 
   344 
   345 /**
   346  *  \brief Structure that represents a haptic direction.
   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_SQUARE
   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 cyle meaning that giving the phase a value
   494  *  of 9000 will displace it 25% of it's period.  Here are sample values:
   495  *   -     0: No phase displacement.
   496  *   -  9000: Displaced 25% of it's period.
   497  *   - 18000: Displaced 50% of it's period.
   498  *   - 27000: Displaced 75% of it's period.
   499  *   - 36000: Displaced 100% of it's period, same as 0, but 0 is preffered.
   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_SQUARE
   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_SQUARE,
   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. */
   555     Sint16 offset;      /**< Mean value of the wave. */
   556     Uint16 phase;       /**< Horizontal shift given by hundredth of a cycle. */
   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. */
   606     Uint16 left_sat[3];     /**< Level when joystick is to the negative side. */
   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. */
   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  *  they 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 the ::SDL_HAPTIC_CUSTOM effect.
   653  *  
   654  *  A custom force feedback effect is much like a periodic effect, where the
   655  *  application can define it's exact shape.  You will have to allocate the
   656  *  data yourself.  Data should consist of channels * samples Uint16 samples.
   657  *  
   658  *  If channels is one, the effect is rotated using the defined direction.
   659  *  Otherwise it uses the samples in data for the different axes.
   660  *  
   661  *  \sa SDL_HAPTIC_CUSTOM
   662  *  \sa SDL_HapticEffect
   663  */
   664 typedef struct SDL_HapticCustom
   665 {
   666     /* Header */
   667     Uint16 type;            /**< ::SDL_HAPTIC_CUSTOM */
   668     SDL_HapticDirection direction;  /**< Direction of the effect. */
   669 
   670     /* Replay */
   671     Uint32 length;          /**< Duration of the effect. */
   672     Uint16 delay;           /**< Delay before starting the effect. */
   673 
   674     /* Trigger */
   675     Uint16 button;          /**< Button that triggers the effect. */
   676     Uint16 interval;        /**< How soon it can be triggered again after button. */
   677 
   678     /* Custom */
   679     Uint8 channels;         /**< Axes to use, minimum of one. */
   680     Uint16 period;          /**< Sample periods. */
   681     Uint16 samples;         /**< Amount of samples. */
   682     Uint16 *data;           /**< Should contain channels*samples items. */
   683 
   684     /* Envelope */
   685     Uint16 attack_length;   /**< Duration of the attack. */
   686     Uint16 attack_level;    /**< Level at the start of the attack. */
   687     Uint16 fade_length;     /**< Duration of the fade. */
   688     Uint16 fade_level;      /**< Level at the end of the fade. */
   689 } SDL_HapticCustom;
   690 
   691 /**
   692  *  \brief The generic template for any haptic effect.
   693  *  
   694  *  All values max at 32767 (0x7FFF).  Signed values also can be negative.
   695  *  Time values unless specified otherwise are in milliseconds.
   696  *  
   697  *  You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767 
   698  *  value.  Neither delay, interval, attack_length nor fade_length support 
   699  *  ::SDL_HAPTIC_INFINITY.  Fade will also not be used since effect never ends.
   700  *  
   701  *  Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
   702  *  ::SDL_HAPTIC_INFINITY.
   703  *  
   704  *  Button triggers may not be supported on all devices, it is advised to not
   705  *  use them if possible.  Buttons start at index 1 instead of index 0 like
   706  *  they joystick.
   707  *  
   708  *  If both attack_length and fade_level are 0, the envelope is not used,
   709  *  otherwise both values are used.
   710  *  
   711  *  Common parts:
   712  *  \code
   713  *  // Replay - All effects have this
   714  *  Uint32 length;        // Duration of effect (ms).
   715  *  Uint16 delay;         // Delay before starting effect.
   716  *  
   717  *  // Trigger - All effects have this
   718  *  Uint16 button;        // Button that triggers effect.
   719  *  Uint16 interval;      // How soon before effect can be triggered again.
   720  *  
   721  *  // Envelope - All effects except condition effects have this
   722  *  Uint16 attack_length; // Duration of the attack (ms).
   723  *  Uint16 attack_level;  // Level at the start of the attack.
   724  *  Uint16 fade_length;   // Duration of the fade out (ms).
   725  *  Uint16 fade_level;    // Level at the end of the fade.
   726  *  \endcode
   727  *
   728  *
   729  *  Here we have an example of a constant effect evolution in time:
   730  *  \verbatim
   731     Strength
   732     ^
   733     |
   734     |    effect level -->  _________________
   735     |                     /                 \
   736     |                    /                   \
   737     |                   /                     \
   738     |                  /                       \ 
   739     | attack_level --> |                        \
   740     |                  |                        |  <---  fade_level
   741     |
   742     +--------------------------------------------------> Time
   743                        [--]                 [---]
   744                        attack_length        fade_length
   745     
   746     [------------------][-----------------------]
   747     delay               length
   748     \endverbatim
   749  *  
   750  *  Note either the attack_level or the fade_level may be above the actual
   751  *  effect level.
   752  *
   753  *  \sa SDL_HapticConstant
   754  *  \sa SDL_HapticPeriodic
   755  *  \sa SDL_HapticCondition
   756  *  \sa SDL_HapticRamp
   757  *  \sa SDL_HapticCustom
   758  */
   759 typedef union SDL_HapticEffect
   760 {
   761     /* Common for all force feedback effects */
   762     Uint16 type;                    /**< Effect type. */
   763     SDL_HapticConstant constant;    /**< Constant effect. */
   764     SDL_HapticPeriodic periodic;    /**< Periodic effect. */
   765     SDL_HapticCondition condition;  /**< Condition effect. */
   766     SDL_HapticRamp ramp;            /**< Ramp effect. */
   767     SDL_HapticCustom custom;        /**< Custom effect. */
   768 } SDL_HapticEffect;
   769 
   770 
   771 /* Function prototypes */
   772 /**
   773  *  \brief Count the number of joysticks attached to the system.
   774  *  
   775  *  \return Number of haptic devices detected on the system.
   776  */
   777 extern DECLSPEC int SDLCALL SDL_NumHaptics(void);
   778 
   779 /**
   780  *  \brief Get the implementation dependent name of a Haptic device.
   781  *  
   782  *  This can be called before any joysticks are opened.
   783  *  If no name can be found, this function returns NULL.
   784  *  
   785  *  \param device_index Index of the device to get it's name.
   786  *  \return Name of the device or NULL on error.
   787  *
   788  *  \sa SDL_NumHaptics
   789  */
   790 extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
   791 
   792 /**
   793  *  \brief Opens a Haptic device for usage.
   794  *  
   795  *  The index passed as an argument refers to the N'th Haptic device on this 
   796  *  system.
   797  *
   798  *  When opening a haptic device, it's gain will be set to maximum and
   799  *  autocenter will be disabled.  To modify these values use
   800  *  SDL_HapticSetGain() and SDL_HapticSetAutocenter().
   801  *
   802  *  \param device_index Index of the device to open.
   803  *  \return Device identifier or NULL on error.
   804  *
   805  *  \sa SDL_HapticIndex
   806  *  \sa SDL_HapticOpenFromMouse
   807  *  \sa SDL_HapticOpenFromJoystick
   808  *  \sa SDL_HapticClose
   809  *  \sa SDL_HapticSetGain
   810  *  \sa SDL_HapticSetAutocenter
   811  *  \sa SDL_HapticPause
   812  *  \sa SDL_HapticStopAll
   813  */
   814 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
   815 
   816 /**
   817  *  \brief Checks if the haptic device at index has been opened.
   818  *  
   819  *  \param device_index Index to check to see if it has been opened.
   820  *  \return 1 if it has been opened or 0 if it hasn't.
   821  *  
   822  *  \sa SDL_HapticOpen
   823  *  \sa SDL_HapticIndex
   824  */
   825 extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
   826 
   827 /**
   828  *  \brief Gets the index of a haptic device.
   829  *  
   830  *  \param haptic Haptic device to get the index of.
   831  *  \return The index of the haptic device or -1 on error.
   832  *  
   833  *  \sa SDL_HapticOpen
   834  *  \sa SDL_HapticOpened
   835  */
   836 extern DECLSPEC int SDLCALL SDL_HapticIndex(SDL_Haptic * haptic);
   837 
   838 /**
   839  *  \brief Gets whether or not the current mouse has haptic capabilities.
   840  *  
   841  *  \return SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
   842  *  
   843  *  \sa SDL_HapticOpenFromMouse
   844  */
   845 extern DECLSPEC int SDLCALL SDL_MouseIsHaptic(void);
   846 
   847 /**
   848  *  \brief Tries to open a haptic device from the current mouse.
   849  *  
   850  *  \return The haptic device identifier or NULL on error.
   851  *  
   852  *  \sa SDL_MouseIsHaptic
   853  *  \sa SDL_HapticOpen
   854  */
   855 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
   856 
   857 /**
   858  *  \brief Checks to see if a joystick has haptic features.
   859  *  
   860  *  \param joystick Joystick to test for haptic capabilities.
   861  *  \return 1 if the joystick is haptic, 0 if it isn't
   862  *          or -1 if an error ocurred.
   863  *  
   864  *  \sa SDL_HapticOpenFromJoystick
   865  */
   866 extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
   867 
   868 /**
   869  *  \brief Opens a Haptic device for usage from a Joystick device.
   870  *  
   871  *  You must still close the haptic device seperately.  It will not be closed 
   872  *  with the joystick.
   873  *  
   874  *  When opening from a joystick you should first close the haptic device before
   875  *  closing the joystick device.  If not, on some implementations the haptic
   876  *  device will also get unallocated and you'll be unable to use force feedback
   877  *  on that device.
   878  *  
   879  *  \param joystick Joystick to create a haptic device from.
   880  *  \return A valid haptic device identifier on success or NULL on error.
   881  *  
   882  *  \sa SDL_HapticOpen
   883  *  \sa SDL_HapticClose
   884  */
   885 extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
   886                                                                joystick);
   887 
   888 /**
   889  *  \brief Closes a Haptic device previously opened with SDL_HapticOpen().
   890  *  
   891  *  \param haptic Haptic device to close.
   892  */
   893 extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
   894 
   895 /**
   896  *  \brief Returns the number of effects a haptic device can store.
   897  *  
   898  *  On some platforms this isn't fully supported, and therefore is an
   899  *  aproximation.  Always check to see if your created effect was actually
   900  *  created and do not rely solely on SDL_HapticNumEffects().
   901  *  
   902  *  \param haptic The haptic device to query effect max.
   903  *  \return The number of effects the haptic device can store or
   904  *          -1 on error.
   905  *  
   906  *  \sa SDL_HapticNumEffectsPlaying
   907  *  \sa SDL_HapticQuery
   908  */
   909 extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
   910 
   911 /**
   912  *  \brief Returns the number of effects a haptic device can play at the same 
   913  *         time.
   914  *  
   915  *  This is not supported on all platforms, but will always return a value.  
   916  *  Added here for the sake of completness.
   917  *  
   918  *  \param haptic The haptic device to query maximum playing effects.
   919  *  \return The number of effects the haptic device can play at the same time
   920  *          or -1 on error.
   921  *
   922  *  \sa SDL_HapticNumEffects
   923  *  \sa SDL_HapticQuery
   924  */
   925 extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
   926 
   927 /**
   928  *  \brief Gets the haptic devices supported features in bitwise matter.
   929  *  
   930  *  Example: 
   931  *  \code
   932  *  if (SDL_HapticQueryEffects(haptic) & SDL_HAPTIC_CONSTANT) {
   933  *      printf("We have constant haptic effect!");
   934  *  }
   935  *  \endcode
   936  *  
   937  *  \param haptic The haptic device to query.
   938  *  \return Haptic features in bitwise manner (OR'd).
   939  *  
   940  *  \sa SDL_HapticNumEffects
   941  *  \sa SDL_HapticEffectSupported
   942  */
   943 extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
   944 
   945 
   946 /**
   947  *  \brief Gets the number of haptic axes the device has.
   948  *  
   949  *  \sa SDL_HapticDirection
   950  */
   951 extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
   952 
   953 /**
   954  *  \brief Checks to see if effect is supported by haptic.
   955  *  
   956  *  \param haptic Haptic device to check on.
   957  *  \param effect Effect to check to see if it is supported.
   958  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
   959  *  
   960  *  \sa SDL_HapticQuery
   961  *  \sa SDL_HapticNewEffect
   962  */
   963 extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
   964                                                       SDL_HapticEffect *
   965                                                       effect);
   966 
   967 /**
   968  *  \brief Creates a new haptic effect on the device.
   969  *  
   970  *  \param haptic Haptic device to create the effect on.
   971  *  \param effect Properties of the effect to create.
   972  *  \return The id of the effect on success or -1 on error.
   973  *  
   974  *  \sa SDL_HapticUpdateEffect
   975  *  \sa SDL_HapticRunEffect
   976  *  \sa SDL_HapticDestroyEffect
   977  */
   978 extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
   979                                                 SDL_HapticEffect * effect);
   980 
   981 /**
   982  *  \brief Updates the properties of an effect.
   983  *  
   984  *  Can be used dynamically, although behaviour when dynamically changing
   985  *  direction may be strange.  Specifically the effect may reupload itself
   986  *  and start playing from the start.  You cannot change the type either when
   987  *  running SDL_HapticUpdateEffect().
   988  *  
   989  *  \param haptic Haptic device that has the effect.
   990  *  \param effect Effect to update.
   991  *  \param data New effect properties to use.
   992  *  \return The id of the effect on success or -1 on error.
   993  *  
   994  *  \sa SDL_HapticNewEffect
   995  *  \sa SDL_HapticRunEffect
   996  *  \sa SDL_HapticDestroyEffect
   997  */
   998 extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
   999                                                    int effect,
  1000                                                    SDL_HapticEffect * data);
  1001 
  1002 /**
  1003  *  \brief Runs the haptic effect on it's assosciated haptic device.
  1004  *  
  1005  *  If iterations are ::SDL_HAPTIC_INFINITY, it'll run the effect over and over
  1006  *  repeating the envelope (attack and fade) every time.  If you only want the
  1007  *  effect to last forever, set ::SDL_HAPTIC_INFINITY in the effect's length
  1008  *  parameter.
  1009  *  
  1010  *  \param haptic Haptic device to run the effect on.
  1011  *  \param effect Identifier of the haptic effect to run.
  1012  *  \param iterations Number of iterations to run the effect. Use
  1013  *         ::SDL_HAPTIC_INFINITY for infinity.
  1014  *  \return 0 on success or -1 on error.
  1015  *  
  1016  *  \sa SDL_HapticStopEffect
  1017  *  \sa SDL_HapticDestroyEffect
  1018  *  \sa SDL_HapticGetEffectStatus
  1019  */
  1020 extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
  1021                                                 int effect,
  1022                                                 Uint32 iterations);
  1023 
  1024 /**
  1025  *  \brief Stops the haptic effect on it's assosciated haptic device.
  1026  *  
  1027  *  \param haptic Haptic device to stop the effect on.
  1028  *  \param effect Identifier of the effect to stop.
  1029  *  \return 0 on success or -1 on error.
  1030  *  
  1031  *  \sa SDL_HapticRunEffect
  1032  *  \sa SDL_HapticDestroyEffect
  1033  */
  1034 extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
  1035                                                  int effect);
  1036 
  1037 /**
  1038  *  \brief Destroys a haptic effect on the device.
  1039  *  
  1040  *  This will stop the effect if it's running.  Effects are automatically 
  1041  *  destroyed when the device is closed.
  1042  *  
  1043  *  \param haptic Device to destroy the effect on.
  1044  *  \param effect Identifier of the effect to destroy.
  1045  *  
  1046  *  \sa SDL_HapticNewEffect
  1047  */
  1048 extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
  1049                                                      int effect);
  1050 
  1051 /**
  1052  *  \brief Gets the status of the current effect on the haptic device.
  1053  *  
  1054  *  Device must support the ::SDL_HAPTIC_STATUS feature.
  1055  *  
  1056  *  \param haptic Haptic device to query the effect status on.
  1057  *  \param effect Identifier of the effect to query it's status.
  1058  *  \return 0 if it isn't playing, ::SDL_HAPTIC_PLAYING if it is playing
  1059  *          or -1 on error.
  1060  *  
  1061  *  \sa SDL_HapticRunEffect
  1062  *  \sa SDL_HapticStopEffect
  1063  */
  1064 extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
  1065                                                       int effect);
  1066 
  1067 /**
  1068  *  \brief Sets the global gain of the device.
  1069  *  
  1070  *  Device must support the ::SDL_HAPTIC_GAIN feature.
  1071  *  
  1072  *  The user may specify the maxmimum gain by setting the environment variable
  1073  *  ::SDL_HAPTIC_GAIN_MAX which should be between 0 and 100.  All calls to
  1074  *  SDL_HapticSetGain() will scale linearly using ::SDL_HAPTIC_GAIN_MAX as the
  1075  *  maximum.
  1076  *  
  1077  *  \param haptic Haptic device to set the gain on.
  1078  *  \param gain Value to set the gain to, should be between 0 and 100.
  1079  *  \return 0 on success or -1 on error.
  1080  *  
  1081  *  \sa SDL_HapticQuery
  1082  */
  1083 extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
  1084 
  1085 /**
  1086  *  \brief Sets the global autocenter of the device.
  1087  *  
  1088  *  Autocenter should be between 0 and 100.  Setting it to 0 will disable 
  1089  *  autocentering.
  1090  *
  1091  *  Device must support the ::SDL_HAPTIC_AUTOCENTER feature.
  1092  *
  1093  *  \param haptic Haptic device to set autocentering on.
  1094  *  \param autocenter Value to set autocenter to, 0 disables autocentering.
  1095  *  \return 0 on success or -1 on error.
  1096  *  
  1097  *  \sa SDL_HapticQuery
  1098  */
  1099 extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
  1100                                                     int autocenter);
  1101 
  1102 /**
  1103  *  \brief Pauses a haptic device.
  1104  *  
  1105  *  Device must support the ::SDL_HAPTIC_PAUSE feature.  Call 
  1106  *  SDL_HapticUnpause() to resume playback.
  1107  *  
  1108  *  Do not modify the effects nor add new ones while the device is paused.
  1109  *  That can cause all sorts of weird errors.
  1110  *  
  1111  *  \param haptic Haptic device to pause.
  1112  *  \return 0 on success or -1 on error.
  1113  *  
  1114  *  \sa SDL_HapticUnpause
  1115  */
  1116 extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
  1117 
  1118 /**
  1119  *  \brief Unpauses a haptic device.
  1120  *  
  1121  *  Call to unpause after SDL_HapticPause().
  1122  *  
  1123  *  \param haptic Haptic device to pause.
  1124  *  \return 0 on success or -1 on error.
  1125  *  
  1126  *  \sa SDL_HapticPause
  1127  */
  1128 extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
  1129 
  1130 /**
  1131  *  \brief Stops all the currently playing effects on a haptic device.
  1132  *  
  1133  *  \param haptic Haptic device to stop.
  1134  *  \return 0 on success or -1 on error.
  1135  */
  1136 extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
  1137 
  1138 /**
  1139  *  \brief Checks to see if rumble is supported on a haptic device..
  1140  *
  1141  *  \param haptic Haptic device to check to see if it supports rumble.
  1142  *  \return SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
  1143  *
  1144  *  \sa SDL_HapticRumbleInit
  1145  *  \sa SDL_HapticRumblePlay
  1146  *  \sa SDL_HapticRumbleStop
  1147  */
  1148 extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
  1149 
  1150 /**
  1151  *  \brief Initializes the haptic device for simple rumble playback.
  1152  *
  1153  *  \param haptic Haptic device to initialize for simple rumble playback.
  1154  *  \return 0 on success or -1 on error.
  1155  *
  1156  *  \sa SDL_HapticOpen
  1157  *  \sa SDL_HapticRumbleSupported
  1158  *  \sa SDL_HapticRumblePlay
  1159  *  \sa SDL_HapticRumbleStop
  1160  */
  1161 extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
  1162 
  1163 /**
  1164  *  \brief Runs simple rumble on a haptic device
  1165  *
  1166  *  \param haptic Haptic device to play rumble effect on.
  1167  *  \param strength Strength of the rumble to play as a 0-1 float value.
  1168  *  \param length Length of the rumble to play in miliseconds.
  1169  *  \return 0 on success or -1 on error.
  1170  *
  1171  *  \sa SDL_HapticRumbleSupported
  1172  *  \sa SDL_HapticRumbleInit
  1173  *  \sa SDL_HapticRumbleStop
  1174  */
  1175 extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length );
  1176 
  1177 /**
  1178  *  \brief Stops the simple rumble on a haptic device.
  1179  *
  1180  *  \param haptic Haptic to stop the rumble on.
  1181  *  \return 0 on success or -1 on error.
  1182  *
  1183  *  \sa SDL_HapticRumbleSupported
  1184  *  \sa SDL_HapticRumbleInit
  1185  *  \sa SDL_HapticRumblePlay
  1186  */
  1187 extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic);
  1188 
  1189 
  1190 
  1191 /* Ends C function definitions when using C++ */
  1192 #ifdef __cplusplus
  1193 /* *INDENT-OFF* */
  1194 }
  1195 /* *INDENT-ON* */
  1196 #endif
  1197 #include "close_code.h"
  1198 
  1199 #endif /* _SDL_haptic_h */
  1200 
  1201 /* vi: set ts=4 sw=4 expandtab: */