aboutsummaryrefslogtreecommitdiff
path: root/guile
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-25 15:14:38 +0100
committerThomas White <taw@physics.org>2020-10-25 15:14:38 +0100
commit1925e39638c6fdf33bbb0407bb8f90b022557748 (patch)
treecebbc82182a20a04fe758e81a9302444aabdbc77 /guile
parent8726a5c44c16503697197d089d3880218d61df83 (diff)
Add set-playback-cue-list! and get-playback-cue-number
These support re-loading a cue list for live coding
Diffstat (limited to 'guile')
-rw-r--r--guile/starlet/playback.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/guile/starlet/playback.scm b/guile/starlet/playback.scm
index c340c52..1f2fde1 100644
--- a/guile/starlet/playback.scm
+++ b/guile/starlet/playback.scm
@@ -11,10 +11,12 @@
cue
cue-part
cut-to-cue-number!
+ get-playback-cue-number
run-cue-number!
go!
cue-list
- cue-state))
+ cue-state
+ set-playback-cue-list!))
;; A "playback" is a state which knows how to run cues
@@ -22,7 +24,8 @@
(define-class <starlet-playback> (<starlet-state>)
(cue-list
#:init-keyword #:cue-list
- #:getter get-playback-cue-list)
+ #:getter get-playback-cue-list
+ #:setter set-playback-cue-list!)
(next-cue-index
#:init-value 0
@@ -99,6 +102,10 @@
(cue-parts get-cue-parts))
+(define (get-playback-cue-number pb)
+ (cue-index-to-number (get-playback-cue-list pb)
+ (max 0 (- (get-next-cue-index pb) 1))))
+
(define (qnum a)
(/ (inexact->exact (* a 1000)) 1000))
@@ -109,6 +116,10 @@
new-playback))
+(define (cue-index-to-number cue-list cue-index)
+ (get-cue-number (vector-ref cue-list cue-index)))
+
+
(define (cue-number-to-index cue-list cue-number)
(vector-index (lambda (a)
(eqv? (get-cue-number a)