From 028356e4bfd6d2f9d8861178fcc2c70603043330 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 30 Oct 2022 09:52:09 +0100 Subject: MIDI control: Set go button LED on startup Previously, the LED would not be lit until the first playback event (go/back etc) after startup. --- guile/starlet/midi-control/button-utils.scm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'guile') diff --git a/guile/starlet/midi-control/button-utils.scm b/guile/starlet/midi-control/button-utils.scm index d9a3c1c..0786cab 100644 --- a/guile/starlet/midi-control/button-utils.scm +++ b/guile/starlet/midi-control/button-utils.scm @@ -46,18 +46,21 @@ (set! time-last-press time-this-press))))) (when (or ready-note pause-note) - (add-hook! - (state-change-hook pb) - (lambda (new-state) - (cond - ((eq? new-state 'pause) - (send-note-on controller pause-note)) - ((eq? new-state 'ready) - (send-note-on controller ready-note)) - ((eq? new-state 'running) - (send-note-on controller ready-note)) - (else - (send-note-off controller ready-note))))))) + (let ((state-change-func + (lambda (new-state) + (cond + ((eq? new-state 'pause) + (send-note-on controller pause-note)) + ((eq? new-state 'ready) + (send-note-on controller ready-note)) + ((eq? new-state 'running) + (send-note-on controller ready-note)) + (else + (send-note-off controller ready-note)))))) + (add-hook! + (state-change-hook pb) + state-change-func) + (state-change-func (playback-state pb))))) (define* (make-stop-button controller pb button -- cgit v1.2.3