aboutsummaryrefslogtreecommitdiff
path: root/guile/starlet/open-sound-control/utils.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guile/starlet/open-sound-control/utils.scm')
-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)))