Beispiel #1
0
/** Run some tests to make sure the library behaves in a sane way.
 */
function test_osc_lib()
{
    $c = new OSCClient();
    $c->set_destination("192.168.1.5", 3980);
    $m1 = new OSCMessage("/test", array(new Timetag(3294967295.0, 5), new Infinitum(), new Blob("aoeuaoeu!")));
    $m1->add_arg(28658.93, "d");
    $m2 = new OSCMessage("/bar", array(1, 2, array(1, 2, 3)));
    $b = new OSCBundle();
    $b->add_datagram($m1);
    $b->add_datagram($m2);
    $b2 = new OSCBundle(array($m1, $b));
    echo $b2->get_human_readable();
    //echo $m1->get_human_readable();
    $c->send($m1);
}
Beispiel #2
0
 * @author     Lucas S. Bickel <*****@*****.**>
 * @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", array(1, 12, array(array("channel", 1, "state", false), false, true)));
$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);