added validity checking
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
ao-bufsize-async
|
||||
ao-clear-async
|
||||
ao-pause
|
||||
ao-valid?
|
||||
)
|
||||
|
||||
(define device-number 1)
|
||||
@@ -71,6 +72,9 @@
|
||||
)
|
||||
)
|
||||
|
||||
(define (ao-valid? handle)
|
||||
(not (eq? (ao-handle-async-player handle) #f)))
|
||||
|
||||
(define (ao-play handle at-time-in-s music-duration-s buffer buf-len buf-type)
|
||||
(let* ((bytes-per-sample (ao-handle-bytes-per-sample handle))
|
||||
(bits (ao-handle-bits handle))
|
||||
@@ -79,6 +83,8 @@
|
||||
(endianess (ao-handle-byte-format handle))
|
||||
(buf-info (ffi:make-BufferInfo_t buf-type bits rate channels endianess))
|
||||
)
|
||||
(unless (ao-valid? handle)
|
||||
(error "Cannot play on an invalid ao-device"))
|
||||
(ffi:ao_play_async (ao-handle-async-player handle)
|
||||
(exact->inexact at-time-in-s)
|
||||
(exact->inexact music-duration-s)
|
||||
|
||||
Reference in New Issue
Block a user