diff options
author | Thomas White <taw@physics.org> | 2022-10-30 09:52:09 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2022-10-30 09:52:09 +0100 |
commit | 028356e4bfd6d2f9d8861178fcc2c70603043330 (patch) | |
tree | d6b10af66775a2b1d0647ca4707eb3b1e82af811 /guile/starlet | |
parent | 9a617419876d2f3a79dbc50071ae0105f731d6ec (diff) |
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.
Diffstat (limited to 'guile/starlet')
-rw-r--r-- | guile/starlet/midi-control/button-utils.scm | 27 |
1 files changed, 15 insertions, 12 deletions
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 |