From 7f792b7bf4294091578db766cb2217572f34d02a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 26 Jun 2022 11:44:14 +0200 Subject: cue-proc: Allow a cue made up only of cue parts --- guile/starlet/cue-list.scm | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'guile/starlet') diff --git a/guile/starlet/cue-list.scm b/guile/starlet/cue-list.scm index dd3edbd..a2361b0 100644 --- a/guile/starlet/cue-list.scm +++ b/guile/starlet/cue-list.scm @@ -116,27 +116,40 @@ (receive (states transition-effects cue-parts rest) (categorize args lighting-state? transition-effect? cue-part?) + (let-keywords rest #f ;; allow-other-keys? ((track-intensities #f)) - (when (> (length states) 1) - (error "A cue can only contain one state")) + (let ((n-tr-effs (length transition-effects)) + (n-states (length states))) + + (make-cue (qnum number) + #f ;; preset state, to be filled later + track-intensities + + ;; Create the list of cue parts + (cond + + ;; Only explicitly-stated cue parts + [(= 0 n-tr-effs n-states) + cue-parts] - (when (> (length transition-effects) 1) - (error "A cue can only contain one transition effect")) + ;; Implicit first cue part + [(= 1 n-tr-effs n-states) + (cons + (cue-part (car states) + (car transition-effects)) + cue-parts)] - (let ((the-cue (make-cue (qnum number) - #f ;; preset state, to be filled later - track-intensities - (cons - (cue-part (car states) - (car transition-effects)) - cue-parts) - (current-cue-clock)))) + ;; Wrong number of states or transition effects + [(not (= n-states 1)) + (error "A cue can only contain one state")] + [(not (= n-tr-effs 1)) + (error "A cue can only contain one transition effect")]) - the-cue)))) + (current-cue-clock)))))) (define current-cue-clock (make-parameter #f)) -- cgit v1.2.3