pause functionality
This commit is contained in:
+12
-3
@@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
(define (check-ao-handle)
|
(define (check-ao-handle)
|
||||||
(when (eq? ao-handle #f)
|
(when (eq? ao-handle #f)
|
||||||
|
(dbg-rktplayer "ao-handle equals #f")
|
||||||
(unless (or (= current-rate 0) (= current-bits 0) (= current-channels 0))
|
(unless (or (= current-rate 0) (= current-bits 0) (= current-channels 0))
|
||||||
(dbg-rktplayer "current-rate = ~a, current-bits = ~a, current-channels = ~a, ao-handle = ~a"
|
(dbg-rktplayer "current-rate = ~a, current-bits = ~a, current-channels = ~a, ao-handle = ~a"
|
||||||
current-rate current-bits current-channels ao-handle)
|
current-rate current-bits current-channels ao-handle)
|
||||||
@@ -121,10 +122,13 @@
|
|||||||
(unless (stream-equal? rate bits-per-sample channels)
|
(unless (stream-equal? rate bits-per-sample channels)
|
||||||
(dbg-rktplayer "Stream has changed to ~a ~a ~a" rate bits-per-sample channels)
|
(dbg-rktplayer "Stream has changed to ~a ~a ~a" rate bits-per-sample channels)
|
||||||
(unless (eq? ao-handle #f)
|
(unless (eq? ao-handle #f)
|
||||||
(dbg-rktplayer "Waiting for play buffer to reach empty state")
|
(dbg-rktplayer "Waiting for play buffer to reach empty state, buf-size = ~a" (ao-bufsize-async ao-handle))
|
||||||
(while (> (ao-bufsize-async ao-handle) 0)
|
(while (> (ao-bufsize-async ao-handle) 0)
|
||||||
(sleep 0.25)
|
(dbg-rktplayer "buffer size: ~a" (ao-bufsize-async ao-handle))
|
||||||
|
(sleep 1.0) ;0.25)
|
||||||
)
|
)
|
||||||
|
(dbg-rktplayer "buffer size: ~a" (ao-bufsize-async ao-handle))
|
||||||
|
(dbg-rktplayer "Empty state reached")
|
||||||
(dbg-rktplayer "Closing ao-handle")
|
(dbg-rktplayer "Closing ao-handle")
|
||||||
(ao-close ao-handle)
|
(ao-close ao-handle)
|
||||||
(set! ao-handle #f))
|
(set! ao-handle #f))
|
||||||
@@ -146,11 +150,13 @@
|
|||||||
bytes-per-sample-all-channels
|
bytes-per-sample-all-channels
|
||||||
rate)))))
|
rate)))))
|
||||||
(when (> (buf-seconds-left) buffer-max-seconds)
|
(when (> (buf-seconds-left) buffer-max-seconds)
|
||||||
|
(dbg-rktplayer "waiting for buffer to get below ~as" buffer-min-seconds)
|
||||||
(while (and (not (eq? ao-handle #f))
|
(while (and (not (eq? ao-handle #f))
|
||||||
(not closing)
|
(not closing)
|
||||||
(not pause)
|
(not pause)
|
||||||
(> (buf-seconds-left) buffer-min-seconds))
|
(> (buf-seconds-left) buffer-min-seconds))
|
||||||
(sleep 0.25))))
|
(sleep 0.25))
|
||||||
|
(dbg-rktplayer "under ~a seconds" buffer-min-seconds)))
|
||||||
|
|
||||||
(when (not (eq? ao-handle #f))
|
(when (not (eq? ao-handle #f))
|
||||||
(ao-play ao-handle current-track-id second duration buffer buf-len ao-type)
|
(ao-play ao-handle current-track-id second duration buffer buf-len ao-type)
|
||||||
@@ -239,6 +245,7 @@
|
|||||||
(set! current-track -1)
|
(set! current-track -1)
|
||||||
|
|
||||||
(set! closing #f)
|
(set! closing #f)
|
||||||
|
(dbg-rktplayer "done close-player*")
|
||||||
)
|
)
|
||||||
|
|
||||||
(define (quit-player)
|
(define (quit-player)
|
||||||
@@ -247,12 +254,14 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
(define (stop-and-clear)
|
(define (stop-and-clear)
|
||||||
|
(info-rktplayer "STOP AND CLEAR")
|
||||||
(when pause
|
(when pause
|
||||||
(set! stop-in-pause 'stop-request)
|
(set! stop-in-pause 'stop-request)
|
||||||
(set! pause #f)
|
(set! pause #f)
|
||||||
(while (not (eq? stop-in-pause 'stop-ack))
|
(while (not (eq? stop-in-pause 'stop-ack))
|
||||||
(sleep 0.2)))
|
(sleep 0.2)))
|
||||||
(set-state! 'stopped)
|
(set-state! 'stopped)
|
||||||
|
(info-rktplayer "calling close-player*")
|
||||||
(close-player*)
|
(close-player*)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,13 @@
|
|||||||
(define rktplayer-window #f)
|
(define rktplayer-window #f)
|
||||||
(define rktplayer-tray #f)
|
(define rktplayer-tray #f)
|
||||||
|
|
||||||
|
(define (close-off)
|
||||||
|
(send rktplayer-tray close)
|
||||||
|
(send rktplayer-window close)
|
||||||
|
(exit)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
(define (run . no-exit)
|
(define (run . no-exit)
|
||||||
(let* ((ini (new ini% [file 'rktplayer]))
|
(let* ((ini (new ini% [file 'rktplayer]))
|
||||||
(context (new wv-context%
|
(context (new wv-context%
|
||||||
|
|||||||
Reference in New Issue
Block a user