On Fri, Feb 22, 2013 at 01:08:00AM -0800, Chris Harris wrote:
Can you create a UGen in the ChucK language, by subclassing the UGen class? Because I just tried to do it for a couple hours and it was frustrating the heck out of me.
Yes, you can but sadly the result won't work as we'd like it to right now.
Unless I'm totally doing it wrong, I'm suspecting you can't, in fact, make a viable UGen subclass using the ChucK language itself (vs C++ or whatever).
Yes, unfortunately that is correct.
If this sort of subclasses can't work, a nice improvement would be for ChucK to provide an error here. Is there any legitimate reason to subclass a UGen in ChucK language? If not, attempting to do so should generate a compile error. Alternatively, maybe trying to chuck a non-C++ Ugen subclass into another Ugen (and especially into dac) should throw a runtime error.
As I see things there are valid reasons to want this and wanting to extend UGen or a particular type of UGen makes sense, both syntactically and as a way of working with sound. While it is not a "error" I could this see being grounds for a "warning" that points the user towards ChuGins. For me a "error" is going too far; these are classes and classes can be extended, while the end result is not what we'd intuitively want there is no error on the syntax level as such, I feel. I can see how this might be grounds for debate though.
I did finally find about the chugen facility, which seems like a neat alternative. But it was not an easy find.
So I guess some documentation updates might be in order too. A note that you can't write UGens in ChucK and a mention that chugen stuff exists.
Not sure if I'll have time to look into all this or not. But I wanted to start by getting the facts straight.
Yes, you got all of it right. What you tried, though it doesn't work, looks perfectly coherent to me. It is also true that ChuGins are the actual solution in practice now. They are outside of the language, indeed, but in return you get GCC (or whatever your compiler of choice is) to optimise for you; that's not a bad trade, I'd say. The documentation situation here is need bad, I agree. ChuGins were documented in their own paper but indeed not in the manual yet. The documentation is always lagging behind the development and that is particularly a issue if you are new and didn't get to follow the new stuff as it was announced. When things look very confusing, as they do here, they simply might be. I recommend a mail to the list over staring at things for hours. Chances are good that somebody who knows what's up will be around and able to send you in the right direction. That's what the list is for. Yours, Kas.