aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-23 22:26:43 +0200
committerThomas White <taw@physics.org>2020-10-23 22:26:43 +0200
commite302148f2e8791585edfc23705450aa921faaa17 (patch)
treeb168137da6e979c527a3d77e7c716b089e33e9be
parentea61ae682b7b8c75845cf77af4f25a53dd19d4c2 (diff)
Plumbing for cue parts
-rw-r--r--examples/demo.scm6
-rw-r--r--guile/starlet/playback.scm71
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 <cue-part>
+ (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 <fade-times>
(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))