-
Notifications
You must be signed in to change notification settings - Fork 3
/
easy-api.lisp
29 lines (24 loc) · 955 Bytes
/
easy-api.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(in-package :cl-alsaseq.quick)
(defmacro def-event-func (event args &body body)
`(defun ,(intern (format nil "SEND-~A" event))
,args ,@body))
(eval-when (:load-toplevel :compile-toplevel :execute)
(mapcar
(lambda (event-type)
(let ((ctrl-type (intern (format nil "SND_SEQ_EVENT_~A" event-type) :keyword)))
(compile (intern (format nil "SEND-~A" event-type))
`(lambda (channel param value
*seq my-port)
(send-ctrl channel param value ,ctrl-type *seq my-port)))))
'(:PGMCHANGE
:CHANPRESS
:PITCHBEND
:CONTROL
:NONREGPARAM
:REGPARAM)))
(defun send-note-on (velocity note channel
*seq my-port)
(send-note velocity note channel :SND_SEQ_EVENT_NOTEON *seq my-port))
(defun send-note-off (velocity note channel
*seq my-port)
(send-note velocity note channel :SND_SEQ_EVENT_NOTEOFF *seq my-port))