Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions mixalot.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,13 @@
(ao-fmt-rate fmt) rate
(ao-fmt-byte-format fmt) AO_FMT_LITTLE
(ao-fmt-matrix fmt) matrix)
(ao-open-live (ao-default-driver-id)
fmt
(null-pointer)))))
(let ((device (ao-open-live (ao-default-driver-id)
fmt
(null-pointer))))
(when (null-pointer-p device)
;; TODO: see errno via CFFI-grovel.
(error "libao ao-open-live failed."))
device))))

#+mixalot::use-ao
(defun main-thread-init ()
Expand Down Expand Up @@ -615,18 +619,21 @@ should be output in STREAMER-MIX-INTO or STREAMER-WRITE-INTO."
#-(or mixalot::use-ao mixalot::use-alsa)
(error "Neither mixalot::use-ao nor mixalot::use-alsa existed on *features* when this function was compiled. That is wrong.")
(let ((mixer (funcall constructor :rate rate)))
#+mixalot::use-alsa
(bordeaux-threads:make-thread
(lambda ()
#+mixalot::use-ao
(progn
(setf (mixer-device mixer) (open-ao :rate rate))
(run-mixer-process mixer))
#+mixalot::use-alsa
(call-with-pcm rate
(lambda (pcm)
(setf (mixer-device mixer) pcm)
(run-mixer-process mixer))))
:name (format nil "Mixer thread ~:D Hz" rate))
#+mixalot::use-ao
(let ((device (open-ao :rate rate)))
(setf (mixer-device mixer) device)
(bordeaux-threads:make-thread
(lambda ()
(run-mixer-process mixer))
:name (format nil "Mixer thread ~:D Hz" rate)))
mixer))

(defun destroy-mixer (mixer)
Expand Down