diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-10-10 04:22:28 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-10-10 04:22:28 +0200 |
commit | d4598b36c8aaaae77790ce77cee544e36f6b48ae (patch) | |
tree | 8947de86383d2b355ad122f3bc82628f561c3a6d /apps/dolmetschctl.c | |
parent | app vs apps (diff) |
moved osc stuff to separate files
Diffstat (limited to 'apps/dolmetschctl.c')
-rw-r--r-- | apps/dolmetschctl.c | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/apps/dolmetschctl.c b/apps/dolmetschctl.c index 1d695a5..e60dbcc 100644 --- a/apps/dolmetschctl.c +++ b/apps/dolmetschctl.c @@ -23,12 +23,9 @@ #include "config.h" #include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#include "lo/lo.h" - -volatile int done = 0; +#include "osc.h" void print_version() { @@ -42,62 +39,16 @@ void print_version() #endif } -void print_error(int num, const char *msg, const char *path) -{ - printf("liblo server error %d in path %s: %s\n", num, path, msg); - fflush(stdout); -} - - -int generic_handler(const char *path, const char *types, lo_arg ** argv, - int argc, void *data, void *user_data) -{ - int i; - - printf("path: <%s>\n", path); - for(i = 0; i < argc; i++) { - printf("arg %d '%c' ", i, types[i]); - lo_arg_pp((lo_type)types[i], argv[i]); - printf("\n"); - } - printf("\n"); - fflush(stdout); - - return 1; -} - -int foo_handler(const char *path, const char *types, lo_arg ** argv, - int argc, void *data, void *user_data) -{ - printf("%s <- f:%f, i:%d\n", path, argv[0]->f, argv[1]->i); - fflush(stdout); - - return 0; -} - -int quit_handler(const char *path, const char *types, lo_arg ** argv, - int argc, void *data, void *user_data) -{ - done = 1; - printf("quiting\n"); - fflush(stdout); - - return 0; -} int main(int argc, char* argv[]) { - lo_server_thread st = lo_server_thread_new("7770", print_error); - lo_server_thread_add_method(st, NULL, NULL, generic_handler, NULL); - lo_server_thread_add_method(st, "/foo/bar", "fi", foo_handler, NULL); - lo_server_thread_add_method(st, "/quit", "", quit_handler, NULL); - lo_server_thread_start(st); + lo_server_thread st = osc_init("7770"); - while (!done) { + osc_start(st); + while (1) { usleep(1000); } - - lo_server_thread_free(st); + osc_stop(st); return 0; } |