Merge branch 'main' of https://git.dijkewijk.nl/hans/racket-sound
This commit is contained in:
15
libao.rkt
15
libao.rkt
@@ -55,8 +55,10 @@
|
||||
(lambda (my-handle)
|
||||
(hash-for-each devices
|
||||
(lambda (handle-num device)
|
||||
(displayln (format "closing ao handle ~a" handle-num))
|
||||
(ao-close handle-num)))
|
||||
(set! devices (make-hash))
|
||||
(displayln "shutting down ao")
|
||||
(ao_shutdown)
|
||||
(plumber-flush-handle-remove! my-handle)
|
||||
)))
|
||||
@@ -154,11 +156,16 @@
|
||||
|
||||
(if (number? handle)
|
||||
(let ((ao-device (hash-ref devices handle #f)))
|
||||
(close-device #f ao-device))
|
||||
(unless (eq? ao-device #f)
|
||||
(displayln (format "Closing ao device ~a" ao-device))
|
||||
(close-device #f ao-device)
|
||||
(hash-remove! devices handle)))
|
||||
(let ((handle-num (ao-handle-handle-num handle)))
|
||||
(let ((ao-device (hash-ref devices handle-num #f)))
|
||||
(displayln (format "ao-device = ~a" ao-device))
|
||||
(close-device handle ao-device))
|
||||
(unless (eq? ao-device #f)
|
||||
(displayln (format "ao-device = ~a" ao-device))
|
||||
(close-device handle ao-device)
|
||||
(hash-remove! devices handle-num)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -187,7 +194,7 @@
|
||||
(audio-buf-len (* channels bytes-per-sample buf-len))
|
||||
(audio (if (eq? libao-async-mode 'ffi)
|
||||
(malloc 'atomic audio-buf-len)
|
||||
(malloc 'raw audio-buf-len)))
|
||||
(malloc 'atomic audio-buf-len))) ; was: 'raw
|
||||
(get-sample (lambda (k channel)
|
||||
(let ((chan-buf (list-ref buffer channel)))
|
||||
(vector-ref chan-buf k))))
|
||||
|
||||
Reference in New Issue
Block a user