diff options
author | Thomas White <taw@physics.org> | 2022-04-24 18:21:15 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2022-04-24 18:21:15 +0200 |
commit | ce607588e8ccf2257fc7f1863f967e52a565ce7a (patch) | |
tree | f8656aba352a285005cde59938419ae07e39df9f /guile | |
parent | 9411275e9f6dcee09923329d54fd6e6e439a497d (diff) |
Convert some fixtures to use define-fixture
Also fixes an obvious bug in <adj-mega-tripar-profile-4ch>
Diffstat (limited to 'guile')
3 files changed, 37 insertions, 43 deletions
diff --git a/guile/starlet/fixture-library/adj/mega-tripar-profile.scm b/guile/starlet/fixture-library/adj/mega-tripar-profile.scm index 1e0579e..cec35a6 100644 --- a/guile/starlet/fixture-library/adj/mega-tripar-profile.scm +++ b/guile/starlet/fixture-library/adj/mega-tripar-profile.scm @@ -19,7 +19,6 @@ ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;; (define-module (starlet fixture-library adj mega-tripar-profile) - #:use-module (oop goops) #:use-module (starlet fixture) #:use-module (starlet colours) #:export (<adj-mega-tripar-profile-3ch> @@ -28,14 +27,16 @@ ;; 3 channel mode (RGB direct control) -(define-class <adj-mega-tripar-profile-3ch> (<fixture>) - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-colour 'colour white)))) +(define-fixture + + <adj-mega-tripar-profile-3ch> + + (list + (attr-continuous 'intensity '(0 100) 0) + (attr-colour 'colour white)) + + (get-attr set-chan8) -(define-method (scanout-fixture (fixture <adj-mega-tripar-profile-3ch>) - get-attr set-chan8 set-chan16) (let ((intensity (/ (get-attr 'intensity) 100)) (rgb (colour-as-rgb (get-attr 'colour)))) (set-chan8 1 (percent->dmxval8 (* intensity (car rgb)))) @@ -45,17 +46,18 @@ ;; 4 channel mode (RGB + separate intensity) -(define-class <adj-mega-tripar-profile-4ch> (<fixture>) - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-colour 'colour white)))) +(define-fixture -(define-method (scanout-fixture (fixture <adj-mega-tripar-profile-4ch>) - get-attr set-chan8 set-chan16) - (let ((intensity (/ (get-attr 'intensity) 100)) - (rgb (colour-as-rgb (get-attr 'colour)))) - (set-chan8 1 (percent->dmxval8 intensity)) + <adj-mega-tripar-profile-4ch> + + (list + (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))) (set-chan8 3 (percent->dmxval8 (cadr rgb))) (set-chan8 4 (percent->dmxval8 (caddr rgb))))) diff --git a/guile/starlet/fixture-library/generic/dimmer.scm b/guile/starlet/fixture-library/generic/dimmer.scm index 65e6d99..b1894b7 100644 --- a/guile/starlet/fixture-library/generic/dimmer.scm +++ b/guile/starlet/fixture-library/generic/dimmer.scm @@ -1,7 +1,7 @@ ;; ;; starlet/fixture-library/generic/dimmer.scm ;; -;; Copyright © 2020-2021 Thomas White <taw@bitwiz.org.uk> +;; Copyright © 2020-2022 Thomas White <taw@bitwiz.org.uk> ;; ;; This file is part of Starlet. ;; @@ -19,20 +19,17 @@ ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;; (define-module (starlet fixture-library generic dimmer) - #:use-module (oop goops) #:use-module (starlet fixture) #:export (<generic-dimmer>)) +(define-fixture -(define-class <generic-dimmer> (<fixture>) - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0)))) + <generic-dimmer> + (list + (attr-continuous 'intensity '(0 100) 0)) -(define-method (scanout-fixture (fixture <generic-dimmer>) - get-attr set-chan8 set-chan16) + (get-attr set-chan8) - ;; Set DMX value for intensity (set-chan8 1 (percent->dmxval8 (get-attr 'intensity)))) 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 8c30cca..d79dcc9 100644 --- a/guile/starlet/fixture-library/stairville/octagon-theater-cw-ww.scm +++ b/guile/starlet/fixture-library/stairville/octagon-theater-cw-ww.scm @@ -19,27 +19,22 @@ ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;; (define-module (starlet fixture-library stairville octagon-theater-cw-ww) - #:use-module (oop goops) #:use-module (starlet fixture) - #:use-module (starlet colours) #:export (<stairville-octagon-theater-cw-ww>)) +(define-fixture -(define-class <stairville-octagon-theater-cw-ww> (<fixture>) - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-continuous 'colour-temperature '(2800 6400) 4600)))) + <stairville-octagon-theater-cw-ww> + (list + (attr-continuous 'intensity '(0 100) 0) + (attr-continuous 'colour-temperature '(2800 6400) 4600)) -(define-method (scanout-fixture (fixture <stairville-octagon-theater-cw-ww>) - get-attr set-chan8 set-chan16) + (get-attr set-chan8 set-chan16) - (let ((intensity (get-attr 'intensity)) - (coltemp (get-attr 'colour-temperature))) + (let ((coltemp (get-attr 'colour-temperature))) (set-chan8 1 (scale-and-clamp-to-range coltemp '(2800 6400) '(0 255))) - (set-chan8 2 (scale-and-clamp-to-range coltemp '(2800 6400) '(255 0))) - (set-chan8 3 0) ;; Strobe - (set-chan8 4 0) ;; Mode (0-15 = direct control) - (set-chan8 5 (percent->dmxval8 intensity)))) - + (set-chan8 2 (scale-and-clamp-to-range coltemp '(2800 6400) '(255 0)))) + (set-chan8 3 0) ;; Strobe + (set-chan8 4 0) ;; Mode (0-15 = direct control) + (set-chan8 5 (percent->dmxval8 (get-attr 'intensity)))) |