Hello George,
You have an interesting point there. I wanted to suggest to you that you wrap
your BlitSaw in an extension of a Chubgraph class, but that also doesn't work!
It appears to me that Chuck in general doesn't let you assign arrays from
subclasses to superclasses: a bit of a surprise indeed!
For example :
class ClassA {
float v;
fun float value() {
return v;
}
}
class ClassB extends ClassA {
fun float value() {
return v * 2;
}
}
ClassA myObjectA;
ClassB myObjectB;
//ChucK allows:
myObjectB @=> myObjectA;
//but does not for arrays :-(
ClassA myObjectArrayA[10];
ClassB myObjectArrayB[10];
myObjectArrayB @=> myObjectArrayA; // gives error
Of course there are less pretty ways of achieving what you need, probably by
just switching the routing of the UGens :
BlitSaw blitSaw[10];
BlitSquare blitSquare[10];
Gain output; // => or the rest of your patch
for (int i;i<blitSaw.size();i++) {
blitSquare[i] !=> output;
blitSaw[i] => output;
}
for (int i;i<blitSaw.size();i++) {
blitSaw[i] => output;
blitSquare[i] => output;
}
Happy chucking!
Casper
Casper Schipper
[email protected]
www.casperschipper.nl
+316 52322590
On 2 feb. 2014, at 18:00, [email protected] wrote:
> Send chuck-users mailing list submissions to
> [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
> or, via email, send a message with subject or body 'help' to
> [email protected]
>
> You can reach the person managing the list at
> [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of chuck-users digest..."
> Today's Topics:
>
> 1. how do I assign a Blit array with a BlitSquare array?
> (George Locke)
>
> From: George Locke <[email protected]>
> Subject: [chuck-users] how do I assign a Blit array with a BlitSquare array?
> Date: 2 februari 2014 17:18:13 CET
> To: ChucK Users Mailing List <[email protected]>
> Reply-To: ChucK Users Mailing List <[email protected]>
>
>
> Hi,
>
> I have a class that I want to use either (multiple) BlitSquare or BlitSaw
> oscillators, where i can switch between them during performance. I thought
> the easiest way would be to have a single Blit array that holds either, but
> apparently I can't do this:
>
> BlitSquare pls[10];
> BlitSaw saw[10];
> Blit osc[10];
> if (choosePulse) {
> pls @=> osc;
> } else {
> saw @=> osc;
> }
>
> Any suggestions?
>
> How is the Blit type ever to be used if not in this way?
>
> (My chuck experience is limited, but I am an experienced programmer.)
>
> Regards,
> George
>
>
> _______________________________________________
> chuck-users mailing list
> [email protected]
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________
chuck-users mailing list
[email protected]
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users