Skip to content

Commit

Permalink
More flexible high-level API for note playing.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Sep 21, 2024
1 parent 99eec1b commit 74888d8
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/undermidi.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,32 @@

;; Notes API

(defun play-note (pid note)
(undermidi.device.conn:apply pid 'um.note 'play-note (list (um.note:make note))))
(defun play-note
((pid note) (when (is_atom note))
(play-note pid (um.note:make note)))
((pid note)
(undermidi.device.conn:apply pid 'um.note 'play-note (list note))))

(defun play-notes (pid notes)
(undermidi.device.conn:apply pid 'um.note 'play-notes (list (um.note:make notes))))
(defun play-notes
((pid (= `(,head . ,_) notes)) (when (is_atom head))
(play-notes pid (um.note:make notes)))
((pid notes)
(undermidi.device.conn:apply pid 'um.note 'play-notes (list notes))))

(defun play-notes (pid notes delay)
(undermidi.device.conn:apply pid 'um.note 'play-notes (list (um.note:make notes) delay)))
(defun play-notes
((pid (= `(,head . ,_) notes) delay) (when (is_atom head))
(play-notes pid (um.note:make notes) delay))
((pid notes delay)
(undermidi.device.conn:apply pid 'um.note 'play-notes (list notes delay))))

(defun play-notes (pid notes delay repeats)
(undermidi.device.conn:apply pid 'um.note 'play-notes (list (um.note:make notes) delay repeats)))
(defun play-notes
((pid (= `(,head . ,_) notes) delay repeats) (when (is_atom head))
(play-notes pid (um.note:make notes) delay repeats))
((pid notes delay repeats)
(undermidi.device.conn:apply pid
'um.note
'play-notes
(list notes delay repeats))))

;;; Aliases

Expand Down

0 comments on commit 74888d8

Please sign in to comment.