Hi All, I am trying to make a visualization program for ChucK programs. For the communication between ChucK and the C++ code I'm writing, I use a pipe. I'd rather use a socket but I cannot see how this works in ChucK (?). When I write to chout I need to flush the buffer, just to read in the output using my own program. When I try to do this (i.e. my_IO_object.flush()) I get the following message: "(IO): internal error! inside an abstract function! help! note: please hunt down someone (e.g., Ge) to fix this..." The command I use is: chuck-1.2.1.3-exe\bin\chuck.exe chuckVis\chuckFiles\random1.ck, on Windows Vista 32-bits. Without the .flush() the script works fine, but I need the flush functionality. Has anybody got a clue how to fix this? Or maybe how to use ChucK to send messages through a socket? Greetings, Tom Aizenberg
Hi Tom,
Colorful error message!
I'm afraid there's no socket communication in Chuck to my knowledge,
however, on Posix systems (and there my be an equivalent of this in Windows)
I've successfully used fifo pipes to communicate between a Chuck script and
another process.
Also, don't forget that you can send/receive OSC messages between processes
as well. There my be a way to parse those in the process that runs your
visualization (especially if it's written in Java, C++, Python, or another
common language). Often OSC is the best route, since it's implemented in so
many different environments.
Best,
Mike
2010/5/11 Tom Aizenberg
Hi All,
I am trying to make a visualization program for ChucK programs. For the communication between ChucK and the C++ code I’m writing, I use a pipe. I’d rather use a socket but I cannot see how this works in ChucK (?).
When I write to *chout* I need to flush the buffer, just to read in the output using my own program. When I try to do this (i.e. my_IO_object.flush()) I get the following message:
*“(IO): internal error! inside an abstract function! help!*
* note: please hunt down someone (e.g., Ge) to fix this...”*
The command I use is: *chuck-1.2.1.3-exe\bin\chuck.exe chuckVis\chuckFiles\random1.ck*, on Windows Vista 32-bits. Without the .flush() the script works fine, but I need the flush functionality…
Has anybody got a clue how to fix this? Or maybe how to use ChucK to send messages through a socket?
Greetings,
Tom Aizenberg
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Has anybody got a clue how to fix this?
Well... flush doesn't work as desired. Also see; http://wiki.cs.princeton.edu/index.php/ChucK/Bugs/Release http://wiki.cs.princeton.edu/index.php/ChucK/Bugs/ReleaseSo... in fact somebody (in fact Ge) has been hunted down and he promised a fix. I suggest the error message be updated to indicate that the actual hunt has already been performed and we can go on to stage 2 of the plan. Not sure what that will consist of, if nobody has a better idea I suggest tickling. ;-) Kas.
Hi everybody, Thanks for all your reactions! I've decided to go with OSC instead of pipes, which turns out to be really great! For the ones interested, I use pyGame for visualization and pyOSC for communication, those two work also very fine. A different question I now have is, how do I convert a float to a string? Haven't been able to find this in the documentation/examples. :( Greetings, Tom Aizenberg Original: Hi All, I am trying to make a visualization program for ChucK programs. For the communication between ChucK and the C++ code I'm writing, I use a pipe. I'd rather use a socket but I cannot see how this works in ChucK (?). When I write to chout I need to flush the buffer, just to read in the output using my own program. When I try to do this (i.e. my_IO_object.flush()) I get the following message: "(IO): internal error! inside an abstract function! help! note: please hunt down someone (e.g., Ge) to fix this..." The command I use is: chuck-1.2.1.3-exe\bin\chuck.exe chuckVis\chuckFiles\random1.ck, on Windows Vista 32-bits. Without the .flush() the script works fine, but I need the flush functionality. Has anybody got a clue how to fix this? Or maybe how to use ChucK to send messages through a socket? Greetings, Tom Aizenberg
Tom;
A different question I now have is, how do I convert a float to a string? Haven’t been able to find this in the documentation/examples… :(
Strangely casting doesn't work (I feel it should). This works though;
3 => float foo;
string bar;
foo +=> bar;
<<<bar>>>;
That's more or less a implicit cast.
We can also make it a bit nicer and create a function that you could use
inside of the creation of your OSC messages;
//Float TO String converter
fun string ftos(float arg)
{
string bar;
arg +=> bar;
return bar;
}
//trivial test
<<
Hi Kas,
Thanks, if this works that's fine with me a ftos or .toString() would be
even better of course ;)
Greetings,
Tom
Van: chuck-users-bounces@lists.cs.princeton.edu
[mailto:chuck-users-bounces@lists.cs.princeton.edu] Namens Kassen
Verzonden: vrijdag 21 mei 2010 17:49
Aan: ChucK Users Mailing List
Onderwerp: Re: [chuck-users] Flush ChucK IO
Tom;
A different question I now have is, how do I convert a float to a string?
Haven't been able to find this in the documentation/examples. :(
Strangely casting doesn't work (I feel it should). This works though;
3 => float foo;
string bar;
foo +=> bar;
<<<bar>>>;
That's more or less a implicit cast.
We can also make it a bit nicer and create a function that you could use
inside of the creation of your OSC messages;
//Float TO String converter
fun string ftos(float arg)
{
string bar;
arg +=> bar;
return bar;
}
//trivial test
<<
Tom;
Thanks, if this works that’s fine with me a ftos or .toString() would be even better of course ;)
Well, all objects have .toString(), but in ChucK primitives aren't objects
so they lack member-functions. I think a cast should be added because plus-chucking a float to a string already forms a implicit cast so a explicit one should be fine as well, I feel. That would be coherent with ChucK being meant to be very readable; a explicit cast may well be a part of the coder trying to express his intentions clearly. Remarkably the Std does supply a tool to go from a string to a number, but not the other way around. I say we overload "$" as the most simple and coherent solution. Kas.
participants (3)
-
Kassen
-
mike clemow
-
Tom Aizenberg