[chuck-users] how do I assign a Blit array with a BlitSquare array?

Casper Schipper casper.schipper at gmail.com
Sun Feb 2 13:01:50 EST 2014

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 Schipper
casper.schipper at gmail.com
+316 52322590

On 2 feb. 2014, at 18:00, chuck-users-request at lists.cs.princeton.edu wrote:

> Send chuck-users mailing list submissions to
> 	chuck-users at lists.cs.princeton.edu
> 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
> 	chuck-users-request at lists.cs.princeton.edu
> You can reach the person managing the list at
> 	chuck-users-owner at lists.cs.princeton.edu
> 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 <george.locke.maxmsp at gmail.com>
> 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 <chuck-users at lists.cs.princeton.edu>
> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
> 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
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140202/81824d17/attachment.html>

More information about the chuck-users mailing list