src/haptic/SDL_haptic.c
branchgsoc2008_force_feedback
changeset 2483 9d52368ebcf5
parent 2480 b883974445fc
child 2484 666472fd4cb0
     1.1 --- a/src/haptic/SDL_haptic.c	Tue Jul 01 11:21:36 2008 +0000
     1.2 +++ b/src/haptic/SDL_haptic.c	Tue Jul 01 14:09:53 2008 +0000
     1.3 @@ -324,4 +324,26 @@
     1.4     SDL_SYS_HapticDestroyEffect(haptic, &haptic->effects[effect]);
     1.5  }
     1.6  
     1.7 +/*
     1.8 + * Sets the global gain of the device.
     1.9 + */
    1.10 +int
    1.11 +SDL_HapticSetGain(SDL_Haptic * haptic, int gain )
    1.12 +{
    1.13 +   if (!ValidHaptic(&haptic)) {
    1.14 +      return -1;
    1.15 +   }
    1.16  
    1.17 +   if ((gain < 0) || (gain > 100)) {
    1.18 +      SDL_SetError("Haptic gain must be between 0 and 100.");
    1.19 +      return -1;
    1.20 +   }
    1.21 +
    1.22 +   if (SDL_SYS_HapticSetGain(haptic,gain) < 0) {
    1.23 +      return -1;
    1.24 +   }
    1.25 +
    1.26 +   return 0;
    1.27 +}
    1.28 +
    1.29 +