New FileIO options, broken stuff from CVS: FileIO.read(int)
Dear List (mostly Ge & other people who know about the brand-new dracula) First of all, great new ChucK. The FileIO is great to have, and it's good to see it implemented fairly comprehensively. I like how FileIO.readInt() or readFloat() just becomes FileIO => (int), too. Anyway, I was previously using FileIO.read(int) in my Scala file importer to parse a line and look for a "/" after the first integer (making it a ratio, rather than cents). There doesn't seem to be a FileIO.read method around anymore, though, which makes some sense since readInt and readFloat aren't used now. I was going to wade back through the source, which is where I found read(int) in the first place, but thought I should at least let you all know that the method was being used. Are there any good alternatives to .read()? My issue with reading in a string was that there's no space between the number and the "/" in Scala files, so it would read as one long string. Then, parsing the string into multiple bits, all that sort of thing...really difficult. My method was to read in a float, look for a "/" (with .read(1) == "/" ), and if it found one read in another float and calculate the ratio; if it didn't find one, calculate it as musical cents. Thanks for the help. Best, Andrew
I know, such a quick follow-up, but I seem to have worked around this
by the following:
1. Uncomment the two sections in chuck_lang.cpp (668-670 and 2205-2212)
2. Uncomment lines 1876-1900 in chuck_oo.cpp and line 440 in chuck_oo.h
These are probably commented out for a reason, but it doesn't seem to
crash or anything. I also saw that IO.read() is commented out with
"TODO: add this later?" written above it, so are there known problems
here that can be worked on? I'm probably not going to help much, but
I'll definitely try.
Andrew
On Mon, Oct 5, 2009 at 8:51 AM, Andrew C. Smith
Dear List (mostly Ge & other people who know about the brand-new dracula)
First of all, great new ChucK. The FileIO is great to have, and it's good to see it implemented fairly comprehensively. I like how FileIO.readInt() or readFloat() just becomes FileIO => (int), too.
Anyway, I was previously using FileIO.read(int) in my Scala file importer to parse a line and look for a "/" after the first integer (making it a ratio, rather than cents). There doesn't seem to be a FileIO.read method around anymore, though, which makes some sense since readInt and readFloat aren't used now. I was going to wade back through the source, which is where I found read(int) in the first place, but thought I should at least let you all know that the method was being used. Are there any good alternatives to .read()?
My issue with reading in a string was that there's no space between the number and the "/" in Scala files, so it would read as one long string. Then, parsing the string into multiple bits, all that sort of thing...really difficult. My method was to read in a float, look for a "/" (with .read(1) == "/" ), and if it found one read in another float and calculate the ratio; if it didn't find one, calculate it as musical cents. Thanks for the help.
Best, Andrew
participants (1)
-
Andrew C. Smith