aboutsummaryrefslogtreecommitdiff
path: root/guile/starlet/midi-control/button-utils.scm
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-08-08 16:33:29 +0200
committerThomas White <taw@physics.org>2021-08-08 16:54:34 +0200
commitbc6dccd1fa53644f81274a5b660749ced7d9d8a5 (patch)
tree41c83fee7516363f6b565abf8f6cf141e9fff7fe /guile/starlet/midi-control/button-utils.scm
parent66c697340b3de829531793ea51369deeeb7d2372 (diff)
Make each MIDI controller into its own object
Diffstat (limited to 'guile/starlet/midi-control/button-utils.scm')
-rw-r--r--guile/starlet/midi-control/button-utils.scm36
1 files changed, 16 insertions, 20 deletions
diff --git a/guile/starlet/midi-control/button-utils.scm b/guile/starlet/midi-control/button-utils.scm
index 449a164..8462e3e 100644
--- a/guile/starlet/midi-control/button-utils.scm
+++ b/guile/starlet/midi-control/button-utils.scm
@@ -28,13 +28,12 @@
select-on-button))
-(define* (make-go-button pb button
+(define* (make-go-button controller pb button
#:key
- (channel #f)
(ready-note #f)
(pause-note #f))
(register-midi-note-callback!
- #:channel channel
+ controller
#:note-number button
#:func (lambda () (go! pb)))
@@ -44,21 +43,20 @@
(lambda (new-state)
(cond
((eq? new-state 'pause)
- (send-note-on pause-note))
+ (send-note-on controller pause-note))
((eq? new-state 'ready)
- (send-note-on ready-note))
+ (send-note-on controller ready-note))
((eq? new-state 'running)
- (send-note-on ready-note))
+ (send-note-on controller ready-note))
(else
- (send-note-off ready-note)))))))
+ (send-note-off controller ready-note)))))))
-(define* (make-stop-button pb button
+(define* (make-stop-button controller pb button
#:key
- (channel #f)
(ready-note #f))
(register-midi-note-callback!
- #:channel channel
+ controller
#:note-number button
#:func (lambda () (stop! pb)))
@@ -67,31 +65,29 @@
(state-change-hook pb)
(lambda (new-state)
(if (eq? new-state 'running)
- (send-note-on ready-note)
- (send-note-off ready-note))))))
+ (send-note-on controller ready-note)
+ (send-note-off controller ready-note))))))
-(define* (make-back-button pb button
+(define* (make-back-button controller pb button
#:key
- (channel #f)
(ready-note #f))
(register-midi-note-callback!
- #:channel channel
+ controller
#:note-number button
#:func (lambda () (back! pb)))
(when ready-note
- (send-note-on ready-note)))
+ (send-note-on controller ready-note)))
-(define* (select-on-button button fixture
+(define* (select-on-button controller button fixture
#:key
- (channel #f)
(ready-note #f))
(register-midi-note-callback!
- #:channel channel
+ controller
#:note-number button
#:func (lambda () (sel fixture)))
(when ready-note
- (send-note-on ready-note)))
+ (send-note-on controller ready-note)))