2005-10-15 21:39:51

by emard

[permalink] [raw]
Subject: force feedback envelope incomplete

HI

Force feedback envelope struct in input.h
for periodic events is incomplete.

struct ff_envelope {
__u16 attack_length; /* Duration of attack (ms) */
__u16 attack_level; /* Level at beginning of attack */
__u16 fade_length; /* Duration of fade (ms) */
__u16 fade_level; /* Level at end of fade */
};

The envelope consists of:
1. Attack level (Level at beginning of attack)
2. Attack time
3. Sustain level (Level at end of attack and beginning of fade)
4. Sustain time
5. Fade level (Level at the end of fade)
6. Fade time

If I want to implement proper envelope I propose something like this:

struct ff_envelope {
__u16 attack_length; /* Duration of attack (ms) */
__u16 attack_level; /* Level at beginning of attack */
__u16 sustain_length; /* Duration of sustain (ms) */
__u16 sustain_level; /* Sustain Level at end of attack and beginning of fade */
__u16 fade_length; /* Duration of fade (ms) */
__u16 fade_level; /* Level at end of fade */
};


2005-10-16 18:35:54

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: force feedback envelope incomplete

On Saturday 15 October 2005 16:39, [email protected] wrote:
> HI
>
> Force feedback envelope struct in input.h
> for periodic events is incomplete.
>
> struct ff_envelope {
> __u16 attack_length; /* Duration of attack (ms) */
> __u16 attack_level; /* Level at beginning of attack */
> __u16 fade_length; /* Duration of fade (ms) */
> __u16 fade_level; /* Level at end of fade */
> };
>
> The envelope consists of:
> 1. Attack level (Level at beginning of attack)
> 2. Attack time
> 3. Sustain level (Level at end of attack and beginning of fade)
> 4. Sustain time
> 5. Fade level (Level at the end of fade)
> 6. Fade time
>
> If I want to implement proper envelope I propose something like this:
>
> struct ff_envelope {
> __u16 attack_length; /* Duration of attack (ms) */
> __u16 attack_level; /* Level at beginning of attack */
> __u16 sustain_length; /* Duration of sustain (ms) */
> __u16 sustain_level; /* Sustain Level at end of attack and beginning of fade */
> __u16 fade_length; /* Duration of fade (ms) */
> __u16 fade_level; /* Level at end of fade */
> };

You might want to talk to Vojtech about this (CC-ed).

--
Dmitry

2005-10-17 11:43:04

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: force feedback envelope incomplete

On Sun, Oct 16, 2005 at 01:35:47PM -0500, Dmitry Torokhov wrote:
> On Saturday 15 October 2005 16:39, [email protected] wrote:
> > HI
> >
> > Force feedback envelope struct in input.h
> > for periodic events is incomplete.
> >
> > struct ff_envelope {
> > __u16 attack_length; /* Duration of attack (ms) */
> > __u16 attack_level; /* Level at beginning of attack */
> > __u16 fade_length; /* Duration of fade (ms) */
> > __u16 fade_level; /* Level at end of fade */
> > };
> >
> > The envelope consists of:
> > 1. Attack level (Level at beginning of attack)
> > 2. Attack time
> > 3. Sustain level (Level at end of attack and beginning of fade)
> > 4. Sustain time
> > 5. Fade level (Level at the end of fade)
> > 6. Fade time
> >
> > If I want to implement proper envelope I propose something like this:
> >
> > struct ff_envelope {
> > __u16 attack_length; /* Duration of attack (ms) */
> > __u16 attack_level; /* Level at beginning of attack */
> > __u16 sustain_length; /* Duration of sustain (ms) */
> > __u16 sustain_level; /* Sustain Level at end of attack and beginning of fade */
> > __u16 fade_length; /* Duration of fade (ms) */
> > __u16 fade_level; /* Level at end of fade */
> > };
>
> You might want to talk to Vojtech about this (CC-ed).

Your proposal seems reasonable. Please send me a patch that adds the
sustain members to the envelope, and uses it in some driver, while
making sure existing binary-only apps (if there are any) don't break.

--
Vojtech Pavlik
SuSE Labs, SuSE CR

2005-10-17 22:21:50

by emard

[permalink] [raw]
Subject: Re: force feedback envelope incomplete

> > > struct ff_envelope {
> > > __u16 attack_length; /* Duration of attack (ms) */
> > > __u16 attack_level; /* Level at beginning of attack */
> > > __u16 sustain_length; /* Duration of sustain (ms) */
> > > __u16 sustain_level; /* Sustain Level at end of attack and beginning of fade */
> > > __u16 fade_length; /* Duration of fade (ms) */
> > > __u16 fade_level; /* Level at end of fade */
> > > };
> >
> > You might want to talk to Vojtech about this (CC-ed).
>
> Your proposal seems reasonable. Please send me a patch that adds the
> sustain members to the envelope, and uses it in some driver, while
> making sure existing binary-only apps (if there are any) don't break.

I have thought about this.

I can not imagine ANY existing driver supporting such envelope
other than using this 64 bit field as a binary container for
it's private interpretation of the mechanical vibration envelope.

We may not go too far on with supporting such software
(I even don't know of any).

So we actually need this

struct ff_envelope {
__u16 attack_length;
__u16 attack_level; /* level at the beginning of attack */
__u16 decay_length;
__u16 decay_level; /* level at the beginning of decay */
__u16 sustain_length;
__u16 sustain_level; /* level at the end of decay and beginning of fade */
__u16 fade_length;
__u16 fade_level; /* level at the end of fade */
};

WHY:

*** About the vibration envelope ***

As I understand the envelope, it's there to simulate physical
behaviour of transient vibrations of a string when triggered.

Such envelope has ATTACK, DECAY, SUSTAIN and FADE. (ADSF)

Microsoft simplified this by implementing only
ATTACK, SUSTAIN and FADE (ASF).

But what linux has? Attack and fade without sustain.
That is slighty out of sense, because in this case we can not
calculate the SLOPES of the attack and fade, making them
out of sense too.

I would use attack, decay sustain and fade. That's
the way synthesizers handle triggered wire vibrations
like in guitars or pianos.
ASF may be sufficient only for short length of low
frequency vibrations <50Hz. Some joysticks are capable only of that.
But for frequencies >100 Hz, like tactile mice, ADSF envelope
can produce additional exciting vibrant feel and sophisticated
vibrations over high dynamic range making it very realistic.
That makes much difference compared to those crippled ASF only
envelopes.