From ce607588e8ccf2257fc7f1863f967e52a565ce7a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 24 Apr 2022 18:21:15 +0200 Subject: Convert some fixtures to use define-fixture Also fixes an obvious bug in --- .../fixture-library/adj/mega-tripar-profile.scm | 38 ++++++++++++---------- guile/starlet/fixture-library/generic/dimmer.scm | 15 ++++----- .../stairville/octagon-theater-cw-ww.scm | 27 +++++++-------- 3 files changed, 37 insertions(+), 43 deletions(-) (limited to 'guile/starlet') 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 . ;; (define-module (starlet fixture-library adj mega-tripar-profile) - #:use-module (oop goops) #:use-module (starlet fixture) #:use-module (starlet colours) #:export ( @@ -28,14 +27,16 @@ ;; 3 channel mode (RGB direct control) -(define-class () - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-colour 'colour white)))) +(define-fixture + + + + (list + (attr-continuous 'intensity '(0 100) 0) + (attr-colour 'colour white)) + + (get-attr set-chan8) -(define-method (scanout-fixture (fixture ) - 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 () - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-colour 'colour white)))) +(define-fixture -(define-method (scanout-fixture (fixture ) - 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)) + + + (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 +;; Copyright © 2020-2022 Thomas White ;; ;; This file is part of Starlet. ;; @@ -19,20 +19,17 @@ ;; along with this program. If not, see . ;; (define-module (starlet fixture-library generic dimmer) - #:use-module (oop goops) #:use-module (starlet fixture) #:export ()) +(define-fixture -(define-class () - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0)))) + + (list + (attr-continuous 'intensity '(0 100) 0)) -(define-method (scanout-fixture (fixture ) - 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 . ;; (define-module (starlet fixture-library stairville octagon-theater-cw-ww) - #:use-module (oop goops) #:use-module (starlet fixture) - #:use-module (starlet colours) #:export ()) +(define-fixture -(define-class () - (attributes - #:init-form (list - (attr-continuous 'intensity '(0 100) 0) - (attr-continuous 'colour-temperature '(2800 6400) 4600)))) + + (list + (attr-continuous 'intensity '(0 100) 0) + (attr-continuous 'colour-temperature '(2800 6400) 4600)) -(define-method (scanout-fixture (fixture ) - 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)))) -- cgit v1.2.3