Chris@4: /* Chris@4: * Copyright (C) 2004 Steve Harris, Uwe Koloska Chris@4: * Chris@4: * This program is free software; you can redistribute it and/or modify Chris@4: * it under the terms of the GNU Lesser General Public License as Chris@4: * published by the Free Software Foundation; either version 2.1 of the Chris@4: * License, or (at your option) any later version. Chris@4: * Chris@4: * This program is distributed in the hope that it will be useful, Chris@4: * but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@4: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@4: * GNU Lesser General Public License for more details. Chris@4: * Chris@4: * $Id$ Chris@4: */ Chris@4: Chris@4: #include Chris@4: #include Chris@4: #include Chris@4: Chris@4: #include "lo/lo.h" Chris@4: Chris@4: const char testdata[5] = "ABCDE"; Chris@4: Chris@4: int main(int argc, char *argv[]) Chris@4: { Chris@4: /* build a blob object from some data */ Chris@4: lo_blob btest = lo_blob_new(sizeof(testdata), testdata); Chris@4: Chris@4: /* an address to send messages to. sometimes it is better to let the server Chris@4: * pick a port number for you by passing NULL as the last argument */ Chris@4: // lo_address t = lo_address_new_from_url( "osc.unix://localhost/tmp/mysocket" ); Chris@4: lo_address t = lo_address_new(NULL, "7770"); Chris@4: Chris@4: if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'q') { Chris@4: /* send a message with no arguments to the path /quit */ Chris@4: if (lo_send(t, "/quit", NULL) == -1) { Chris@4: printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); Chris@4: } Chris@4: } else { Chris@4: /* send a message to /foo/bar with two float arguments, report any Chris@4: * errors */ Chris@4: if (lo_send(t, "/foo/bar", "ff", 0.12345678f, 23.0f) == -1) { Chris@4: printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t)); Chris@4: } Chris@4: Chris@4: /* send a message to /a/b/c/d with a mixtrure of float and string Chris@4: * arguments */ Chris@4: lo_send(t, "/a/b/c/d", "sfsff", "one", 0.12345678f, "three", Chris@4: -0.00000023001f, 1.0); Chris@4: Chris@4: /* send a 'blob' object to /a/b/c/d */ Chris@4: lo_send(t, "/a/b/c/d", "b", btest); Chris@4: Chris@4: /* send a jamin scene change instruction with a 32bit integer argument */ Chris@4: lo_send(t, "/jamin/scene", "i", 2); Chris@4: } Chris@4: Chris@4: return 0; Chris@4: } Chris@4: Chris@4: /* vi:set ts=8 sts=4 sw=4: */