-
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
[bufsize #:mutable]
|
||||
queue-sem
|
||||
[queue #:mutable]
|
||||
[stopped #:mutable]
|
||||
)
|
||||
#:transparent
|
||||
)
|
||||
@@ -63,7 +64,9 @@
|
||||
(cond
|
||||
[(eq? command 'stop)
|
||||
(begin
|
||||
;(displayln "stopping")
|
||||
(mutex-lock (ao-shm-mutex shm))
|
||||
(set-ao-shm-stopped! shm #t)
|
||||
(mutex-unlock (ao-shm-mutex shm))
|
||||
'done)]
|
||||
[(eq? command 'play)
|
||||
(let ((at-second (cadr elem))
|
||||
@@ -89,7 +92,7 @@
|
||||
)
|
||||
|
||||
(define (ao-player ao_device)
|
||||
(let ((shm (make-ao-shm (make-mutex) ao_device 0.0 0 (make-os-semaphore) (make-queue))))
|
||||
(let ((shm (make-ao-shm (make-mutex) ao_device 0.0 0 (make-os-semaphore) (make-queue) #f)))
|
||||
(ao-player* shm)
|
||||
shm
|
||||
)
|
||||
@@ -103,11 +106,17 @@
|
||||
(ao-player ao_device))
|
||||
|
||||
(define (ao_stop_async shm)
|
||||
(displayln "Stopping")
|
||||
(mutex-lock (ao-shm-mutex shm))
|
||||
(enqueue! (ao-shm-queue shm) (list 'stop 0 #f #f))
|
||||
(os-semaphore-post (ao-shm-queue-sem shm))
|
||||
(mutex-unlock (ao-shm-mutex shm))
|
||||
(let ((stopped (λ ()
|
||||
(mutex-lock (ao-shm-mutex shm))
|
||||
(let ((w (ao-shm-stopped shm)))
|
||||
(mutex-unlock (ao-shm-mutex shm))
|
||||
w))))
|
||||
(while (eq? (stopped) #f))
|
||||
(sleep 0.01))
|
||||
)
|
||||
|
||||
(define (ao_play_async shm at-second buf-size buf)
|
||||
|
||||
Reference in New Issue
Block a user