Microsoft DirectX 9.0

Periodic Effects

Periodic effects are waveform effects.†Microsoft?DirectInput?defines the following waveforms.

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.

SawtoothUpóMaxóMax/2Mid+Max/2 (reaches +Max just before the cycle repeats)
SawtoothDown+Max+Max/2Midó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.

To create a periodic force, pass one of the following values in the rguid parameter of the IDirectInputDevice8::CreateEffect method:

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 (DIEFT_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.

© 2002 Microsoft Corporation. All rights reserved.