[Fluxus] Key events

'Kassen' signal.automatique at gmail.com
Fri Jun 8 07:33:20 PDT 2012


On Fri, Jun 08, 2012 at 09:04:32AM -0500, Carlos Alegria wrote:

Hey carlos,
> 
> I am making a 2D animation in which I am moving a plane with a texture. The
> texture contains a music scroll, so the animation kind of resembles a
> music-scroll player. I am trying to add movie-player-like controls using
> keyboard input to play/pause the animation. I decided to assign the
> play/pause control to the space bar.

Sounds cool, so far so good.
> 
> My first approach was to use a PLAY flag that will be toggled at
> (every-frame) using something like (when (key-pressed-this-frame " ") (set!
> PLAY (not PLAY))). The problem was that (key-pressed-this-frame " ") returns
> true in the frame where I press the space bar for the first time, but also
> at some other frames after the first one, when the space bar is pressed
> (before I released it again). This makes the play/pause control to work
> intermittently, as a button press (i.e. button down, button press, and
> button release events) is not usually done in the same frame.

This sound to me like the result of Fluxus getting key events from the
OS where it will be affected by the keyboard repeat-rate. In case you
are no big interface-nerd; that's the bit that makes your editor write
10 "a" characters if you hold down the [a] key for a while.

The sollution would be to open the (or a) keyboard as a HID device, in
which case we could get the raw data. There are -IMHO- two reasons to
consider that; first of all that the current behaviour is clearly not
what we would expect or desire that function to do. Secondly getting a
HID library would open the way for native joypad support.

On the down side; we may be using multiple keyboards, for example when
we are on a laptop yet hook up a external keyboard. Then we'd need to
somehow figure out how to make Fluxus listen to all of those for
convenience. Another downside is that this would be extra work and add
yet another library as a dependency and there are some differences
between how various OS's deal with the HID standard. That's quite
annoying as that is a perfectly fine standard but somehow "standard"
means "inspiration for free improvisation" to some people, that can't
be helped. Joysticks without a OSC bridge would be cool though.

IMHO, where opinionated ;-)

Yours,
Kas.

Just in case extra info would help;
http://en.wikipedia.org/wiki/Human_interface_device




More information about the Fluxus mailing list