This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/QuartzComposerView.schelp is in supercollider-common 1:3.8.0~repack-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
TITLE:: QuartzComposerView
summary:: view for rendering Quartz Composer Compositions
categories:: GUI>Views

DESCRIPTION::
QuartzComposerView allows for the rendering of Quartz Composer Compositions within SC on OSX. Quartz Composer is a visual programming environment for processing and rendering graphical data, which is distributed free of charge as part of Apple's XCode Development Tools. QC is highly optimised to work with the OSX graphics system, and in general should be more efficient than Pen. For more information on QC see: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/QuartzComposerUserGuide/qc_intro/qc_intro.html and http://en.wikipedia.org/wiki/Quartz_Composer

You can access input and output ports using the methods setInputValue, getInputValue and getOutputValue, or (do to a slight of hand in the implementation, using the port keys as getters and setters directly. The following two lines of code are thus equivalent:

code::
myQCView.setInputValue(\valueIn, 1);
myQCView.valueIn = 1;
::


INSTANCEMETHODS::

METHOD::path
Get or set the path of the currently composition as a link::Classes/String::.

METHOD::inputKeys
Get the keys of the current composition's input ports.

returns:: An link::Classes/Array:: of link::Classes/Symbol::s.

METHOD::outputKeys
Get the keys of the current composition's output ports.

returns:: An link::Classes/Array:: of link::Classes/Symbol::s.

METHOD::start
Start rendering the loaded composition.

METHOD::stop
Stop rendering the loaded composition.

METHOD::setInputValue
Set the value of the input port specified by key.

argument::key
A link::Classes/String:: or link::Classes/Symbol:: matching the port's key.

argument::value
The type of value must correspond to the type of the port, but Floats, Integers, and Booleans are converted if needed. (true = 1, false = 0)

METHOD::getInputValue
Get the current value of an input port. The type of object returned will correspond to the port's type.

argument::key
A link::Classes/String:: or link::Classes/Symbol:: matching the port's key.

METHOD::getOutputValue
Get the current value of an output port. The type of object returned will correspond to the port's type.

argument::key
A link::Classes/String:: or link::Classes/Symbol:: matching the port's key.

METHOD::maxFPS
Set the maximum frames per second at which the composition will render.
argument::rate
A link::Classes/Float:: or link::Classes/Integer:: specifying the desired max frame rate. A value of 0 indicates no limit.

METHOD::openInQC
Open the currently loaded composition in Quartz Composer. You will need to reload the composition into the view before any saved changes take effect.

EXAMPLES::

code::
////////// Simple example
(
w = Window("Simple QC Test").front;
b = Button(w, Rect(0, 0, 150, 20))
	.states_([["pick another QC file"]])
	.action_({ File.openDialog("", { |path| m.path_(path) }) });
m = QuartzComposerView(w, Rect(0,20,400, 260));
m.path = Platform.helpDir +/+ "QC/Cells.qtz";
)
m.start;
m.stop;

////////// Set and get inputs and outputs
(
w = Window("SCTV").front;
m = QuartzComposerView(w, Rect(0,20,400, 260));
m.path = Platform.helpDir +/+ "QC/QuartzComposerViewTest.qtz";
m.start;
)

// get the names of input and output keys
m.inputKeys;
m.outputKeys;
m.openInQC; // you can see the published inputs and outputs in the composition

// You can access input and output ports using setInputValue, getInputValue and getOutputValue
// or directly using the keys as getters and setters
m.setInputValue(\direction, 1);
m.direction = 0;
m.direction;
m.fontSize; // font size in QC Units
m.fontSize_(0.1);

m.string_("SCTV").fontName_("Courier");
m.startColor_(Color.green);
m.billboardEnable_(false);
m.billboardEnable_(true);
m.maxFPS_(5.0);
m.maxFPS_(10);
m.maxFPS_(0.0); // no max

m.getOutputValue(\interpResult); // current rotation of the text in degrees
m.interpResult;
m.systemTime; // current System Time published in the composition
m.endColor.class; // yup, it's a SC Color object
m.endColor == Color.white;

(
// probably more efficient to do this in QC, but...
{
c = Color.blue;
100.do({ m.startColor_(c = c.vary(1)); 0.1.wait; });
}.fork(AppClock);
)

m.bounds = Rect(100, 20, 200, 260);

m.stop;

///////////// Fullscreen

(
w = Window("SCTV", Rect(0,0,360, 280), border: false).front;
b = SCButton(w, Rect(0, 0, 150, 20))
	.states_([["Close Me"]])
	.action_({w.close});
m = QuartzComposerView(w, Rect(0,20,360, 260));
m.path = Platform.helpDir +/+ "QC/QuartzComposerViewTest.qtz";

m.resize = 5;
m.start;
)

w.fullScreen;


////////// Structure test
(
w = Window("SCTV").front;
m = QuartzComposerView(w, Rect(0,20,400, 260));
m.path = Platform.helpDir +/+ "QC/QuartzComposerViewStructureTest.qtz";
m.start;
)

m.inputKeys;
m.outputKeys;
m.openInQC; // Take a look at the various inputs and outputs. Select and mouseover for key names.

// set several parameters at once
// [background color, num copies, scale, string, [font size in QC units, font]]
m.structure = [Color.red, 4, 1.5, "Hello", [0.2, "Courier"]];
m.structure = [Color.red, 3, 1.5, "World", [0.4, "Arial"]];
m.structure = [Color.red, 4, 0.1, "!!", [0.7, "Times"]];
m.structure = [Color.black, 4, 0.1, "!!!", [0.6, "Courier"]];
m.dictStructure = IdentityDictionary[\x->(-0.4), \y->0.4];

// get stuff out
// QCView stores all structures as instances of NSCFDictionary internally
// so all structure outputs are instances of IdentityDictionary
m.structure = [Color.blue, 4, 0.2, "Gruess Welt", [0.12, "Zapfino"]];
x = m.stringStruct; // separates the string into components
x[\component_1];

// pass something through
m.arbStructIn = ["foo", "bar", ["foobar"]]; // array in
x = m.arbStructOut; // IdentDict out with Integer Symbols as keys
x[\0];
x[\2][\0];
(
// convert to array
y = Array.newClear(x.size);
x.keysValuesDo({|i, elem| y[i.asInteger] = elem});
y.postln;
)

// use QC to concat the strings)
m.stringConcatIn = ["foo", "bar"]; // array in
x = m.stringConcatOut; // String Out

////////// Image Test

(
w = Window("Simple QC Test").front;
b = Button(w, Rect(0, 0, 150, 20))
    .states_([["pick another QC file"]])
    .action_({ File.openDialog("", { |path| m.path_(path) }) });
m = QuartzComposerView(w, Rect(0,20,400, 260));
m.path = Platform.helpDir +/+ "QC/ImageFilter.qtz";
)
m.start;
m.stop;
i = m.getOutputValue(\_protocolOutput_Image)
i.plot;

j = Image.color(100, 100, Color.rand);
j.plot;
m.setInputValue(\_protocolInput_Image, j);


////////// Control some audio: Stupid Pan Example

(
w = Window("Stupid Pan Example", Rect(0,20,600, 150)).front;
m = QuartzComposerView(w, Rect(0,20,600, 100));
m.path = Platform.helpDir +/+ "QC/Stupid Pan.qtz";
m.resize = 5;
m.start;
)

s.boot;
// use mouse to set pan position
(
{
loop({
{ Pan2.ar(Saw.ar(mul: 0.1) * EnvGen.ar(Env.perc, timeScale: 4, doneAction: 2), m.x_pos) }.play;
1.wait;
});
}.fork(AppClock);
)

////////// Sonogram

// could be better optimised, but proves the concept
(
w = Window("Sonogram", Rect(0,20,600, 300)).front;
m = QuartzComposerView(w, Rect(0,20,600, 256));
m.path = Platform.helpDir +/+ "QC/SCQCsonogramCount2.qtz";
m.start;
m.setInputValue(\framesPerView, 300);
m.setInputValue(\magnitudes, (0, 0.01..1));
)

s.boot;
b = Buffer.alloc(s,256);
(
a = { FFT(b, LFSaw.ar(4000)); 0.0 }.play; // sawtooth

p = 0.25; i = 0;
//m.setInputValue(\period, p);
//m.maxFPS_(p.reciprocal * 2);
SystemClock.sched(0.0, {
b.getn(0, 256, { arg buf;
	var z, x;
	z = buf.clump(2).flop;
	z = [Signal.newFrom(z[0]), Signal.newFrom(z[1])];
	x = Complex(z[0], z[1]);
	//{m.setInputValue(\magnitudes, x.magnitude.resamp1(m.bounds.height * 0.5));}.defer
	{m.setInputValue(\magnitudes, x.magnitude * 0.025); m.setInputValue(\count, i);}.defer;
	i = i + 1;
}); p
});
)

a.free;
a = { FFT(b, Dust2.ar(500) * 5); 0.0 }.play; // Impulses

a.free;
c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
(
m.setInputValue(\framesPerView, 50);
a = { var colum;
	colum = PlayBuf.ar(1, c, BufRateScale.kr(c) * Line.kr(1, 3, 20), loop: 1);
	FFT(b, colum);
	colum
}.play;
)

///////////// Cheap Level Meter
(
w = Window("Level Meters", Rect(128, 64, 200, 400)).front;

m = QuartzComposerView(w, Rect(20,20,50, 360));
n = QuartzComposerView(w, Rect(130,20,50, 360));
m.path = Platform.helpDir +/+ "QC/SCLevelMeter.qtz";
n.path = Platform.helpDir +/+ "QC/SCLevelMeter.qtz";
m.maxFPS_(20); n.maxFPS_(20);
m.start; n.start;
~meters = [m, n];
)

s.boot;

// MouseX controls noise amp
(
o = OSCresponder(s.addr, '/tr', {arg time, resp, msg;
	{~meters[msg[2]].level = (msg[3] + 0.01).explin(0.01,1.01, 0, 1);}.defer;
}).add;
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
a = { var colum, noise, imp, delimp;
	imp = Impulse.kr(20);
	delimp = Delay1.kr(imp);
	colum = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);
	noise = PinkNoise.ar(MouseX.kr);
	// measure Peak
	SendTrig.kr(imp, 0, Peak.ar(colum, delimp));
	SendTrig.kr(imp, 1, Peak.ar(noise, delimp));
	[colum, noise];
}.play;
)

a.free;


/// using an event type to control a QCView by patterns:

Event.addEventType(\quartz, { |server|
	var latency = server.latency;
	var view = ~view.postln;
	var key = ~key, value = ~value;
	AppClock.sched(latency, { view.postln; view.setInputValue(key, value) });
});


(
w = Window("Level Meters", Rect(128, 64, 200, 400)).front;

m = QuartzComposerView(w, Rect(20,20,50, 360));
m.path = "Help/GUI/Cocoa-GUI/QuartzComposerView/SCLevelMeter.qtz".standardizePath;
m.maxFPS_(20);
m.start;
)

(
Pbind(
	\type, \quartz,
	\view, m,
	\key, \level,
	\value, Pwhite(0, 1.0, inf).explin(0.01,1.01, 0, 1),
	\dur, 0.1
).play;
)

m.setInputValue(\level, 0.5);
::