aboutsummaryrefslogtreecommitdiff
path: root/guile/starlet/midi-control
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-05-22 20:14:50 +0200
committerThomas White <taw@physics.org>2021-05-22 20:14:50 +0200
commit757c3424af0156286725f83c3d1acdcd3654fb5c (patch)
treed586d3972019c05ff1b86ca095b519649d3d8b64 /guile/starlet/midi-control
parenta8f22ae3f9149f02e277badd63e9b37b3f3293b5 (diff)
Indicate playback paused via LEDs
Diffstat (limited to 'guile/starlet/midi-control')
-rw-r--r--guile/starlet/midi-control/button-utils.scm55
1 files changed, 40 insertions, 15 deletions
diff --git a/guile/starlet/midi-control/button-utils.scm b/guile/starlet/midi-control/button-utils.scm
index 859412d..8dcfbf2 100644
--- a/guile/starlet/midi-control/button-utils.scm
+++ b/guile/starlet/midi-control/button-utils.scm
@@ -29,27 +29,52 @@
(define* (make-go-button pb button
- #:key (channel #f))
- (register-midi-note-callback!
- #:channel channel
- #:note-number button
- #:func (lambda () (go! pb))))
+ #:key
+ (channel #f)
+ (ready-note #f)
+ (pause-note #f))
+ (register-midi-note-callback!
+ #:channel channel
+ #:note-number button
+ #:func (lambda () (go! pb)))
+
+ (when (or ready-note pause-note)
+ (add-hook!
+ (state-change-hook pb)
+ (lambda (new-state)
+ (cond
+ ((eq? new-state 'pause)
+ (send-note-on pause-note))
+ ((eq? new-state 'ready)
+ (send-note-on ready-note))
+ (else
+ (send-note-off ready-note)))))))
(define* (make-stop-button pb button
- #:key (channel #f))
- (register-midi-note-callback!
- #:channel channel
- #:note-number button
- #:func (lambda () (stop! pb))))
+ #:key
+ (channel #f)
+ (ready-note #f))
+ (register-midi-note-callback!
+ #:channel channel
+ #:note-number button
+ #:func (lambda () (stop! pb)))
+
+ (when ready-note
+ (send-note-on ready-note)))
(define* (make-back-button pb button
- #:key (channel #f))
- (register-midi-note-callback!
- #:channel channel
- #:note-number button
- #:func (lambda () (back! pb))))
+ #:key
+ (channel #f)
+ (ready-note #f))
+ (register-midi-note-callback!
+ #:channel channel
+ #:note-number button
+ #:func (lambda () (back! pb)))
+
+ (when ready-note
+ (send-note-on ready-note)))
(define* (select-on-button button fixture