quartz composer in sc

clean-up: #37

thanks to scott wilson it is possible to load and embed quartz composer sketches in supercollider.
below is an example that demonstrate how to use it with a camera input. you'll need the attached .qtz file and edit the path in the sc code.

cam qtz from redFrik on Vimeo.

note1: this is mac osx only.
note2: this works on sc3.7 (or sc3.5 if you replace QuartzComposerView with SCQuartzComposerView).
note3: i didn't test but you could maybe make it run under sc3.6 with GUI.cocoa.

(
var width= 1024, height= 576;
w= Window("qc", Rect(100, 100, width, height)).front;
m= QuartzComposerView(w, Rect(0, 0, width, height));
//m.path= "~/Desktop/cam.qtz".standardizePath;  //edit to match filepath
m.path= thisProcess.nowExecutingPath.dirname+/+"cam.qtz";
CmdPeriod.doOnce({w.close});
m.start;
m.inputKeys.postln;     //should return [X, Y]
s.waitForBoot{
        ~speedx= 0.1;
        ~speedy= 0.11;
        a= {|x= 0, y= 0| Pan2.ar(MoogFF.ar(Saw.ar(1-y.lag(0.1)*99+99), y.lag(0.1)*199+99, 3), x.lag(0.1)*2-1)}.play;
        r= Routine({
                inf.do{|i|
                                var x= sin(i*~speedx)*0.5+0.5;
                                var y= cos(i*~speedy)*0.5+0.5;
                                m.setInputValue(\X, x);
                                m.setInputValue(\Y, y);
                                a.set(\x, x, \y, y);
                                (1/60).wait;
                };
        }).play(AppClock);
};
)

~speedx= 0.02
~speedx= 0.4
~speedy= 0.05
~speedy= 0.5

r.stop;
a.free;
m.stop;
w.close;

in the above example frequency is mapped to video effect vertical movement, and panning to video effect horizontal movement.

AttachmentSize
Binary Data cam.qtz35.9 KB