| 1 |
//---------------------------------------------------------------------------- |
| 2 |
// name: s-multicast.ck |
| 3 |
// desc: OSC example: multicasting to all clients on LAN |
| 4 |
// note: launch with r.ck (one on each client on local area network) |
| 5 |
// |
| 6 |
// author: Ge Wang (https://ccrma.stanford.edu/~ge/) |
| 7 |
// date: spring 2022 |
| 8 |
//---------------------------------------------------------------------------- |
| 9 |
|
| 10 |
// multicast address sends to all machines on local network |
| 11 |
"224.0.0.1" => string hostname; |
| 12 |
// destination port number |
| 13 |
6449 => int port; |
| 14 |
|
| 15 |
// sender object |
| 16 |
OscOut xmit; |
| 17 |
|
| 18 |
// aim the transmitter at destination |
| 19 |
xmit.dest( hostname, port ); |
| 20 |
|
| 21 |
// infinite time loop |
| 22 |
while( true ) |
| 23 |
{ |
| 24 |
// start the message... |
| 25 |
xmit.start( "/foo/notes" ); |
| 26 |
|
| 27 |
// add int argument |
| 28 |
Math.random2( 30, 80 ) => xmit.add; |
| 29 |
// add float argument |
| 30 |
Math.random2f( .1, .5 ) => xmit.add; |
| 31 |
|
| 32 |
// send it |
| 33 |
xmit.send(); |
| 34 |
|
| 35 |
// advance time |
| 36 |
0.2::second => now; |
| 37 |
} |