From 0447be4186ef500a439293442519f32ee9282da8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 20 May 2021 21:00:44 +0200 Subject: Add home-fixture!/blackout! --- guile/starlet/playback.scm | 2 +- guile/starlet/state.scm | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'guile') diff --git a/guile/starlet/playback.scm b/guile/starlet/playback.scm index a766b0a..f086c18 100644 --- a/guile/starlet/playback.scm +++ b/guile/starlet/playback.scm @@ -598,7 +598,7 @@ (parameterize ((current-state (make-empty-state))) (apply-state previous-state) (unless (track-intensities the-cue) - (blackout (current-state))) + (blackout!)) (apply-state (get-cue-state the-cue)) (set-tracked-state! the-cue (current-state)) (current-state))))))) diff --git a/guile/starlet/state.scm b/guile/starlet/state.scm index 83dace5..35db6bd 100644 --- a/guile/starlet/state.scm +++ b/guile/starlet/state.scm @@ -45,7 +45,8 @@ show-state lighting-state programmer-state - blackout + home-fixture! + blackout! sel selection-hook value->number @@ -151,20 +152,21 @@ (set-in-state! state fix attr)))) ;; Try again -(define (blackout state) - (state-for-each - (lambda (fix attr val) - (when (intensity? attr) - (set-in-state! state fix attr 0.0))) - state)) +;; Set any intensity attributes in the current state to zero +(define (blackout!) + (let ((state (current-state))) + (state-for-each + (lambda (fix attr val) + (when (intensity? attr) + (set-in-state! state fix attr 0.0))) + state))) -;; Set a single attribute to home position -(define (home-attr! state fix attr) - (set-in-state! state - fix - attr - (get-attr-home-val fix attr))) +;; Set all attributes of the fixture to their home values +(define (home-fixture! fix) + (for-each (lambda (attr) + (at fix attr (get-attr-home-val fix attr))) + (get-fixture-attrs fix))) (define (copy-state state) -- cgit v1.2.3