comparison include/SDL_haptic.h @ 2481:5d0ea4576f20 gsoc2008_force_feedback

More comments. Clamped values in struct ff_effect. Added waveforms.
author Edgar Simo <bobbens@gmail.com>
date Tue, 01 Jul 2008 10:44:42 +0000
parents b883974445fc
children b51ad78812d5
comparison
equal deleted inserted replaced
2480:b883974445fc 2481:5d0ea4576f20
55 #define SDL_HAPTIC_RUMBLE (1<<6) 55 #define SDL_HAPTIC_RUMBLE (1<<6)
56 #define SDL_HAPTIC_INERTIA (1<<7) 56 #define SDL_HAPTIC_INERTIA (1<<7)
57 #define SDL_HAPTIC_GAIN (1<<8) 57 #define SDL_HAPTIC_GAIN (1<<8)
58 #define SDL_HAPTIC_AUTOCENTER (1<<9) 58 #define SDL_HAPTIC_AUTOCENTER (1<<9)
59 59
60 typedef enum SDL_waveform {
61 SDL_WAVEFORM_SINE,
62 SDL_WAVEFORM_SQUARE,
63 SDL_WAVEFORM_TRIANGLE,
64 SDL_WAVEFORM_SAWTOOTHUP,
65 SDL_WAVEFORM_SAWTOOTHDOWN
66 } SDL_waveform;
67
68
69 /*
70 * All values max at 32767 (0x7fff). Signed values also can be negative.
71 * Time values unless specified otherwise are in milliseconds.
72 *
73 * Common parts:
74 *
75 * Replay:
76 * Uint16 length; Duration of effect.
77 * Uint16 delay; Delay before starting effect.
78 *
79 * Trigger:
80 * Uint16 button; Button that triggers effect.
81 * Uint16 interval; How soon before effect can be triggered again.
82 *
83 * Envelope:
84 * Uint16 attack_length; Duration of the attack.
85 * Uint16 attack_level; Level at the start of the attack.
86 * Uint16 fade_length; Duration of the fade out.
87 * Uint16 fade_level; Level at the end of the fade.
88 */
60 typedef struct SDL_HapticConstant { 89 typedef struct SDL_HapticConstant {
61 /* Header */ 90 /* Header */
62 Uint16 type; 91 Uint16 type; /* SDL_HAPTIC_CONSTANT */
63 Uint16 direction; 92 Uint16 direction;
64 93
65 /* Replay */ 94 /* Replay */
66 Uint16 length; 95 Uint16 length;
67 Uint16 delay; 96 Uint16 delay;
69 /* Trigger */ 98 /* Trigger */
70 Uint16 button; 99 Uint16 button;
71 Uint16 interval; 100 Uint16 interval;
72 101
73 /* Constant */ 102 /* Constant */
74 Sint16 level; 103 Sint16 level; /* Strength of the constant effect. */
75 104
76 /* Envelope */ 105 /* Envelope */
77 Uint16 attack_length; 106 Uint16 attack_length;
78 Uint16 attack_level; 107 Uint16 attack_level;
79 Uint16 fade_length; 108 Uint16 fade_length;
80 Uint16 fade_level; 109 Uint16 fade_level;
81 } SDL_HapticConstant; 110 } SDL_HapticConstant;
82 typedef struct SDL_HapticPeriodic { 111 typedef struct SDL_HapticPeriodic {
83 /* Header */ 112 /* Header */
84 Uint16 type; 113 Uint16 type; /* SDL_HAPTIC_PERIODIC */
85 Uint16 direction; 114 Uint16 direction;
86 115
87 /* Replay */ 116 /* Replay */
88 Uint16 length; 117 Uint16 length;
89 Uint16 delay; 118 Uint16 delay;
91 /* Trigger */ 120 /* Trigger */
92 Uint16 button; 121 Uint16 button;
93 Uint16 interval; 122 Uint16 interval;
94 123
95 /* Periodic */ 124 /* Periodic */
96 Uint16 waveform; 125 SDL_waveform waveform; /* Type of effect */
97 Uint16 period; 126 Uint16 period; /* Period of the wave */
98 Sint16 magnitude; 127 Sint16 magnitude; /* Peak value */
99 Sint16 offset; 128 Sint16 offset; /* Mean value of the wave */
100 Uint16 phase; 129 Uint16 phase; /* Horizontal shift */
101 130
102 /* Envelope */ 131 /* Envelope */
103 Uint16 attack_length; 132 Uint16 attack_length;
104 Uint16 attack_level; 133 Uint16 attack_level;
105 Uint16 fade_length; 134 Uint16 fade_length;