[PD] How to receive keyboard input

IOhannes m zmoelnig zmoelnig at iem.kug.ac.at
Mon Oct 15 11:02:43 CEST 2001


> andychen5018 wrote:
> 
> Hi,
> 
> This e-mail is to clarify one of my previous (very confusing) e-mail.
> 
> Does anyone know how to detect keyboard inputs for PD externs?  For my
> PD externs, i want it to be able to respond a keyboard inputs, such as
> CTL-X or CTL-Y or some other combinations of keys.
> 
> For example, if I have a clock running, and I want to stop the clock
> with a keypress.  And turns on the clock again with the same
> keypress.  My main problems is that I am not sure how to implement it
> so that my c source code can detect and reponse to the keypress.
> 
> Thx
> 
> Andy Chen

hi !

pd grabs each keyboard-input, and sends it into the pd-world (via "key",
"keyup", "keyname").
so have a look at x_gui.c
in short, you just have to add receive-methods for "#keyname" (which
will be most useful, if you want to use things like Ctrl-Y,...)
internally to your externals).
but:
.) keyboard-jitter is quite high in pd (though very platform dependent)
.) i do not really think that it is a good idea, to grab
keyboard-signals directly and handle them in a special way in your
externals.
it might well be, that miller adds functionality to pd using the very
keyborad-signals you are using, pe, as it was when the iem_gui-library
was included.
i do not know, whether it would turn out great, if everytime you (say:)
reset your clock, you will create a vu-meter too.

if you are creating your own window (like Gem), then the point is a very
different one, but you will then have to take care of how to grab the
keyboard-input yourself.


mfg.cds.ast
IOhannes



More information about the Pd-list mailing list