hi object, keyboard values and relationship to key object

Dan Nigrin's icon

I want to use the hi object to capture keypresses, when Max is not the application that has focus (so I can't use the key object). But I would like to know how the numeric values that the hi object returns relate to the values that the key object returns - is there any relationship?

Also, is there consistency between keyboards (I'm just on the Mac platform) in what values are returned? In other words, my Mac keyboard has the hi object output [10 20] when I press a 'q' letter on the keyboard. I am assured that *all* Mac keyboards will return that same list of values when a 'q' is pressed?

carloskleiber's icon

I would also hope there is some consistency on macs. Hi object acts slightly differently on my old PowerBook and my new MBP, first of all the menu entries for hi are different. The one that focuses on keypresses is "Apple Internal Keyboard / Trackpad 4", this wasn't the same for my older mac.
Note that hi outputs more than one list per keypress/release, 4 actually. But there is one where the first element is different for each key and the second is 1 for press and 0 for release. That's the one I mostly use.
Also, fwiw, more than one hi object running focused on the same entry does not work too good (in same patcher or even in different devices in M4L)

Dan Nigrin's icon

Thanks for that info - yes, I can see even on the small number of different Macs I have access to, that the device names are different. But I have not seen the experience that you give, where different keyboard devices give different outputs. I seem to always have two keyboard devices listed (both with desktop machines, as well as laptops. The one listed with a "2" on the end of its name sends lists dependent on which key(s) are pressed, and then when the key is released, it sends a list with a zero at the end. The other keyboard device, I can't get to output *anything*, no matter what keys I press/release.

It seems that if the keyboards are compliant with the spec, that they *should* all send the same values - see page 53 of this document: http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf