This repository has been archived by the owner on Nov 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
oscsend.php
82 lines (76 loc) · 1.71 KB
/
oscsend.php
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
<?php
/**
* send some OSC packets to test osctest.php
*
* This shows how to send the most important datatypes and how to
* send nested data as array or as osc bundle.
*
* PHP Version 5
*
* @category PoscHP
* @package Osc
* @subpackage Test
* @author Lucas S. Bickel <[email protected]>
* @copyright 2011 Lucas S. Bickel 2011 - Alle Rechte vorbehalten
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPLv3
* @link http://osc.purplehaze.ch
*/
/**
* load andy schmeders osc client
*/
require_once 'lib/OSC.php';
/**
* setup OSCClient
*/
$client = new OSCClient();
$client->set_destination("localhost", 10000);
/**
* send a osc message with nested array data
*/
$m = new OSCMessage(
"/container/method", // OSC Address
array( // Array of data
1, // int
12, // int
array( // array in data
array( // nesting supported
"channel", // string
1, // int
"state", // string
false // boolean
),
false, // boolean
true // boolean
)
)
);
$client->send($m);
/**
* send osc bundle with multiple messages
*/
$b = new OSCBundle();
$b->add_datagram(
new OSCMessage(
"/foo",
array(
100,
"like a boss",
)
)
);
$b->add_datagram(
new OSCMessage(
"/bar",
array(
new Timetag,
true,
255
)
)
);
$client->send($b);
/**
* send last osc bundle nested in a osc bundle
*/
$b = new OSCBundle(array($b));
$client->send($b);