aboutsummaryrefslogtreecommitdiff
path: root/guile/starlet/fixture-library
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2020-12-05 15:08:05 +0100
committerThomas White <taw@bitwiz.me.uk>2020-12-05 15:08:05 +0100
commit8b937adbf3dffdb1f0ebedf8e31addda8390640f (patch)
tree437c60e8d7296e5b3dd1d152cb6ba4b5b828f1f0 /guile/starlet/fixture-library
parentb275d77794f5243a2e58899dfd7fcb8af0c757d5 (diff)
Add generic-rgb
Diffstat (limited to 'guile/starlet/fixture-library')
-rw-r--r--guile/starlet/fixture-library/generic.scm41
1 files changed, 40 insertions, 1 deletions
diff --git a/guile/starlet/fixture-library/generic.scm b/guile/starlet/fixture-library/generic.scm
index 7d75e57..5806788 100644
--- a/guile/starlet/fixture-library/generic.scm
+++ b/guile/starlet/fixture-library/generic.scm
@@ -1,7 +1,8 @@
(define-module (starlet fixture-library generic)
#:use-module (oop goops)
#:use-module (starlet base)
- #:export (<generic-dimmer>))
+ #:export (<generic-dimmer>
+ generic-rgb))
(define-class <generic-dimmer> (<fixture>)
(attributes
@@ -14,3 +15,41 @@
;; Set DMX value for intensity
(set-chan 1 (percent->dmxval (get-attr 'intensity))))
+
+
+(define (chan->attr chan)
+ (attr-continuous chan '(0 100) 0))
+
+
+(define (generic-rgb chans)
+
+ (let ((new-class (make-class
+ (list <fixture>)
+ (list (cons 'attributes
+ (list #:init-thunk
+ (lambda ()
+ (map chan->attr chans)))))
+ #:name 'generic-rgb)))
+
+ (add-method!
+ scanout-fixture
+ (method ((fix new-class) get-attr set-chan set-chan-16bit)
+ (for-each
+
+ (lambda (chan offset)
+
+ (cond
+
+ ((eq? chan '0)
+ (set-chan offset 0))
+
+ ((eq? chan 'FL)
+ (set-chan offset 255))
+
+ (else (set-chan offset
+ (percent->dmxval
+ (get-attr chan))))))
+
+ chans (iota (length chans) 1))))
+
+ new-class))