From c35eef081e27ad0a669b61bf497ef917e4daa6e8 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Mon, 9 Mar 2026 09:46:39 +0100 Subject: [PATCH] - --- player.rkt | 12 +++++++----- playlist.rkt | 51 ++++++++++++++++++++++++++++++++------------------- rktplayer.rkt | 4 ++-- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/player.rkt b/player.rkt index bb3c818..3e1e4e2 100644 --- a/player.rkt +++ b/player.rkt @@ -18,7 +18,8 @@ [buffer-max-seconds 10] [buffer-min-seconds 4] ) - + (define use-ao #t) + (define pl #f) (define state 'stopped) (define track -1) @@ -51,10 +52,11 @@ (displayln (format "current-rate = ~a, current-bits = ~a, current-channels = ~a, ao-handle = ~a" current-rate current-bits current-channels ao-handle)) (displayln "Opening ao-handle") - (let ((fmt (ao-mk-format current-bits current-rate current-channels 'big-endian))) - (set! ao-handle (ao-open-live #f fmt)) - (start-play-time-updater) - ) + (when use-ao + (let ((fmt (ao-mk-format current-bits current-rate current-channels 'big-endian))) + (set! ao-handle (ao-open-live #f fmt)) + (start-play-time-updater) + )) ) ) ) diff --git a/playlist.rkt b/playlist.rkt index 6ccce63..b8b053b 100644 --- a/playlist.rkt +++ b/playlist.rkt @@ -53,6 +53,9 @@ ) ) + (define/public (image->file* to-file) + #f) + (define/public (image->file to-file) (let ((tags (read-tags))) (if (tags-valid? tags) @@ -68,6 +71,9 @@ ) #f))) + (define/public (image->mimetype*) + #f) + (define/public (image->mimetype) (let ((tags (read-tags))) (if (tags-valid? tags) @@ -75,27 +81,34 @@ 'no-mimetype))) (super-new) - + (begin - (unless (eq? file #f) - (let ((tags (read-tags))) - (if (tags-valid? tags) - (begin - (set! title (tags-title tags)) - (set! artist (tags-artist tags)) - (set! album (tags-album tags)) - (set! number (tags-track tags)) - (set! length (tags-length tags)) - ) - (begin - (set! title "invalid tags") - (set! artist "invalid tags") - (set! album "invalid tags") - (set! number number) - (set! length -1) - ) + (let ((use-tags #t)) + (if use-tags + (unless (eq? file #f) + (let ((tags (read-tags))) + (if (tags-valid? tags) + (begin + (set! title (tags-title tags)) + (set! artist (tags-artist tags)) + (set! album (tags-album tags)) + (set! number (tags-track tags)) + (set! length (tags-length tags)) + ) + (begin + (set! title "invalid tags") + (set! artist "invalid tags") + (set! album "invalid tags") + (set! number number) + (set! length -1) + ) + ) ) - ) + ) + (unless (eq? file #f) + (set! title (format "~a" file)) + (set! number 0)) + ) ) ) ) diff --git a/rktplayer.rkt b/rktplayer.rkt index 0e51871..6131621 100644 --- a/rktplayer.rkt +++ b/rktplayer.rkt @@ -22,9 +22,9 @@ (ww-set-log-level 'info) ;(ww-tail-log) ;(ww-tail-log) -(ao-set-async-mode! 'scheme) +;(ao-set-async-mode! 'scheme) ;(collect-garbage 'incremental) -;(ao-set-async-mode! 'ffi) +(ao-set-async-mode! 'ffi) (define (run) (let* ((ini (new ini% [file 'rktplayer]))