From d4598b36c8aaaae77790ce77cee544e36f6b48ae Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 10 Oct 2015 04:22:28 +0200 Subject: moved osc stuff to separate files --- apps/dolmetschctl.c | 59 +++++------------------------------------------------ 1 file changed, 5 insertions(+), 54 deletions(-) (limited to 'apps/dolmetschctl.c') 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 -#include #include -#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; } -- cgit v1.2.3