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