More verbose about envelopes. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Thu, 31 Jul 2008 10:25:49 +0000
branchgsoc2008_force_feedback
changeset 2563be2ea885d70b
parent 2562 c284ce0cd8e0
child 2564 c9348710a98a
More verbose about envelopes.
include/SDL_haptic.h
src/haptic/darwin/SDL_syshaptic.c
     1.1 --- a/include/SDL_haptic.h	Thu Jul 31 10:21:11 2008 +0000
     1.2 +++ b/include/SDL_haptic.h	Thu Jul 31 10:25:49 2008 +0000
     1.3 @@ -649,6 +649,9 @@
     1.4   *  use them if possible.  Buttons start at index 1 instead of index 0 like
     1.5   *  they joystick.
     1.6   *
     1.7 + * If both attack_length and fade_level are 0, the envelope is not used,
     1.8 + *  otherwise both values are used.
     1.9 + *
    1.10   * Common parts:
    1.11   * \code
    1.12   * // Replay - All effects have this
     2.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Thu Jul 31 10:21:11 2008 +0000
     2.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Thu Jul 31 10:25:49 2008 +0000
     2.3 @@ -655,17 +655,13 @@
     2.4           }
     2.5           
     2.6           /* Envelope */
     2.7 -         if (envelope->dwAttackTime == 0) {
     2.8 -            envelope->dwAttackLevel = constant->dwMagnitude
     2.9 +         if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
    2.10 +            SDL_free(envelope);
    2.11 +            dest->lpEnvelope = NULL;
    2.12           }
    2.13           else {
    2.14              envelope->dwAttackLevel = CONVERT(hap_constant->attack_level);
    2.15              envelope->dwAttackTime = hap_constant->attack_length * 1000;
    2.16 -         }
    2.17 -         if (envelope->dwFadeTime == 0) {
    2.18 -            envelope->dwFadeLevel = constant->dwMagnitude
    2.19 -         }
    2.20 -         else {
    2.21              envelope->dwFadeLevel = CONVERT(hap_constant->fade_level);
    2.22              envelope->dwFadeTime = hap_constant->fade_length * 1000;
    2.23           }
    2.24 @@ -705,17 +701,13 @@
    2.25           }
    2.26           
    2.27           /* Envelope */
    2.28 -         if (envelope->dwAttackTime == 0) {
    2.29 -            envelope->dwAttackLevel = periodic->dwMagnitude
    2.30 +         if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
    2.31 +            SDL_free(envelope);
    2.32 +            dest->lpEnvelope = NULL;
    2.33           }
    2.34           else {
    2.35              envelope->dwAttackLevel = CONVERT(hap_periodic->attack_level);
    2.36              envelope->dwAttackTime = hap_periodic->attack_length * 1000;
    2.37 -         }
    2.38 -         if (envelope->dwFadeTime == 0) {
    2.39 -            envelope->dwFadeLevel = periodic->dwMagnitude
    2.40 -         }
    2.41 -         else {
    2.42              envelope->dwFadeLevel = CONVERT(hap_periodic->fade_level);
    2.43              envelope->dwFadeTime = hap_periodic->fade_length * 1000;
    2.44           }
    2.45 @@ -796,17 +788,12 @@
    2.46           }
    2.47  
    2.48           /* Envelope */
    2.49 -         if (envelope->dwAttackTime == 0) {
    2.50 -            envelope->dwAttackLevel = ramp->dwMagnitude
    2.51 -         }
    2.52 +         if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
    2.53 +            SDL_free(envelope);
    2.54 +            dest->lpEnvelope = NULL;
    2.55           else {
    2.56              envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level);
    2.57              envelope->dwAttackTime = hap_ramp->attack_length * 1000;
    2.58 -         }
    2.59 -         if (envelope->dwFadeTime == 0) {
    2.60 -            envelope->dwFadeLevel = ramp->dwMagnitude
    2.61 -         }
    2.62 -         else {
    2.63              envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level);
    2.64              envelope->dwFadeTime = hap_ramp->fade_length * 1000;
    2.65           }
    2.66 @@ -845,17 +832,13 @@
    2.67           }
    2.68           
    2.69           /* Envelope */
    2.70 -         if (envelope->dwAttackTime == 0) {
    2.71 -            envelope->dwAttackLevel = custom->dwMagnitude
    2.72 +         if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
    2.73 +            SDL_free(envelope);
    2.74 +            dest->lpEnvelope = NULL;
    2.75           }
    2.76           else {
    2.77              envelope->dwAttackLevel = CONVERT(hap_custom->attack_level);
    2.78              envelope->dwAttackTime = hap_custom->attack_length * 1000;
    2.79 -         }
    2.80 -         if (envelope->dwFadeTime == 0) {
    2.81 -            envelope->dwFadeLevel = custom->dwMagnitude
    2.82 -         }
    2.83 -         else {
    2.84              envelope->dwFadeLevel = CONVERT(hap_custom->fade_level);
    2.85              envelope->dwFadeTime = hap_custom->fade_length * 1000;
    2.86           }