Periodic Effects
Periodic effects are waveform effects. DirectInput defines the following waveforms.
Square.
Sine.
Cosine.
Triangle.
SawtoothUp. The waveform drops vertically after it reaches maximum positive force. See Basic Concepts of Force Feedback for an example.
SawtoothDown. The waveform rises vertically after it reaches maximum negative force.
An envelope can be applied to periodic effects. See the example in Basic Concepts of Force Feedback.
The phase of a periodic effect is the point along the waveform where the effect begins. Phase is measured in hundredths of a degree, from 0 to 35,999. The following table indicates where selected phase values (in degrees) lie along the various waveforms. Max is the top (+) or bottom ( - ) of the wave, and Mid is the midpoint, where no force is applied in either direction.
Waveform | 0 | 90 | 180 | 270 |
---|---|---|---|---|
Square | +Max | +Max | - Max | - Max |
Sine | Mid | +Max | Mid | - Max |
Triangle | +Max | Mid | - Max | Mid |
SawtoothUp | - Max | - Max/2 | Mid | +Max/2 (reaches +Max just before the cycle repeats) |
SawtoothDown | +Max | +Max/2 | Mid | - Max/2 (reaches - Max just before the cycle repeats) |
A driver may round off a phase value to the nearest supported value. For example, for a sine effect some drivers support only values of 0 and 9,000 (to create a cosine); for other effects, only values of 0 and 18,000 are supported.
GUID_Square
GUID_Sine
GUID_Triangle
GUID_SawtoothUp
GUID_SawtoothDown
You can also pass any other globally unique identifier (GUID) obtained by the IDirectInputDevice8::EnumEffects method, provided the low byte of the dwEffType member of the DIEffectInfo structure (DIDFT_GETTYPE(dwEffType)) is equal to DIEFT_PERIODIC. In this way, you can use hardware-specific forces designed by the manufacturer. For example, a hardware device might support a periodic effect that rotates the stick in a small circle.
The type-specific structure for periodic effects is DIPERIODIC.
Do not confuse the period of a periodic effect (DIPERIODIC.dwPeriod) with the sample period (DIEFFECT.dwSamplePeriod). The period is the time that it takes to go through a complete wave cycle. The sample period, as for all effects, is the minimum time between actual adjustments of magnitude.