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.44">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.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: 12.0px Helvetica
; color: #0021e7}
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: #b2140d}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
17 span
.s1
{font: 18.0px Helvetica
}
18 span
.s2
{color: #002bf8}
19 span
.s3
{color: #0024f8}
20 span
.s4
{color: #000000}
21 span
.s5
{color: #0021be}
22 span
.s6
{color: #0031f8}
23 span
.s7
{font: 9.0px Monaco
}
24 span
.Apple-tab-span
{white-space:pre
}
28 <p class=
"p1"><span class=
"s1"><b>OSCresponder
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>client side network responder
</b></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p2"><br></p>
31 <p class=
"p3">Register a function to be called upon receiving a specific command from a specific OSC address.
</p>
32 <p class=
"p2"><br></p>
33 <p class=
"p3">Other applications sending messages to SuperCollider should distinguish between sending messages to the server or the language. Server messages are documented in the
<a href=
"../ServerArchitecture/Server-Command-Reference.html"><span class=
"s2">Server-Command-Reference
</span></a> and should be sent to the server's port -
<b>s.addr.port
</b> - which is
57110 by default. Messages sent to the server will not be processed by any OSCresponder in the language.
</p>
34 <p class=
"p2"><br></p>
35 <p class=
"p3">Messages from external clients that should be processed by OSCresponders must be sent to the language port,
<b>57120</b> by default. Use
<b>NetAddr.langPort
</b> to confirm which port the SuperCollider language is listening on.
</p>
36 <p class=
"p2"><br></p>
37 <p class=
"p3">See
<a href=
"OSC_communication.html"><span class=
"s3">OSC_communication
</span></a> for more details.
</p>
38 <p class=
"p2"><br></p>
39 <p class=
"p3"><b>Important:
</b> It is highly recommended to use
<a href=
"OSCresponderNode.html"><span class=
"s2">OSCresponderNode
</span></a> or
<a href=
"OSCpathResponder.html"><span class=
"s2">OSCpathResponder
</span></a> instead of OSCresponder directly. OSCresponders can overwrite each other, but OSCresponderNodes with the same address and command name can coexist peacefully.
</p>
40 <p class=
"p2"><br></p>
41 <p class=
"p2"><br></p>
42 <p class=
"p4"><span class=
"s4"><b><i>Examples: see
</i></b><a href=
"OSCresponderNode.html"><b><i>OSCresponderNode
</i></b></a></span></p>
43 <p class=
"p2"><br></p>
44 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*new(addr, cmdName, action);
</b></p>
45 <p class=
"p2"><br></p>
46 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>addr
</b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
47 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>the address the responder
<b><i>receives from
</i></b> (an instance of NetAddr, e.g. Server.default.addr)
</p>
48 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>an address of
<b>nil
</b> will respond to messages from anywhere.
</p>
49 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>an address with a port of
<b>nil
</b> will respond to messages from any port from that specific IP.
</p>
50 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
51 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>cmdName
</b></p>
52 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>an OSC command eg. '/done'
</p>
53 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
54 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>action
</b></p>
55 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a function that will be evaluated when a cmd of that name is received from addr.
</p>
56 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>arguments
</b>:
<b>time, theResponder, message, addr
</b></p>
57 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>note that OSCresponder evaluates its function in the system process.
</p>
58 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>in order to access the application process (e.g. for GUI access ) use
<b>{ ... }.defer
</b>;
</p>
59 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>within the action function, e.g., {
<span class=
"s5">|time, resp, msg|
</span> { gui.value_(msg[
3]) }.defer }
</p>
60 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
61 <p class=
"p3"><b>Note:
</b></p>
62 <p class=
"p3"><span class=
"Apple-tab-span"> </span>A single OSCresponder may be set up for each addr and cmdName combination.
<span class=
"Apple-converted-space"> </span></p>
63 <p class=
"p3"><span class=
"Apple-tab-span"> </span>Subsequent registrations will overwrite previous ones.
<span class=
"Apple-converted-space"> </span>See
<a href=
"OSCresponderNode.html"><span class=
"s6">OSCresponderNode
</span></a>.
</p>
64 <p class=
"p2"><br></p>
65 <p class=
"p3"><span class=
"Apple-tab-span"> </span>Whenever an OSC message is sent to the SuperCollider application (the language, not the server), either
<span class=
"Apple-tab-span"> </span>Main-recvOSCmessage or Main-recvOSCbundle is called.
<span class=
"Apple-converted-space"> </span>There, the messages are forwarded to the
<span class=
"Apple-tab-span"> </span>OSCresponder class using the OSCresponder-respond class method.
<span class=
"Apple-converted-space"> </span></p>
66 <p class=
"p2"><br></p>
67 <p class=
"p2"><br></p>
68 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>add
</b></p>
69 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>add this responder instance to the list of active responders.
<span class=
"Apple-converted-space"> </span></p>
70 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>The OSCresponder is not active until this is done.
</p>
71 <p class=
"p2"><br></p>
72 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>remove
</b></p>
73 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>remove and deactivate the OSCresponder
</p>
74 <p class=
"p2"><br></p>
75 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>removeWhenDone
</b></p>
76 <p class=
"p3"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>remove and deactivate the OSCresponder when action is done.
</p>
77 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
78 <p class=
"p6"><span class=
"s4"><span class=
"Apple-tab-span"> </span></span>//syntax:
<span class=
"Apple-tab-span"> </span></p>
79 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"s5">OSCresponder
</span>(addr,cmdName,action).add.removeWhenDone;
</p>
80 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
81 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
82 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*add(oscResponder)
</b></p>
83 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> add the responder instance
<span class=
"Apple-converted-space"> </span></p>
84 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
85 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
86 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*remove(oscResponder)
</b></p>
87 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>remove the responder instance
<span class=
"Apple-converted-space"> </span></p>
88 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
89 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
90 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*removeAddr(addr)
</b></p>
91 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>remove all OSCresponders for that addr.
</p>
92 <p class=
"p2"><br></p>
93 <p class=
"p2"><br></p>
94 <p class=
"p2"><br></p>
95 <p class=
"p2"><br></p>
96 <p class=
"p2"><br></p>
97 <p class=
"p2"><br></p>
98 <p class=
"p2"><br></p>