electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Using all (computer) keyboard keys
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
WillHS



Joined: Oct 27, 2014
Posts: 4
Location: New Zealand

PostPosted: Mon Oct 27, 2014 7:34 pm    Post subject: Using all (computer) keyboard keys
Subject description: HidMsg.ascii() doesn't differentiate between many keys
Reply with quote  Mark this post and the followings unread

I'm interested in making a ChucK program which responds to key events to assist users' typing.

HidMsg.ascii() returns unique ascii codes for most keys, but for many keys like arrow keys, ctrl, alt, shift, home, end and some others, the ascii code returned is the same (0).

I wasn't able to find documentation for the Hid or HidMsg classes.

Is there any way to differentiate between these keys in ChucK?
Back to top
View user's profile Send private message
WillHS



Joined: Oct 27, 2014
Posts: 4
Location: New Zealand

PostPosted: Tue Oct 28, 2014 2:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

I've found a way to get unique codes from each (computer) keyboard key: HidMsg.which. This seems to return a unique integer for every key on my keyboard.

But will the mapping from key to code be the same of all (or at least english) keyboards?

I would still also like to see documentation for the classes Hid and HidMsg.
Back to top
View user's profile Send private message
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Wed Nov 05, 2014 11:51 pm    Post subject: Reply with quote  Mark this post and the followings unread

My guess is that .which() returns common key codes like you can see in other programming languages. In which case they should be consistent between all keybaords. For common keys, they will probably be the same for different languages too, if the differences in layouts aren't too crazy.
_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Antimon



Joined: Jan 18, 2005
Posts: 4145
Location: Sweden
Audio files: 371
G2 patch files: 100

PostPosted: Wed Nov 05, 2014 11:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

Just had a look at my old cli sequencer code, and I use a class called KBHit, and call kb.getchar() on it. I seem to have been able to detect the escape key using this, at least.
_________________
Antimon's Window
@soundcloud @Flattr home - you can't explain music
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use