Microsoft DirectX 8.1 (Visual Basic) |
You might want to scale the force of your effects according to the force exerted by different devices. For example, if an application's effects feel right on a device that puts out a maximum force of n newtons on a given axis, you might want to adjust the gain for a device that puts out more force. (You cannot use the gain to increase the maximum force of the axis, so you should set the basic effect magnitudes to values suitable for devices that put out less force.)
Gain can also be used to decrease the magnitude of a hardware-defined effect.
You can set the gain for the entire device by using the DirectInputDevice8.SetProperty method.
You must set the gain for individual effects when creating them by putting a value in the lGain member of the DIEFFECT type. (If lGain is 0, the effect will not be felt.) You can change this value later by using DirectInputEffect.SetParameters, passing DIEP_GAIN in the flags parameter.
The purpose of setting the device gain is to allow your application to have control over the strength of all effects all at once. For example, you might have a slider control in your application to enable the user to specify how strong the force-feedback effects should be, such as the master volume control on a sound mixer. When the device gain is set, your application does not need to adjust the gain of each individual effect to suit the user's preferences.
A gain value can be in the range from 0 through 10,000, where 10,000 indicates that magnitudes are not to be scaled, 7,500 means that forces are to be scaled to 75 percent of their nominal magnitudes, and so on.