Force Feedback question
Hi,
I have a WingMan Force Joystick (Logitech).
I tried to programatically use the force feedback of the joystick, but so far I only succeeded in assigning "non-triggered" effects to the joystick:
DIEFFECT eef;
...
eff.dwTriggerButton = DIEB_NOTRIGGER;
eff.dwTriggerRepeatInterval = 0;
...
This effect is played back whenever I start it. -- When I try to use the DirectInput tutorial code which uses a Triggered effect, this effect is _not_ played back, although I receive no error codes (HRESULT is OK).
Do I have to manually call "start" on triggered effects? Could it be that my joystick does not support triggered effects?
A solution that I see is that I "listen" for button triggers and manually call "start" upon receiving a button hit...
But that can''t be a real solution, can it?
Am I missing something?
Thanks for your help!
Beren
I use the tutorial of the DirectX 9 documentation:
(guidEffect is one guid returned by enumerating the installed effects of the joystick. -- I also tried using a constant like GUID_ConstantForce or GUID_Sine; same result: HRESULT is ok, but nothing happens when I hit the button...)
DWORD dwAxes[2] = {DIJOFS_X, DIJOFS_Y};
LONG lDirection[2] = {0, 0};
DIPERIODIC diPeriodic;
DIENVELOPE diEnvelope;
DIEFFECT diEffect;
diPeriodic.dwMagnitude = DI_FFNOMINALMAX;
diPeriodic.lOffset = 0;
diPeriodic.dwPhase = 0;
diPeriodic.dwPeriod = (DWORD)(0.05 * DI_SECONDS);
diEnvelope.dwSize = sizeof(DIENVELOPE);
diEnvelope.dwAttackLevel = 0;
diEnvelope.dwAttackTime = (DWORD)(0.5 * DI_SECONDS);
diEnvelope.dwFadeLevel = 0;
diEnvelope.dwFadeTime = (DWORD)(1.0 * DI_SECONDS);
diEffect.dwSize = sizeof(DIEFFECT);
diEffect.dwFlags = DIEFF_POLAR | DIEFF_OBJECTOFFSETS;
diEffect.dwDuration = (DWORD)(2 * DI_SECONDS);
diEffect.dwSamplePeriod = 0;
diEffect.dwGain = DI_FFNOMINALMAX;
diEffect.dwTriggerButton = DIJOFS_BUTTON0;
diEffect.dwTriggerRepeatInterval = 0;
diEffect.cAxes = 2;
diEffect.rgdwAxes = dwAxes;
diEffect.rglDirection = &lDirection[0];
diEffect.lpEnvelope = &diEnvelope
diEffect.cbTypeSpecificParams = sizeof(diPeriodic);
diEffect.lpvTypeSpecificParams = &diPeriodic
LPDIRECTINPUTEFFECT g_lpdiEffect;
hr = g_lpDIDevice->CreateEffect(guidEffect, &diEffect, &g_lpdiEffect, NULL);
if (FAILED(hr)) {
return hr;
}
(guidEffect is one guid returned by enumerating the installed effects of the joystick. -- I also tried using a constant like GUID_ConstantForce or GUID_Sine; same result: HRESULT is ok, but nothing happens when I hit the button...)
DWORD dwAxes[2] = {DIJOFS_X, DIJOFS_Y};
LONG lDirection[2] = {0, 0};
DIPERIODIC diPeriodic;
DIENVELOPE diEnvelope;
DIEFFECT diEffect;
diPeriodic.dwMagnitude = DI_FFNOMINALMAX;
diPeriodic.lOffset = 0;
diPeriodic.dwPhase = 0;
diPeriodic.dwPeriod = (DWORD)(0.05 * DI_SECONDS);
diEnvelope.dwSize = sizeof(DIENVELOPE);
diEnvelope.dwAttackLevel = 0;
diEnvelope.dwAttackTime = (DWORD)(0.5 * DI_SECONDS);
diEnvelope.dwFadeLevel = 0;
diEnvelope.dwFadeTime = (DWORD)(1.0 * DI_SECONDS);
diEffect.dwSize = sizeof(DIEFFECT);
diEffect.dwFlags = DIEFF_POLAR | DIEFF_OBJECTOFFSETS;
diEffect.dwDuration = (DWORD)(2 * DI_SECONDS);
diEffect.dwSamplePeriod = 0;
diEffect.dwGain = DI_FFNOMINALMAX;
diEffect.dwTriggerButton = DIJOFS_BUTTON0;
diEffect.dwTriggerRepeatInterval = 0;
diEffect.cAxes = 2;
diEffect.rgdwAxes = dwAxes;
diEffect.rglDirection = &lDirection[0];
diEffect.lpEnvelope = &diEnvelope
diEffect.cbTypeSpecificParams = sizeof(diPeriodic);
diEffect.lpvTypeSpecificParams = &diPeriodic
LPDIRECTINPUTEFFECT g_lpdiEffect;
hr = g_lpDIDevice->CreateEffect(guidEffect, &diEffect, &g_lpdiEffect, NULL);
if (FAILED(hr)) {
return hr;
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement