This commit is contained in:
2026-02-24 14:57:29 +01:00
parent 45544f4645
commit c96dbb11b0

View File

@@ -99,32 +99,50 @@
))) )))
(define (ao-close handle) (define (ao-close handle)
(displayln handle)(sleep 1.0)
(if (number? handle) (define (close-device handle ao-device)
(let ((ao-device (hash-ref devices handle #f))) (if (eq? handle #f)
(unless (eq? ao-device #f) (begin
(let ((r (ao_close ao-device)))
(when (= r 0)
(printf "Unexpected: cannot close ao-device"))))
'internally-closed)
(let ((handle-num (ao-handle-handle-num handle)))
(displayln (ao-handle-closed handle))(sleep 1.0)
(unless (ao-handle-closed handle)
(set-ao-handle-closed! handle #t)
(displayln "clear-async")(sleep 1.0)
(ao_clear_async (ao-handle-async-player handle))
(displayln "stop-async")(sleep 1.0)
(ao_stop_async (ao-handle-async-player handle))
(displayln "closing")(sleep 1.0)
(let ((ao-device (hash-ref devices handle-num #f)))
(if (eq? ao-device #f) (if (eq? ao-device #f)
'error-ao-device-non-existent 'error-ao-device-non-existent
(let ((r (ao_close ao-device))) (let ((r (ao_close ao-device)))
(displayln "closed")(sleep 1.0)
(hash-remove! devices handle-num)
(if (= r 0) (if (= r 0)
'error-closing-ao-device 'error-closing-ao-device
'ok)))))))) 'ok
)
)
)
)
(if (ao-handle-closed handle)
'warning-ao-device-already-closed
(begin
(set-ao-handle-closed! handle #t)
;(displayln "clear-async")(sleep 1.0)
(ao_clear_async (ao-handle-async-player handle))
;(displayln "stop-async")(sleep 1.0)
(ao_stop_async (ao-handle-async-player handle))
;(displayln "closing")(sleep 1.0)
(if (eq? ao-device #f)
'error-ao-device-non-existent
(let ((r (ao_close ao-device)))
(if (= r 0)
'error-closing-ao-device
'ok)))
)
)
))
;(displayln handle)(sleep 1.0)
(if (number? handle)
(let ((ao-device (hash-ref devices handle #f)))
(close-device #f ao-device))
(let ((handle-num (ao-handle-handle-num handle)))
;(displayln (ao-handle-closed handle))(sleep 1.0)
(let ((ao-device (hash-ref devices handle-num #f)))
(close-device handle ao-device))
)
)
)
(define count 0) (define count 0)