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