[chuck-users] Intraspection - an example of what I'm attempting
signal.automatique at gmail.com
Mon Nov 8 14:07:48 EST 2010
On 8 November 2010 19:35, Rich Caloggero <rjc at mit.edu> wrote:
> Thanx Andy. I was worried that this would be the case; getting too used to
> Will the casting work for any UGen type? I.e. since most (all) UGens
> support mix, then can I just pretend that everything in the array is one
> type (say Chorus for instance) and then use that type's mix?
Yes. If all of the UGens that you use there support .mix() you can cast to
any one type of UGen that has .mix() and use it.
The one downside to this is that you are removing the safety that the parser
gives in type-checking so if somehow some UGen that lacks .mix() ends up in
your array you'll crash the VM. With STKInstrument and it's sub-classes this
works quite well, with members like .noteOn() being shared so there it's
quite safe if done properly. Sadly we lack a "Effect" class that all effects
like Churus could extend and that would provide extra safety and convenience
in your case.
Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users