aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2020-12-23 12:18:09 +0100
committerThomas White <taw@bitwiz.me.uk>2020-12-23 12:18:09 +0100
commitd1d8f243d7fe8144b7d30a80e7db3fe4d9f06d3d (patch)
tree09b0bda3e1cd6b79ccbac45e4365de23ecc6e124
parent0b6dc4c62134c6ad3e94ca2493f9500bb78462b0 (diff)
Add separate fade time for non-intensity attributes
-rw-r--r--guile/starlet/playback.scm49
1 files changed, 40 insertions, 9 deletions
diff --git a/guile/starlet/playback.scm b/guile/starlet/playback.scm
index 126d014..ddeb517 100644
--- a/guile/starlet/playback.scm
+++ b/guile/starlet/playback.scm
@@ -49,13 +49,17 @@
(define-record-type <fade-times>
(make-fade-times up-time
down-time
+ attr-time
up-delay
- down-delay)
+ down-delay
+ attr-delay)
fade-times?
(up-time get-fade-up-time)
(down-time get-fade-down-time)
+ (attr-time get-fade-attr-time)
(up-delay get-fade-up-delay)
- (down-delay get-fade-down-delay))
+ (down-delay get-fade-down-delay)
+ (attr-delay get-fade-attr-delay))
;; Macro to avoid a profusion of (get-fade-xxx-time fade-times)
@@ -65,12 +69,16 @@
((_ fade-times body ...)
(with-syntax ((up-time (datum->syntax x 'up-time))
(down-time (datum->syntax x 'down-time))
+ (attr-time (datum->syntax x 'attr-time))
(up-delay (datum->syntax x 'up-delay))
- (down-delay (datum->syntax x 'down-delay)))
+ (down-delay (datum->syntax x 'down-delay))
+ (attr-delay (datum->syntax x 'attr-delay)))
#'(let ((up-time (get-fade-up-time fade-times))
(down-time (get-fade-down-time fade-times))
+ (attr-time (get-fade-attr-time fade-times))
(up-delay (get-fade-up-delay fade-times))
- (down-delay (get-fade-down-delay fade-times)))
+ (down-delay (get-fade-down-delay fade-times))
+ (attr-delay (get-fade-attr-delay fade-times)))
body ...))))))
@@ -148,6 +156,8 @@
0.0
0.0
0.0
+ 0.0
+ 0.0
0.0)
0.0
val)))
@@ -266,6 +276,14 @@
(cond
+ ;; Non-intensity attribute
+ ((not (intensity? attr))
+ (set-in-state! pb fix attr (wrap-fade (fade-previous fade-record)
+ (fade-target fade-record)
+ attr-time
+ attr-delay
+ (fade-start-time fade-record))))
+
;; Number to number, fading up
((and (number? target) (number? prev-val) (> target prev-val))
(set-in-state! pb fix attr (wrap-fade prev-val
@@ -309,7 +327,11 @@
(> tnow
(+ (fade-start-time fade-record)
down-delay
- down-time)))))
+ down-time))
+ (> tnow
+ (+ (fade-start-time fade-record)
+ attr-delay
+ attr-time)))))
(define (match-fix-attr attr-el fix attr)
@@ -401,14 +423,18 @@
#:key
(up-time 5)
(down-time 5)
+ (attr-time 3)
(up-delay 0)
- (down-delay 0))
+ (down-delay 0)
+ (attr-delay 0))
(make-cue-part attr-list
(make-fade-times
up-time
down-time
+ attr-time
up-delay
- down-delay)))
+ down-delay
+ attr-delay)))
(define cue
@@ -418,8 +444,10 @@
(let-keywords rest-minus-cue-parts #f
((up-time 5)
(down-time 5)
+ (attr-time 5)
(up-delay 0)
(down-delay 0)
+ (attr-delay 0)
(track-intensities #f))
(make-cue (qnum number)
@@ -428,8 +456,10 @@
(make-fade-times
up-time
down-time
+ attr-time
up-delay
- down-delay)
+ down-delay
+ attr-delay)
track-intensities
cue-parts)))))
@@ -464,5 +494,6 @@
(vector (cue 0
(lambda () #f) ;; The real base state is in ensure-cue-zero-realized
#:up-time 0
- #:down-time 0)
+ #:down-time 0
+ #:attr-time 0)
body ...))))