summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-04-22 13:47:28 +0200
committerThomas White <taw@physics.org>2023-04-22 13:47:28 +0200
commit609a58ed984d71710714ccfc12c3da9a50358ef3 (patch)
tree97c661f3693f3076c22b79fb8525f9a1a0c71506
parent5a60df03e8dda566c9006c20fd687f0d6c271cf2 (diff)
osc-send: Handle string types
-rw-r--r--README.md4
-rw-r--r--guile-osc.c6
2 files changed, 10 insertions, 0 deletions
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");
}