Listening for multiple keypresses
Listening for multiple keypresses
- Subject: Listening for multiple keypresses
- From: Sam Garfield <email@hidden>
- Date: Mon, 22 Jan 2007 00:33:59 -0700
Hey
I'm new to cocoa and mailing lists, go easy on me /disclaimer
I am trying to write an app that will let me play my wireless keyboard
like a guitar. The F-keys are going to be the frets, and the enter key
or spacebar would be the "pick" action. If you've played frets on fire
or guitar hero you should know what I'm talking about immediately.
So, for example, I hit and hold down F3 for the middle C note (a sample
that would be triggered). The sample is triggered when I hit enter, and
is cut off when I take my finger off of F3. Follow me so far?
The next step is chords. If F3 plays a C note, F3+F5 would play a C
major. F3+F4 a C minor, F3+F6 a C major 7th and so on.
So far I have a basic application that shows my F keys as buttons, and I
can hit F1 to play a note. I have each button assigned through the
button's info dialog to a hard F-key. Doing it this way, I can only
detect one button press at a time. I need a way of detecting what
multiple keys are being pressed (yes, I'm aware of the hardware
limitations here, but the apple wireless keyboards seem to handle weird
key combos very well).
So my idea is to make the enter key trigger a function that looks for
what keys are being held down, and then triggers those keys functions
for producing sound.
What function can I use to accurately listen for multiple key presses,
and see their corisponding key codes somewhere? If you are interested,
download frets on fire and go to the key testing section in the setup
menu. This can see all keys being pressed very well. It's open source,
but not written in ObjC.
Thanks for any help you guys can provide, I look forward to becoming a
better cocoa developer. If anyone is specifically interested in helping
me out on this project further or mentoring me a bit, please contact me
directly.
-Sam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden