Platform SDK: DirectX

DIEFFECT

The DIEFFECT type describes a force-feedback effect. It is passed to the DirectInputDevice.CreateEffect and DirectInputEffect.SetParameters methods in order to set parameters for an effect. Existing parameters are retrieved in this type through the DirectInputEffect.GetParameters method.

Type DIEFFECT
  bUseEnvelope As Long
  conditionFlags As CONST_DICONDITIONFLAGS
  conditionX As DICONDITION
  conditionY As DICONDITION
  constantForce As DICONSTANTFORCE
  envelope As DIENVELOPE
  lDuration As Long
  lFlags As Long
  lGain As Long
  lSamplePeriod As Long
  lStartDelay As Long
  lTriggerButton As Long
  lTriggerRepeatInterval As Long
  periodicForce As DIPERIODICFORCE
  rampForce As DIRAMPFORCE
  x As Long
  y As Long
End Type

Members

bUseEnvelope
True if the envelope described in the envelope member is to be applied to the effect.
conditionFlags
Flags from the CONST_DICONDITIONFLAGS enumeration. In the current version of DirectX for Visual Basic, this value should be 0.
conditionX
DICONDITION type describing parameters of the condition on the x-axis. Ignored for other types of effects.
conditionY
DICONDITION type describing parameters of the condition on the y-axis. Ignored for other types of effects.
constantForce
DICONSTANTFORCE type describing parameters of a constant force. Ignored for other types of effects.
envelope
DIENVELOPE type describing parameters of an envelope to be applied to the effect. Valid only if the bUseEnvelope member is True.
lDuration
Duration of the effect, in microseconds. A value of -1 indicates infinite duration. If an envelope is applied to an effect of infinite duration, then the attack will be applied, followed by an infinite sustain.
lFlags
Zero or more members of the CONST_DIEFFFLAGS enumeration specifying how other members are to be interpreted.
lGain
The gain to be applied to the effect, in the range 0 to 10,000. The gain is a scaling factor applied to all magnitudes of the effect and its envelope.
lSamplePeriod
The period, in microseconds, at which the device samples the effect—in other words, the granularity of changes in force. A value of 0 indicates that the default playback sample rate should be used.

If the device is not capable of sampling the effect at the specified rate, it will choose the supported rate that is closest to the requested value.

Setting a custom sample period can be used for special effects. For example, playing a sine wave with an artificially large sample period results in a rougher texture.

lStartDelay
Time, in microseconds, the device should wait after a DirectInputEffect.Start call before playing the effect. If this value is 0, then effect playback begins immediately.
lTriggerButton
Offset value of the button that will trigger the effect. This should be one of the members of the CONST_DIJOYSTICKOFS enumeration, or -1 to indicate that the effect does not have a trigger button.
lTriggerRepeatInterval
The interval, in microseconds, between the end of one playback and the start of the next when the effect is triggered by a button press and the button is held down. Setting this value to -1 suppresses repetition.

Not all devices support trigger repeat.

periodicForce
DIPERIODICFORCE type describing parameters of a periodic effect. Ignored for other types of effects.
rampForce
DIRAMPFORCE type describing parameters of a ramp force. Ignored for other types of effects.
x
Direction of the effect. Normally, this is the amount by which the direction is rotated from north (usually the negative y-axis), in hundredths of degrees. Thus a value of 0 indicates a force pushing toward the user, a value of 9000 indicates a force pushing from the user's right, and so on. In this case, y should be 0.

If lFlags contains DIEFF_CARTESIAN, this is a Cartesian value describing the relative amount of force on the x-axis. For example, if x = -1 and y = 1, the direction of the force is from the southwest. For more information, see Effect Direction.

y
If lFlags contains DIEFF_CARTESIAN, this is a Cartesian value describing the relative amount of force on the y-axis. Otherwise it should be 0.