-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
conditions.lisp
58 lines (45 loc) · 2.43 KB
/
conditions.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
(in-package #:org.shirakumo.fraf.out123)
(define-condition output-error (error)
((output :initarg :output :reader output)))
(define-condition creation-failure (output-error)
()
(:report (lambda (c s) (format s "Failed to create output handle for ~a." (output c)))))
(define-condition not-connected (output-error)
()
(:report (lambda (c s) (format s "Attempted to perform an operation that requires a connected output on ~a." (output c)))))
(define-condition failed-driver-listing (output-error)
()
(:report (lambda (c s) (format s "Failed to list available drivers for ~a." (output c)))))
(define-condition failed-driver-info (output-error)
()
(:report (lambda (c s) (format s "Failed to fetch information about the driver for ~a." (output c)))))
(define-condition failed-format-listing (output-error)
()
(:report (lambda (c s) (format s "Failed to list available fromats for ~a." (output c)))))
(define-condition failed-playback-format (output-error)
()
(:report (lambda (c s) (format s "Failed to query playback fromat for ~a." (output c)))))
(define-condition already-connected (output-error)
()
(:report (lambda (c s) (format s "The output ~a is already connected." (output c)))))
(define-condition error-string-error (output-error)
((error :initarg :error :reader error-string)))
(define-condition connection-failed (error-string-error)
((driver :initarg :driver :reader driver)
(device :initarg :device :reader device))
(:report (lambda (c s) (format s "~a failed to connect to ~a/~a: ~a"
(output c) (driver c) (device c) (error-string c)))))
(define-condition start-failed (error-string-error)
((rate :initarg :rate :reader rate)
(channels :initarg :channels :reader channels)
(encoding :initarg :encoding :reader encoding))
(:report (lambda (c s) (format s "~a failed to start playback with ~a Hz, ~a c, ~a: ~a"
(output c) (rate c) (channels c) (encoding c) (error-string c)))))
(define-condition playback-failed (error-string-error)
((bytes :initarg :bytes :reader bytes))
(:report (lambda (c s) (format s "~a failed to play back: ~a"
(output c) (error-string c)))))
(define-condition buffer-set-failed (error-string-error)
((bytes :initarg :bytes :reader bytes))
(:report (lambda (c s) (format s "~a failed to set buffer to ~a bytes: ~a"
(output c) (bytes c) (error-string c)))))