adjustment to the new audio-player module of racket-audio

This commit is contained in:
2026-05-19 15:01:32 +02:00
parent e60ecaeaef
commit 2f04cf2ff4
4 changed files with 59 additions and 20 deletions
+9 -4
View File
@@ -44,7 +44,7 @@
(lru-clear track-cache))
(define (audio-state-cb handle st*)
(define (audio-state-cb handle player-state st*)
(set! full-state st*)
(let ((st (audio-state player)))
(when (or (eq? st 'paused) (eq? st 'playing))
@@ -59,8 +59,10 @@
)
(state-updater st)
(repeat-updater repeat)
(audio-info-cb (audio-rate player) (audio-channels player)
(audio-bits player) (audio-decoder player))
(if (or (eq? player-state 'quit) (eq? player-state 'stopped))
(audio-info-cb 0 0 0 'none)
(audio-info-cb (audio-rate player) (audio-channels player)
(audio-bits player) (audio-decoder player)))
)
)
@@ -70,7 +72,10 @@
(define (check-player)
(when (eq? player #f)
(set! player (make-audio-player audio-state-cb on-eof-stream-cb))))
(set! player (make-audio-player audio-state-cb on-eof-stream-cb))
(audio-ao-buf-ms! player 500)
(audio-buf-seconds! player buffer-min-seconds buffer-max-seconds)
))
(define/public (get-volume)
(check-player)