On Mon, Jan 19, 2009 at 12:52 PM, Vincent Pelletier plr.vincent@gmail.com wrote:
dinput: Add effect gain support
-- Vincent Pelletier
Vincent,
This patch is ok as far as it goes, but not completely correct.
Firstly, SetParameters needs to apply the parameters to effects while they are playing, not just store them. Existing parameters are all part of the effect structure, so that is taken care of automatically. Since gain is handled by a different mechanism, you also need to handle the while-playing case (unless DIEP_NODOWNLOAD is specified). This probably means you need to implement GetEffectStatus, since you won't want to apply the gain unless the effect is playing.
Secondly, the kernel's ff.txt suggests that evdev handles the gain globally for the device. Since the DirectInput definition of gain is per-effect rather than per-device, you should also test what happens when you set the gain differently in two simultaneously-playing effects on the same device. If Windows mixes them (i.e. truly applies the gain per-effect) then we need to come up with some logic to do the same (probably by scaling the effect envelope or magnitude, depending on the effect type, and keeping it updated when the user modifies the scaled parameters).
Thirdly, SetParameters still has a comment that says gain and sample periods aren't supported. Please update any applicable comments when you update the code - outdated comments are worse than no comments at all.
Regards, Daniel Remenak