[PD] [hid] steady data stream vs. output on event
Hans-Christoph Steiner
hans at eds.org
Sun Dec 4 22:56:39 CET 2005
I am diving back into working on [hid], I am porting it to Windows
thanks to sponsorship from http://vibrez.net. There is a lingering
question which I would like to address, so I am looking for feedback
from this list.
Right now, [hid] basically outputs events in response to the OS. It
polls the event queue at a given frequency and processes everything in
the queue on each cycle. This means that the data stream is a bit
erratic.
Here's how I am currently thinking of handling this:
- for buttons/keys, process all events in the queue
- For absolute axes, output the most recent event per poll, since
absolute axes are position, and its not really necessary to know how
many events there were between [hid] polls, just the position where it
ended up. Then it would output one event per poll cycle.
- relative data is the trickiest, mouse for example. The data is in
effect the velocity. A mouse tells you how many units it has travelled
per refresh cycle. But when the mouse stops moving, it doesn't not
send a "0" velocity. it could be made more like velocity and have it
polled for the current velocity. This would give a steady stream of
data, but then it would not give accurate info about how far the mouse
as travelled. Perhaps, [hid] would just output everything it finds in
the queue, then I write a separate object which gives the average
velocity per poll period, based on the distance in all events it
receives.
The first two apply directly to sensor data, I think, I am not sure how
relative axes with sensors compare to mice.
.hc
________________________________________________________________________
____
"Computer science is no more related to the computer than astronomy is
related to the telescope."
-Edsger
Dykstra
More information about the Pd-list
mailing list