Thanks to this answer https://stackoverflow.com/a/13734766/637142 I am able to know when a button is pressed or when the steering wheel is rotated. Now my question is how do I send an effect to the device? For example when I am playing a game if I crash the wheel will vibrate. How could I make the steering wheel vibrate?
I belive what I need to do is to Start()
an effect (http://sharpdx.org/documentation/api/t-sharpdx-directinput-effect). The SharpDX.DirectInput.Joystick class does not seem to have a method to return me all the effects. There is a method called GetEffects
but that method returns a collection of EffectInfo
objects. How does a game sends commands to the joystick?
The source code is copy-pasted from here.
To use this source you need a "Force Effect file" (C:\MyEffectFile.ffe), to "play" it on the joystick.
According to this book to create the "force effect" file you need to use the "Force Editor" that came with DirectX SDK.
(the same book, alternatively, state that you can create the effect from scratch in the code... down in the answer I've found another piece of code that create and use an effect without loading it from a file :-))
I've just found here another piece of code that maybe useful. This sample seem to create the effect from scratch, so you shouldn't need an "effect file".
And here is another link then may be useful Force feedback sample