annotate src/liblo-0.26/examples/example_client.c @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 8a15ff55d9af
children
rev   line source
cannam@89 1 /*
cannam@89 2 * Copyright (C) 2004 Steve Harris, Uwe Koloska
cannam@89 3 *
cannam@89 4 * This program is free software; you can redistribute it and/or modify
cannam@89 5 * it under the terms of the GNU Lesser General Public License as
cannam@89 6 * published by the Free Software Foundation; either version 2.1 of the
cannam@89 7 * License, or (at your option) any later version.
cannam@89 8 *
cannam@89 9 * This program is distributed in the hope that it will be useful,
cannam@89 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@89 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cannam@89 12 * GNU Lesser General Public License for more details.
cannam@89 13 *
cannam@89 14 * $Id$
cannam@89 15 */
cannam@89 16
cannam@89 17 #include <stdio.h>
cannam@89 18 #include <stdlib.h>
cannam@89 19 #include <unistd.h>
cannam@89 20
cannam@89 21 #include "lo/lo.h"
cannam@89 22
cannam@89 23 const char testdata[5] = "ABCDE";
cannam@89 24
cannam@89 25 int main(int argc, char *argv[])
cannam@89 26 {
cannam@89 27 /* build a blob object from some data */
cannam@89 28 lo_blob btest = lo_blob_new(sizeof(testdata), testdata);
cannam@89 29
cannam@89 30 /* an address to send messages to. sometimes it is better to let the server
cannam@89 31 * pick a port number for you by passing NULL as the last argument */
cannam@89 32 // lo_address t = lo_address_new_from_url( "osc.unix://localhost/tmp/mysocket" );
cannam@89 33 lo_address t = lo_address_new(NULL, "7770");
cannam@89 34
cannam@89 35 if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'q') {
cannam@89 36 /* send a message with no arguments to the path /quit */
cannam@89 37 if (lo_send(t, "/quit", NULL) == -1) {
cannam@89 38 printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t));
cannam@89 39 }
cannam@89 40 } else {
cannam@89 41 /* send a message to /foo/bar with two float arguments, report any
cannam@89 42 * errors */
cannam@89 43 if (lo_send(t, "/foo/bar", "ff", 0.12345678f, 23.0f) == -1) {
cannam@89 44 printf("OSC error %d: %s\n", lo_address_errno(t), lo_address_errstr(t));
cannam@89 45 }
cannam@89 46
cannam@89 47 /* send a message to /a/b/c/d with a mixtrure of float and string
cannam@89 48 * arguments */
cannam@89 49 lo_send(t, "/a/b/c/d", "sfsff", "one", 0.12345678f, "three",
cannam@89 50 -0.00000023001f, 1.0);
cannam@89 51
cannam@89 52 /* send a 'blob' object to /a/b/c/d */
cannam@89 53 lo_send(t, "/a/b/c/d", "b", btest);
cannam@89 54
cannam@89 55 /* send a jamin scene change instruction with a 32bit integer argument */
cannam@89 56 lo_send(t, "/jamin/scene", "i", 2);
cannam@89 57 }
cannam@89 58
cannam@89 59 return 0;
cannam@89 60 }
cannam@89 61
cannam@89 62 /* vi:set ts=8 sts=4 sw=4: */