From 4552ce9ecb3e49f1c54a52fd41375b2f9c40c9e8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 6 May 2022 16:27:41 +0200 Subject: define-fixture: Eliminate need to provide names for get-attr etc This needed some rearranging, but I think the resulting code is a little bit more efficient. --- .../fixture-library/adj/mega-tripar-profile.scm | 9 ++--- guile/starlet/fixture-library/generic/dimmer.scm | 5 +-- guile/starlet/fixture-library/robe/dl7s/mode1.scm | 43 ++++++++++------------ .../stairville/octagon-theater-cw-ww.scm | 7 ++-- 4 files changed, 27 insertions(+), 37 deletions(-) (limited to 'guile/starlet/fixture-library') diff --git a/guile/starlet/fixture-library/adj/mega-tripar-profile.scm b/guile/starlet/fixture-library/adj/mega-tripar-profile.scm index 6f70d40..90a84f6 100644 --- a/guile/starlet/fixture-library/adj/mega-tripar-profile.scm +++ b/guile/starlet/fixture-library/adj/mega-tripar-profile.scm @@ -19,6 +19,7 @@ ;; along with this program. If not, see . ;; (define-module (starlet fixture-library adj mega-tripar-profile) + #:use-module (starlet scanout) #:use-module (starlet fixture) #:use-module (starlet utils) #:use-module (starlet colours) @@ -32,12 +33,10 @@ - (list + (fixture-attributes (attr-continuous 'intensity '(0 100) 0) (attr-colour 'colour white)) - (get-attr set-chan8) - (let ((intensity (/ (get-attr 'intensity) 100)) (rgb (colour-as-rgb (get-attr 'colour)))) (set-chan8 1 (percent->dmxval8 (* intensity (car rgb)))) @@ -51,12 +50,10 @@ - (list + (fixture-attributes (attr-continuous 'intensity '(0 100) 0) (attr-colour 'colour white)) - (get-attr set-chan8) - (let ((rgb (colour-as-rgb (get-attr 'colour)))) (set-chan8 1 (percent->dmxval8 (get-attr 'intensity))) (set-chan8 2 (percent->dmxval8 (car rgb))) diff --git a/guile/starlet/fixture-library/generic/dimmer.scm b/guile/starlet/fixture-library/generic/dimmer.scm index 844b697..e823dc7 100644 --- a/guile/starlet/fixture-library/generic/dimmer.scm +++ b/guile/starlet/fixture-library/generic/dimmer.scm @@ -19,6 +19,7 @@ ;; along with this program. If not, see . ;; (define-module (starlet fixture-library generic dimmer) + #:use-module (starlet scanout) #:use-module (starlet fixture) #:use-module (starlet utils) #:export ()) @@ -27,10 +28,8 @@ - (list + (fixture-attributes (attr-continuous 'intensity '(0 100) 0)) - (get-attr set-chan8) - (set-chan8 1 (percent->dmxval8 (get-attr 'intensity)))) diff --git a/guile/starlet/fixture-library/robe/dl7s/mode1.scm b/guile/starlet/fixture-library/robe/dl7s/mode1.scm index e9d5a9a..2a5eb46 100644 --- a/guile/starlet/fixture-library/robe/dl7s/mode1.scm +++ b/guile/starlet/fixture-library/robe/dl7s/mode1.scm @@ -25,22 +25,18 @@ #:export ()) -(define-class () - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-continuous 'pan '(0 540) 270) - (attr-continuous 'tilt '(0 270) 135) - (attr-list 'strobe '(#t #f) #f) - (attr-list 'prism '(#t #f) #f) - (attr-list 'tungsten-watts-emulation '(750 1000 1200 2000 2500 #f) #f) - (attr-colour 'colour white) - (attr-continuous 'colour-temperature-correction '(2700 8000) 8000) - (attr-continuous 'green-correction '(-100 100) 0)))) +(define-fixture + -(define-method (scanout-fixture (fixture ) - get-attr set-chan8 set-chan16) + (fixture-attributes + (attr-continuous 'intensity '(0 100) 0) + (attr-continuous 'pan '(0 540) 270) + (attr-continuous 'tilt '(0 270) 135) + (attr-list 'strobe '(#t #f) #f) + (attr-list 'prism '(#t #f) #f) + (attr-colour 'colour white) + (attr-continuous 'colour-temperature '(2700 8000) 3200)) (set-chan16 50 (percent->dmxval16 (get-attr 'intensity))) @@ -51,15 +47,14 @@ (set-chan8 28 (if (get-attr 'prism) 50 0)) - (set-chan8 7 (assv-ref '((750 . 82) - (1000 . 88) - (1200 . 92) - (2000 . 97) - (2500 . 102) - (#f . 107)) - (get-attr 'tungsten-watts-emulation))) + (set-chan8 6 0) ;; Power/special function: default + (set-chan8 7 0) ;; Colour mode: default + + (set-chan8 15 + (scale-and-clamp-to-range (get-attr 'colour-temperature) + '(8000 2700) '(0 255))) (let ((cmy (colour-as-cmy (get-attr 'colour)))) - (set-chan8 9 (percent->dmxval8 (car cmy))) - (set-chan8 11 (percent->dmxval8 (cadr cmy))) - (set-chan8 13 (percent->dmxval8 (caddr cmy))))) + (set-chan16 9 (percent->dmxval16 (car cmy))) + (set-chan16 11 (percent->dmxval16 (cadr cmy))) + (set-chan16 13 (percent->dmxval16 (caddr cmy))))) diff --git a/guile/starlet/fixture-library/stairville/octagon-theater-cw-ww.scm b/guile/starlet/fixture-library/stairville/octagon-theater-cw-ww.scm index f2ed8a5..b42de26 100644 --- a/guile/starlet/fixture-library/stairville/octagon-theater-cw-ww.scm +++ b/guile/starlet/fixture-library/stairville/octagon-theater-cw-ww.scm @@ -19,6 +19,7 @@ ;; along with this program. If not, see . ;; (define-module (starlet fixture-library stairville octagon-theater-cw-ww) + #:use-module (starlet scanout) #:use-module (starlet fixture) #:use-module (starlet utils) #:export ()) @@ -27,11 +28,9 @@ - (list + (fixture-attributes (attr-continuous 'intensity '(0 100) 0) - (attr-continuous 'colour-temperature '(2800 6400) 4600)) - - (get-attr set-chan8 set-chan16) + (attr-continuous 'colour-temperature '(2800 6400) 3200)) (let ((coltemp (get-attr 'colour-temperature))) (set-chan8 1 (scale-and-clamp-to-range coltemp '(2800 6400) '(0 255))) -- cgit v1.2.3