Debian Codegraph @

examples/osc/s.ck

raw
1 //----------------------------------------------------------------------------
2 // name: s.ck ('s' is "sender")
3 // desc: OpenSoundControl (OSC) sender example
4 // note: launch with r.ck (that's the receiver)
5 //----------------------------------------------------------------------------
6
7 // destination host name
8 "localhost" => string hostname;
9 // destination port number
10 6449 => int port;
11
12 // check command line
13 if( me.args() ) me.arg(0) => hostname;
14 if( me.args() > 1 ) me.arg(1) => Std.atoi => port;
15
16 // sender object
17 OscOut xmit;
18
19 // aim the transmitter at destination
20 xmit.dest( hostname, port );
21
22 // infinite time loop
23 while( true )
24 {
25 // start the message...
26 xmit.start( "/foo/notes" );
27
28 // add int argument
29 Math.random2( 30, 80 ) => xmit.add;
30 // add float argument
31 Math.random2f( .1, .5 ) => xmit.add;
32
33 // send it
34 xmit.send();
35
36 // advance time
37 0.2::second => now;
38 }