dinput: Add effect gain support.

This commit is contained in:
Vincent Pelletier 2009-01-18 19:02:14 +01:00 committed by Alexandre Julliard
parent a4b201a287
commit d2969fef92
1 changed files with 9 additions and 4 deletions

View File

@ -54,6 +54,7 @@ struct LinuxInputEffectImpl
GUID guid; GUID guid;
struct ff_effect effect; /* Effect data */ struct ff_effect effect; /* Effect data */
int gain; /* Effect gain */
int* fd; /* Parent device */ int* fd; /* Parent device */
struct list *entry; /* Entry into the parent's list of effects */ struct list *entry; /* Entry into the parent's list of effects */
}; };
@ -379,9 +380,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
} }
if (dwFlags & DIEP_GAIN) { if (dwFlags & DIEP_GAIN) {
/* the linux input ff driver apparently has no support peff->dwGain = This->gain;
* for setting the device's gain. */
peff->dwGain = DI_FFNOMINALMAX;
} }
if (dwFlags & DIEP_SAMPLEPERIOD) { if (dwFlags & DIEP_SAMPLEPERIOD) {
@ -513,6 +512,12 @@ static HRESULT WINAPI LinuxInputEffectImpl_Start(
} }
event.type = EV_FF; event.type = EV_FF;
event.code = FF_GAIN;
event.value = This->gain;
if (write(*(This->fd), &event, sizeof(event)) == -1)
FIXME("Failed setting gain. Error: %d \"%s\".\n", errno, strerror(errno));
event.code = This->effect.id; event.code = This->effect.id;
event.value = dwIterations; event.value = dwIterations;
if (write(*(This->fd), &event, sizeof(event)) == -1) { if (write(*(This->fd), &event, sizeof(event)) == -1) {
@ -623,7 +628,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
/* Gain and Sample Period settings are not supported by the linux /* Gain and Sample Period settings are not supported by the linux
* event system */ * event system */
if (dwFlags & DIEP_GAIN) if (dwFlags & DIEP_GAIN)
TRACE("Gain requested but no gain functionality present.\n"); This->gain = 0xFFFF * peff->dwGain / 1000;
if (dwFlags & DIEP_SAMPLEPERIOD) if (dwFlags & DIEP_SAMPLEPERIOD)
TRACE("Sample period requested but no sample period functionality present.\n"); TRACE("Sample period requested but no sample period functionality present.\n");