Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created June 15, 2011 20:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jordanorelli/1028065 to your computer and use it in GitHub Desktop.
Save jordanorelli/1028065 to your computer and use it in GitHub Desktop.
Accepting keyboard input in ChucK. Pressing space disables keyboard entry (sometimes).
KBHit kb;
fun void kbListener(KBHit @ _kb)
{
while(true)
{
_kb => now;
while(_kb.more())
{
chout <= "ascii: " <= kb.getchar() <= IO.newline();
if(kb.getchar() == 32)
kb.off();
}
}
}
spork ~ kbListener(kb);
while(true) { 100::ms => now; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment