-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
drain.lisp
75 lines (55 loc) · 2.28 KB
/
drain.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
70
71
72
73
74
75
(in-package #:org.shirakumo.fraf.mixed)
(defclass drain (virtual)
((program-name :initform "Mixed" :initarg :program-name :accessor program-name)
(pack :initform NIL :reader pack)))
(defmethod initialize-instance :after ((drain drain) &key pack)
(setf (pack drain) pack))
(defmethod (setf pack) (thing (drain drain))
(etypecase thing
((or null pack) (setf (slot-value drain 'pack) thing))
(packer (setf (pack drain) (pack thing)))))
(defmethod info ((drain drain))
(list :name (string (class-name (class-of drain)))
:description "Output drain."
:flags ()
:min-inputs 0
:max-inputs 0
:outputs 0
:fields ()))
(defmethod output-field ((field (eql :pack)) (location (eql 0)) (drain drain))
(pack drain))
(defmethod (setf output-field) ((value pack) (field (eql :pack)) (location (eql 0)) (drain drain))
(setf (pack drain) value))
(defmethod (setf output-field) ((value null) (field (eql :pack)) (location (eql 0)) (drain drain))
(setf (pack drain) value))
(defmethod output ((location (eql 0)) (drain drain))
(pack drain))
(defgeneric channel-order (drain))
(defmethod channel-order ((drain drain))
*default-channel-order*)
(defmethod framesize ((drain drain))
(framesize (pack drain)))
(defmethod samplerate ((drain drain))
(samplerate (pack drain)))
(defmethod encoding ((drain drain))
(encoding (pack drain)))
(defmethod channels ((drain drain))
(channels (pack drain)))
(define-condition device-not-found (error)
((device :initarg :device :reader device))
(:report (lambda (c s) (format s "A device with the descriptor~% ~s~%was requested, but could not be found."
(device c)))))
(defclass device-drain (drain)
())
(defgeneric list-devices (device-drain))
(defgeneric device (device-drain))
(defgeneric (setf device) (device device-drain))
(defmethod print-object ((drain device-drain) stream)
(print-unreadable-object (drain stream :type T :identity T)
(format stream "~a" (device drain))))
(defclass file-drain (drain)
((file :initform NIL :initarg :file :reader file)
(frame-position :initform 0 :accessor frame-position)))
(defmethod print-object ((drain file-drain) stream)
(print-unreadable-object (drain stream :type T :identity T)
(format stream "~a" (file drain))))