Where can I look at the actual code that makes up the KBHit event? Is it written in C or in ChucK? I'd like to see what that class is actually doing (behind the scenes) to watch for the keyboard being pressed. This is not really what I'm looking for, because I'd like to have other programs send data into the ChucK program, and not have to send data in via keyboard. I'm thinking that OSC may be the best way to get around this- but I'm not sure. Are there any good intro docs/examples for using OSC (besides, the docs on OSC's homepage)? Thanks. -Dan
ssalazar@princeton.edu 07/12/06 10:05 AM >>> Hey there, Theres nothing in the docs about the KBHit class, which can read input from the terminal, but there are a few examples of how to use it. Check out:
http://chuck.cs.princeton.edu/doc/examples/event/kb.ck http://chuck.cs.princeton.edu/doc/examples/event/kb2.ck hope this helps, spencer On Jul 11, 2006, at 4:51 PM, DANIEL MAGNUSZEWSKI wrote:
All,
Is there a way to have a ChucK program take input from STDIN while running? I have seen the events page ( http://chuck.cs.princeton.edu/doc/language/event.html ) where it discusses MIDI/OSC events, but I would like to pass information via
the command line or through a pipe. Does this make sense? Is there a reason why this feature is not implemented, or am I just asking for something crazy?!
Thoughts?
Thanks.
-Dan
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On Jul 12, 2006, at 1:41 PM, DANIEL MAGNUSZEWSKI wrote:
Where can I look at the actual code that makes up the KBHit event? Is it written in C or in ChucK? I'd like to see what that class is actually doing (behind the scenes) to watch for the keyboard being pressed.
This is not really what I'm looking for, because I'd like to have other programs send data into the ChucK program, and not have to send data in via keyboard.
I'm thinking that OSC may be the best way to get around this- but I'm not sure. Are there any good intro docs/examples for using OSC (besides, the docs on OSC's homepage)?
Check out http://search.cpan.org/~crenz/Net-OpenSoundControl-0.05/ - it's a Perl module for doing OSC that specifically has an OSC client class: use Net::OpenSoundControl::Client; my $client = Net::OpenSoundControl::Client->new( Host => "192.168.3.240", Port => 7777) or die "Could not start client: $@\n"; # This is a very slow fade-in... for (0..100) { $client->send(['/Main/Volume', 'f', $_ / 100]); sleep(1); } Dunno if this helps you out or not ... --- Joe M.
Greetings! stdin (and file i/o in general) is on the way. Right now, there are a few hacked/experimental objects we've use internally: The Skot object: a event-based stdin reader The PRC object: string tokenizer They are not in the standard build - you'd have to enable them by adding a compiler flag: -DAJAY. Which platform are you using? We can post an executable with these compiled in, if you like. They will allow one to write code like: Skot skot; // infinite event loop while( true ) { // prompt and wait skot.prompt("enter data:") => now; // get the results while( skot.more() ) { <<< skot.getLine() >>>; } } and you can use PRC to tokenize the text. The actual stdin and file I/O is definitely on the way (thanks to Martin Robinson), we just haven't integrated/fully tested it yet.
Where can I look at the actual code that makes up the KBHit event? Is it written in C or in ChucK? I'd like to see what that class is actually doing (behind the scenes) to watch for the keyboard being pressed.
The KBHit class is implemented in C/C++, in ulib_std.cpp.
I'm thinking that OSC may be the best way to get around this- but I'm not sure. Are there any good intro docs/examples for using OSC (besides, the docs on OSC's homepage)?
You probably already found these: http://chuck.cs.princeton.edu/doc/language/event.html#osc http://chuck.cs.princeton.edu/doc/examples/osc/s.ck http://chuck.cs.princeton.edu/doc/examples/osc/r.ck Best, Ge!
participants (3)
-
DANIEL MAGNUSZEWSKI
-
Ge Wang
-
Joe McMahon