From e302148f2e8791585edfc23705450aa921faaa17 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 23 Oct 2020 22:26:43 +0200 Subject: Plumbing for cue parts --- examples/demo.scm | 6 +++- guile/starlet/playback.scm | 71 +++++++++++++++++++++++++++++++++------------- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/examples/demo.scm b/examples/demo.scm index 6553965..e3e4bb3 100644 --- a/examples/demo.scm +++ b/examples/demo.scm @@ -100,7 +100,11 @@ (cue 3 (cue-state (blackout (current-state))) #:fade-up 0 - #:fade-down 2))) + #:fade-down 2 + + (cue-part (list dim11 dim13) + #:fade-down 2 + #:down-delay 2)))) ;; Create a playback for the cue list, and register it for output diff --git a/guile/starlet/playback.scm b/guile/starlet/playback.scm index 82dbd14..5d3332e 100644 --- a/guile/starlet/playback.scm +++ b/guile/starlet/playback.scm @@ -1,5 +1,7 @@ (define-module (starlet playback) #:use-module (oop goops) + #:use-module (ice-9 optargs) + #:use-module (ice-9 receive) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-43) @@ -7,6 +9,7 @@ #:use-module (starlet utils) #:export (make-playback cue + cue-part cut-to-cue-number! run-cue-number! go! @@ -32,6 +35,14 @@ #:setter set-fade-records!)) +(define-record-type + (make-cue-part attr-list + fade-times) + cue-part? + (attr-list get-cue-part-attr-list) + (fade-times get-cue-part-fade-times)) + + (define-record-type (make-fade-times up-time down-time @@ -77,13 +88,15 @@ state-function realized-state fade-times - track-intensities) + track-intensities + cue-parts) cue? (number get-cue-number) (state-function get-cue-state-function) (realized-state get-realized-state set-realized-state!) (fade-times get-cue-fade-times) - (track-intensities track-intensities)) + (track-intensities track-intensities) + (cue-parts cue-parts)) (define (qnum a) @@ -324,23 +337,43 @@ body ...)))) -(define* (cue number - state-function - #:key - (fade-up 5) - (fade-down 5) - (up-delay 0) - (down-delay 0) - (track-intensities #f)) - (make-cue (qnum number) - state-function - #f - (make-fade-times - fade-up - fade-down - up-delay - down-delay) - track-intensities)) +(define* (cue-part attr-list + #:key + (fade-up 5) + (fade-down 5) + (up-delay 0) + (down-delay 0)) + + (make-cue-part attr-list + (make-fade-times + fade-up + fade-down + up-delay + down-delay))) + + +(define cue + (lambda (number state-function . rest) + (receive (cue-parts rest-minus-cue-parts) + (partition cue-part? rest) + (let-keywords rest-minus-cue-parts #f + ((fade-up 5) + (fade-down 5) + (up-delay 0) + (down-delay 0) + (track-intensities #f)) + + (make-cue (qnum number) + state-function + #f + (make-fade-times + fade-up + fade-down + up-delay + down-delay) + track-intensities + cue-parts))))) + (define (ensure-cue-zero-realized cue-list) (unless (get-realized-state (vector-ref cue-list 0)) -- cgit v1.2.3