Greetings and an Object oriented question
Hail, MusicTech Ones of the Chuck persuasion. I appreciate the elegance and difficulty of the design and implementation of Chuck (being a sysProg type). Chuck is damn easy to get going and make great speed into shooting the foot manytimes. It's kind of like building airplanes out of balsa wood when I was a kid: nicks, cut fingers, noxious fumes, Glue stains on mom's kitchen table. But when your done, it FLIES! So, we know we like chuck. A good buddy. great set of OK default parameters to get you going asap. Low CPU load. Good language structure. Real-time modification to any parameter. all the good stuff. Even Objects and classes. So that's where my question comes from: (Yes it's probably in the documentation somewhere, maybe in the past or future, but I haven't found it) For example, suppose I want a class of say, two filters: Echo A and Echo B. I want to have these echo filters internal to the objects, and be able to chuck into and out of the objects. Is this possible and how does the class look? Class echoChamber { Echo a => Echo b; public fun void scrambleSomeInterestingStuff ( <some useful parameters> ) { //inside here we do some magic and then set parameters on a or b } public fun void initializeMe ( ) { //because we don't do constructors this week } //maybe something goes here } //Now we might want a structure like: Mandolin m => echoChamber smallroom => dac; So, my question is: This seems like a reasonable thing for a chuck Object to do, Can It? And how? Thanks, JIm
Hi, I think that feature is on the way into ChucK. Classes are very new. For now there is a workaround. My favourite method is the one that was in the vim screenshot that eduard posted on Oct 1. https://lists.cs.princeton.edu/pipermail/chuck-users/2005-October/ 000047.html You would have the following member function: fun void connect( UGen ug ) { ug => myEcho_ => dac; } Then you do this => sinosc s; myclass c; c.connect(s); Now you will want to modify it so that you can have an input connect and an output connection and all that jazz, but this will get you up and ChucKin. --art
participants (2)
-
Adam R. Tindale
-
Jim Hinds