Platform SDK: DirectX |
You can modify the basic magnitude of some effects by applying an envelope and an offset. For an overview, see Basic Concepts of Force Feedback.
To apply an envelope when creating or modifying an effect, initialize a DIENVELOPE structure, and put a pointer to it in the lpEnvelope member of the DIEFFECT structure.
The device driver determines which effects support envelopes. Typically, you can apply an envelope to a constant force, a ramp force, or a periodic effect, but not to a condition. To determine whether a particular effect supports an envelope, call the IDirectInputDevice7::GetEffectInfo method, and check for the DIEP_ENVELOPE flag in the dwStaticParams member of the DIEFFECTINFO structure.
To apply an offset, set the lOffset member of the DIPERIODIC or the DICONDITION structure pointed to by the lpvTypeSpecificParams member of the DIEFFECT structure. For periodic effects, the absolute value of the offset plus the magnitude of the effect must not exceed DI_FFNOMINALMAX.
You cannot apply an offset to a constant force or ramp force. In these cases, the same effect can be achieved by altering the magnitude.
To apply an envelope when creating or modifying an effect, set the bUseEnvelope member of the DIEFFECT type to True, and initialize the envelope member, which is a DIENVELOPE type.
The device driver determines which effects support envelopes. Typically, you can apply an envelope to a constant force, a ramp force, or a periodic effect, but not to a condition. To determine whether a particular effect supports an envelope, call the DirectInputEnumEffects.GetStaticParams method, and check for the DIEP_ENVELOPE flag in the returned value.
To apply an offset, set the lOffset member of the DIPERIODICFORCE or the DICONDITION type used in the periodic or condition member of DIEFFECT. For periodic effects, the absolute value of the offset plus the magnitude of the effect must not exceed 10,000.
You cannot apply an offset to a constant force or ramp force. In these cases, the same effect can be achieved by altering the magnitude.