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






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

Send chuck-users mailing list submissions to
chuck-users@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@lists.cs.princeton.edu

You can reach the person managing the list at
chuck-users-owner@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@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@lists.cs.princeton.edu>
Reply-To: ChucK Users Mailing List <chuck-users@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@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users