aboutsummaryrefslogtreecommitdiff
path: root/guile/starlet/open-sound-control
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-05-15 21:04:24 +0200
committerThomas White <taw@physics.org>2023-05-15 21:04:24 +0200
commitbd271d16160fba132da9a82bd0c574c9f26e2942 (patch)
tree62710e99f73876c97b369ee298adbd8add79c110 /guile/starlet/open-sound-control
parent9bf4c19bdee95d6fc61c9c3331ec551e71aa0bb2 (diff)
Implement OSC encoders for list attributesosc-with-guileosc
Diffstat (limited to 'guile/starlet/open-sound-control')
-rw-r--r--guile/starlet/open-sound-control/utils.scm12
1 files changed, 10 insertions, 2 deletions
diff --git a/guile/starlet/open-sound-control/utils.scm b/guile/starlet/open-sound-control/utils.scm
index 4f0a60b..932abaa 100644
--- a/guile/starlet/open-sound-control/utils.scm
+++ b/guile/starlet/open-sound-control/utils.scm
@@ -92,10 +92,18 @@
(get-selection)))
-(define (encoder-inc attr n)
+(define (encoder-inc attr-id n)
(for-each
(lambda (fix)
- (at fix attr (+ (current-value fix attr) n)))
+ (let ((attr (find-attr fix attr-id))
+ (cval (current-value fix attr-id)))
+ (cond
+ ((eq? 'continuous (get-attr-type attr))
+ (at fix attr-id (+ cval n)))
+ ((eq? 'list (get-attr-type attr))
+ (if (> n 0)
+ (at fix attr-id (next-attr-item attr cval))
+ (at fix attr-id (prev-attr-item attr cval)))))))
(get-selection)))