From 609a58ed984d71710714ccfc12c3da9a50358ef3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 22 Apr 2023 13:47:28 +0200 Subject: osc-send: Handle string types --- README.md | 4 ++++ guile-osc.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 49e253f..80869b0 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,12 @@ Or, to send messages (with parameters): ``` (use-modules (open-sound-control client)) + (define osc-send-addr (make-osc-address "7771")) + (osc-send osc-send-addr "/their/osc/method" 1 2 4) +(osc-send osc-send-addr "/their/other/method" "string-arg") +(osc-send osc-send-addr "/yet/another/method" 0.3 "hello") ``` diff --git a/guile-osc.c b/guile-osc.c index d415715..5363c53 100644 --- a/guile-osc.c +++ b/guile-osc.c @@ -242,6 +242,12 @@ static SCM osc_send(SCM addr_obj, SCM path_obj, SCM rest) lo_message_add_double(message, scm_to_double(item)); } else if ( scm_is_true(scm_integer_p(item)) ) { lo_message_add_int32(message, scm_to_int(item)); + } else if ( scm_is_true(scm_string_p(item)) ) { + lo_message_add_string(message, scm_to_utf8_stringn(item, NULL)); + } else if ( scm_is_true(scm_symbol_p(item)) ) { + lo_message_add_symbol(message, + scm_to_utf8_stringn(scm_symbol_to_string(item), + NULL)); } else { fprintf(stderr, "Unrecognised type\n"); } -- cgit v1.2.3