-
Notifications
You must be signed in to change notification settings - Fork 4
/
types.lisp
69 lines (59 loc) · 1.65 KB
/
types.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;;; types.lisp
(in-package #:portmidi)
(defctype pm-stream :void)
(defctype pm-device-id :int)
(defctype pm-timestamp :int32)
(defctype pm-message :int32)
(defcstruct pm-device-info
"Information about a device. Usually owned by the lib."
(structVersion :int)
(interf :string)
(name :string)
(input :boolean)
(output :boolean)
(opened :boolean))
(defclass device-info ()
((interf
:initarg :interf
:reader device-info-interf)
(name
:initarg :name
:reader device-info-name)
(direction
:initarg :direction
:reader device-info-direction)
(opened
:initarg :opened
:reader device-info-open-p))
(:documentation "Contains information about a MIDI device.
Slots:
- interf, the name of the device's interface, string
- name, the name of the device, string
- direction, the direction of the device's stream, either :input or :output
- opened, indicates, if the device is open, boolean
Readers: device-info-
- interf: reads interf
- name: reads name
- direction: reads direction
- open-p: reads opened"))
(defmethod translate-from-foreign (value (type (eql 'pm-device-info)))
)
(defcstruct pm-event
"The PortMidi event structure. Streams use instances of this."
(message pm-message)
(timestamp pm-timestamp))
(define-foreign-type midi-stream-type ()
()
(:actual-type :pointer)
(:simple-parser midi-stream))
;;; pm-error
(define-foreign-type pm-error-type ()
()
(:actual-type :int)
(:simple-parser pm-error))
(defmethod translate-from-foreign (value (type pm-error-type))
"Raise an error, if value, a PmError code, is non-zero."
(case value
(0 nil)
(1 t)
(t (error (get-error-text value)))))