changed async library. Flac conversion in C

This commit is contained in:
2026-04-10 08:32:55 +02:00
parent f3b6fc9669
commit 7aa77436bb
5 changed files with 119 additions and 106 deletions

View File

@@ -14,6 +14,11 @@
ao_bufsize_async
ao_clear_async
ao_pause_async
make-ao_buf_info
ao_buf_info-type
ao_buf_info-sample-bits
ao_buf_info-sample-rate
ao_buf_info-channels
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -35,6 +40,15 @@
;; ao-player in os thread
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-struct ao_buffer_info
(type
sample-bits
sample-rate
channels
)
#:transparent
)
(define-struct ao-shm
(mutex
device
@@ -86,6 +100,7 @@
(duration (caddr elem))
(buf-len (cadddr elem))
(buf (car (cddddr elem)))
(buf-info (cadr (cddddr elem)))
)
(mutex-lock (ao-shm-mutex shm))
(set-ao-shm-at-second! shm at-second)
@@ -130,7 +145,7 @@
(define (ao_stop_async shm)
(mutex-lock (ao-shm-mutex shm))
(ao_clear_async* shm)
(enqueue! (ao-shm-queue shm) (list 'stop 0 0 #f #f))
(enqueue! (ao-shm-queue shm) (list 'stop 0 0 #f #f #f))
(os-semaphore-post (ao-shm-queue-sem shm))
(mutex-unlock (ao-shm-mutex shm))
(let ((stopped (λ ()
@@ -149,8 +164,8 @@
)
)
(define (ao_play_async shm at-second music-duration buf-size buf)
(let ((item (list 'play at-second music-duration buf-size buf)))
(define (ao_play_async shm at-second music-duration buf-size buf buf-info)
(let ((item (list 'play at-second music-duration buf-size buf buf-info)))
(mutex-lock (ao-shm-mutex shm))
(let ((bs (ao-shm-bufsize shm)))
(set-ao-shm-bufsize! shm (+ bs buf-size)))