summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/audio.scm21
1 files changed, 13 insertions, 8 deletions
diff --git a/chickadee/audio.scm b/chickadee/audio.scm
index 7b5b0f3..e7bce70 100644
--- a/chickadee/audio.scm
+++ b/chickadee/audio.scm
@@ -161,14 +161,19 @@
(guardian sound-system-guardian))
(define (make-sound-system)
- (%make-sound-system (openal:make-context (openal:open-device))
- (make-array-list)
- (make-hash-table)
- (make-weak-key-hash-table)
- (make-hash-table)
- (make-array-list)
- (make-hash-table)
- (make-guardian)))
+ ;; It's possible that there are *no* audio devices available, in
+ ;; which case open-device throws an exception. In that case, return
+ ;; #f.
+ (let ((device (false-if-exception (openal:open-device))))
+ (and device
+ (%make-sound-system (openal:make-context device)
+ (make-array-list)
+ (make-hash-table)
+ (make-weak-key-hash-table)
+ (make-hash-table)
+ (make-array-list)
+ (make-hash-table)
+ (make-guardian)))))
(define (register-source sound-system source)
(hashq-set! (sound-system-sources sound-system) source source)