Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
More verbose about envelopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Jul 31, 2008
1 parent 2cca4cd commit 8a56d7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 29 deletions.
3 changes: 3 additions & 0 deletions include/SDL_haptic.h
Expand Up @@ -649,6 +649,9 @@ typedef struct SDL_HapticCustom {
* use them if possible. Buttons start at index 1 instead of index 0 like
* they joystick.
*
* If both attack_length and fade_level are 0, the envelope is not used,
* otherwise both values are used.
*
* Common parts:
* \code
* // Replay - All effects have this
Expand Down
41 changes: 12 additions & 29 deletions src/haptic/darwin/SDL_syshaptic.c
Expand Up @@ -655,17 +655,13 @@ SDL_SYS_ToFFEFFECT( SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src
}

/* Envelope */
if (envelope->dwAttackTime == 0) {
envelope->dwAttackLevel = constant->dwMagnitude
if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
}
else {
envelope->dwAttackLevel = CONVERT(hap_constant->attack_level);
envelope->dwAttackTime = hap_constant->attack_length * 1000;
}
if (envelope->dwFadeTime == 0) {
envelope->dwFadeLevel = constant->dwMagnitude
}
else {
envelope->dwFadeLevel = CONVERT(hap_constant->fade_level);
envelope->dwFadeTime = hap_constant->fade_length * 1000;
}
Expand Down Expand Up @@ -705,17 +701,13 @@ SDL_SYS_ToFFEFFECT( SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src
}

/* Envelope */
if (envelope->dwAttackTime == 0) {
envelope->dwAttackLevel = periodic->dwMagnitude
if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
}
else {
envelope->dwAttackLevel = CONVERT(hap_periodic->attack_level);
envelope->dwAttackTime = hap_periodic->attack_length * 1000;
}
if (envelope->dwFadeTime == 0) {
envelope->dwFadeLevel = periodic->dwMagnitude
}
else {
envelope->dwFadeLevel = CONVERT(hap_periodic->fade_level);
envelope->dwFadeTime = hap_periodic->fade_length * 1000;
}
Expand Down Expand Up @@ -796,17 +788,12 @@ SDL_SYS_ToFFEFFECT( SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src
}

/* Envelope */
if (envelope->dwAttackTime == 0) {
envelope->dwAttackLevel = ramp->dwMagnitude
}
if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
else {
envelope->dwAttackLevel = CONVERT(hap_ramp->attack_level);
envelope->dwAttackTime = hap_ramp->attack_length * 1000;
}
if (envelope->dwFadeTime == 0) {
envelope->dwFadeLevel = ramp->dwMagnitude
}
else {
envelope->dwFadeLevel = CONVERT(hap_ramp->fade_level);
envelope->dwFadeTime = hap_ramp->fade_length * 1000;
}
Expand Down Expand Up @@ -845,17 +832,13 @@ SDL_SYS_ToFFEFFECT( SDL_Haptic * haptic, FFEFFECT * dest, SDL_HapticEffect * src
}

/* Envelope */
if (envelope->dwAttackTime == 0) {
envelope->dwAttackLevel = custom->dwMagnitude
if ((envelope->dwAttackTime == 0) && (envelope->dwFadeTime == 0)) {
SDL_free(envelope);
dest->lpEnvelope = NULL;
}
else {
envelope->dwAttackLevel = CONVERT(hap_custom->attack_level);
envelope->dwAttackTime = hap_custom->attack_length * 1000;
}
if (envelope->dwFadeTime == 0) {
envelope->dwFadeLevel = custom->dwMagnitude
}
else {
envelope->dwFadeLevel = CONVERT(hap_custom->fade_level);
envelope->dwFadeTime = hap_custom->fade_length * 1000;
}
Expand Down

0 comments on commit 8a56d7c

Please sign in to comment.