1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"824.41">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica
; min-height: 11.0px}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000; min-height: 12.0px}
18 span
.s1
{color: #0000ff}
19 span
.s2
{color: #0000bf}
20 span
.Apple-tab-span
{white-space:pre
}
24 <p class=
"p1"><b>InRect
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>detects if a two channel signal is within a rectangular region
</b></p>
25 <p class=
"p2"><br></p>
26 <p class=
"p3"><b>InRect.ar(x, y, rect)
</b></p>
27 <p class=
"p3"><b>InRect.kr(x, y, rect)
</b></p>
28 <p class=
"p2"><br></p>
29 <p class=
"p3">A pair of mono input signals x and y are treated as a point (x,y) in
2-D; if they fall within the bounds of the rectangle, then this UGen outputs a one; else it outputs zero.
<span class=
"Apple-converted-space"> </span></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3"><b>x
</b> - X component signal
</p>
32 <p class=
"p3"><b>y
</b> - Y component signal
</p>
33 <p class=
"p3"><b>rect
</b> - A
<a href=
"../../Geometry/Rect.html"><span class=
"s1">Rect
</span></a> which defines the rectangular region to monitor; note that Rects are in screen co-ordinates, so the top is smaller than the bottom. The Rect is created once and cannot be modulated
</p>
34 <p class=
"p4"><br></p>
35 <p class=
"p5"><br></p>
36 <p class=
"p6">//we'll hear the sawtooth wave when the two sine oscillators are both in the region x =
0.0 to
0.5, y =
0.5 to
1.0</p>
37 <p class=
"p7">{
<span class=
"s2">InRect
</span>.ar(
<span class=
"s2">SinOsc
</span>.ar(
1),
<span class=
"s2">SinOsc
</span>.ar(
1.3),
<span class=
"s2">Rect
</span>(
0,
0.5,
0.5,
0.5))*
<span class=
"s2">LFSaw
</span>.ar(
44,
0,
0.1) }.play
</p>
38 <p class=
"p8"><br></p>
39 <p class=
"p6">//stereo effect
</p>
40 <p class=
"p7">{(
<span class=
"s2">InRect
</span>.ar(
<span class=
"s2">LFNoise0
</span>.ar([
140,
141]),
<span class=
"s2">LFNoise0
</span>.ar(
143),
<span class=
"s2">Rect
</span>(
0,
0,
0.5,
1)).lag(
0.1))*
<span class=
"s2">LFSaw
</span>.ar(
<span class=
"s2">SinOsc
</span>.ar(
10,
0,
5,
400),
0,
0.1) }.play
</p>
41 <p class=
"p8"><br></p>
42 <p class=
"p8"><br></p>
43 <p class=
"p6">//for the Rect, create as left, 'top', width, height;
<span class=
"Apple-converted-space"> </span></p>
44 <p class=
"p7">r=
<span class=
"s2">Rect
</span>(
0,
0,
1,
1)
</p>
45 <p class=
"p8"><br></p>
46 <p class=
"p7">r.left
</p>
47 <p class=
"p7">r.right
</p>
48 <p class=
"p7">r.top
</p>
49 <p class=
"p7">r.bottom
</p>