Kassen wrote:
Fellow ChucKsters,
I was thinking while lying awake last night.... One of the big questions at the moment is writing non-wave data to disc and recalling it. This would be useful for storing the outcome of (random) algorithms, settings tuned by the use of interfaces and any number of other useful and appealing things. I'm certain we'll have this in the future, but what about right now?
One idea I had that I have yet to try in practice is that we could try abusing the call for the OS to execute a terminal command. One of the very old-fashioned commands all three OS's that ChucK runs on is writing a line to a new file or appending a line to a existing file so with some abuse of the new function to form strings we could writem then save a file. If that file would contain a array and a simple command to assign that to a static array in a public class simply executing the file we wrote would give us back the data, asuming we defined some format for this.
If you just want line-in / line-out support, honestly, I could hack that into ChucK in a few minutes this afternoon. The problem isn't so much getting stuff into and out of files, it's doing things with it once you've got it. ChucK doesn't have any significant string manipulation functions. You could use sort of a poor-man's delimiter by using one data field per line and Std.atoi(), perhaps. Even more interesting from my perspective would be the ability to serialize ordinals (and perhaps later objects) directly to files, but that's a bit more work. -Scott