[RFC 4/11] Linux FF: Linux effect parameter: periodic effect's phase
Elias Vanderstuyft
elias.vds at gmail.com
Fri Mar 7 15:32:18 CST 2014
On Wed, Mar 5, 2014 at 3:57 PM, Andrew Eikum <aeikum at codeweavers.com> wrote:
> On Tue, Mar 04, 2014 at 08:20:01PM +0100, Elias Vanderstuyft wrote:
>> phase should be related to time, not to angle:
>>
>
> This seems correct to me. I would add a short comment noting that
> we're performing the conversion because ff_effect's phase should be a
> time parameter, while DIEFFECT's is angle.
OK, updating:
So change the following in dinput/effect_linuxinput.c:259 :
tsp->lOffset = (This->effect.u.periodic.offset / 33) * 10;
tsp->dwPhase = (This->effect.u.periodic.phase / 33) * 36;
tsp->dwPeriod = (This->effect.u.periodic.period * 1000);
to :
tsp->lOffset = (This->effect.u.periodic.offset / 33) * 10;
if (!This->effect.u.periodic.period) {
/* Avoid division by zero period, set tsp->dwPhase
arbitrarily to zero. */
tsp->dwPhase = 0;
} else
/* Conversion because ff_effect's phase is time based,
while DIEFFECT's is angle based. */
tsp->dwPhase = (((int)This->effect.u.periodic.phase *
36000) / This->effect.u.periodic.period) % 36000;
tsp->dwPeriod = (This->effect.u.periodic.period * 1000);
and change the following in dinput/effect_linuxinput.c:486 :
This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* ==
(/ 36 * 32) */
This->effect.u.periodic.period = tsp->dwPeriod / 1000;
to :
This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
This->effect.u.periodic.period = tsp->dwPeriod / 1000;
/* Conversion because ff_effect's phase is time based, while
DIEFFECT's is angle based. */
This->effect.u.periodic.phase = ((int)(tsp->dwPhase % 36000) *
This->effect.u.periodic.period) / 36000;
Elias
More information about the wine-devel
mailing list