<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello George,</div><div><br></div><div>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!</div>It appears to me that Chuck in general doesn't let you assign arrays from subclasses to superclasses: a bit of a surprise indeed!<div><div><br></div><div>For example :</div><div><div style="margin: 0px;"><span style="color: rgb(4, 51, 255);">class</span> ClassA {</div><div style="margin: 0px;">    <span style="color: rgb(4, 51, 255);">float</span> v;</div><div style="margin: 0px;">    <span style="color: rgb(4, 51, 255);">fun</span> <span style="color: rgb(4, 51, 255);">float</span> value() {</div><div style="margin: 0px;">        <span style="color: rgb(4, 51, 255);">return</span> v;</div><div style="margin: 0px;">    }</div><div style="margin: 0px;">}</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;"><span style="color: rgb(4, 51, 255);">class</span> ClassB <span style="color: rgb(4, 51, 255);">extends</span> ClassA {<span class="Apple-tab-span" style="white-space: pre;"> </span></div><div style="margin: 0px;">    <span style="color: rgb(4, 51, 255);">fun</span> <span style="color: rgb(4, 51, 255);">float</span> value() {</div><div style="margin: 0px;">        <span style="color: rgb(4, 51, 255);">return</span> v * <span style="color: rgb(222, 146, 16);">2</span>;</div><div style="margin: 0px;">    }</div><div style="margin: 0px;">}</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">ClassA myObjectA;</div><div style="margin: 0px;">ClassB myObjectB;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px; color: rgb(114, 158, 18);">//ChucK allows: </div><div style="margin: 0px; color: rgb(114, 158, 18); min-height: 14px;"><br></div><div style="margin: 0px; color: rgb(114, 158, 18);">myObjectB @=> myObjectA;</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px; color: rgb(114, 158, 18);">//but does not for arrays :-(</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">ClassA myObjectArrayA[<span style="color: rgb(222, 146, 16);">10</span>];</div><div style="margin: 0px;">ClassB myObjectArrayB[<span style="color: rgb(222, 146, 16);">10</span>];</div><div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">myObjectArrayB @=> myObjectArrayA; // gives error </div></div></div><div style="margin: 0px;"><br></div><div>Of course there are less pretty ways of achieving what you need, probably by just switching the routing of the UGens :</div><div>BlitSaw blitSaw[10];</div><div>BlitSquare blitSquare[10];</div><div><br></div><div>Gain output; // => or the rest of your patch</div><div><br></div><div>for (int i;i<blitSaw.size();i++) {</div><div><span class="Apple-tab-span" style="white-space:pre">  </span>blitSquare[i] !=> output;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>blitSaw[i] => output;</div><div>}</div><div><br></div><div><div>for (int i;i<blitSaw.size();i++) {</div><div><span class="Apple-tab-span" style="white-space: pre;">   </span>blitSaw[i] => output;</div><div>        blitSquare[i] => output;</div><div>}</div></div><div><br></div><div>Happy chucking!</div><div>Casper</div><div><div><br></div><div><div><br></div><div><br></div><div><div><br><div><div><div><br class="webkit-block-placeholder"></div><div apple-content-edited="true">
<div style="font-family: Helvetica;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font color="#787878">Casper Schipper</font></div><div><font color="#787878"><a href="mailto:casper.schipper@gmail.com">casper.schipper@gmail.com</a></font></div><div><font color="#787878"><a href="http://www.casperschipper.nl">www.casperschipper.nl</a></font></div><div><font color="#787878">+316 52322590</font></div></div>
</div>
<br><div><div>On 2 feb. 2014, at 18:00, <a href="mailto:chuck-users-request@lists.cs.princeton.edu">chuck-users-request@lists.cs.princeton.edu</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Send chuck-users mailing list submissions to<br><span class="Apple-tab-span" style="white-space:pre">        </span><a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br><span class="Apple-tab-span" style="white-space:pre">     </span>https://lists.cs.princeton.edu/mailman/listinfo/chuck-users<br>or, via email, send a message with subject or body 'help' to<br><span class="Apple-tab-span" style="white-space:pre"> </span>chuck-users-request@lists.cs.princeton.edu<br><br>You can reach the person managing the list at<br><span class="Apple-tab-span" style="white-space:pre">       </span>chuck-users-owner@lists.cs.princeton.edu<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of chuck-users digest..."<br>Today's Topics:<br><br>   1. how do I assign a Blit array with a BlitSquare array?<br>      (George Locke)<br><br><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(127, 127, 127, 1.0);"><b>From: </b></span><span style="font-family:'Helvetica';">George Locke <george.locke.maxmsp@gmail.com><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(127, 127, 127, 1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica';"><b>[chuck-users] how do I assign a Blit array with a BlitSquare array?</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(127, 127, 127, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica';">2 februari 2014 17:18:13 CET<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(127, 127, 127, 1.0);"><b>To: </b></span><span style="font-family:'Helvetica';">ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; color:rgba(127, 127, 127, 1.0);"><b>Reply-To: </b></span><span style="font-family:'Helvetica';">ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu><br></span></div><br><br><div dir="ltr">Hi,<div><br></div><div>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:</div>
<div><br></div><div>BlitSquare pls[10];</div><div>BlitSaw saw[10];</div><div>Blit osc[10];</div><div>if (choosePulse) {</div><div>pls @=> osc;</div><div>} else {</div><div>saw @=> osc;</div><div>}</div><div><br></div>
<div>Any suggestions?</div><div><br></div><div>How is the Blit type ever to be used if not in this way?</div><div><br></div><div>(My chuck experience is limited, but I am an experienced programmer.)</div><div><br></div><div>
Regards,</div><div>George</div></div>
<br><br>_______________________________________________<br>chuck-users mailing list<br>chuck-users@lists.cs.princeton.edu<br>https://lists.cs.princeton.edu/mailman/listinfo/chuck-users<br></blockquote></div><br></div></div></div></div></div></div></body></html>