From ff7dd3070ff8baa7b8c714f0483fe168e97625a5 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Thu, 23 Apr 2026 11:11:24 +0200 Subject: [PATCH] for the moment we accept a very small tick with mpg123 --- play-test.rkt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/play-test.rkt b/play-test.rkt index c3a0f87..cd3b633 100644 --- a/play-test.rkt +++ b/play-test.rkt @@ -36,6 +36,7 @@ (sl-log-to-display) (define wav-output-file #f) +(define seeked #f) (define (audio-play type ao-type handle buf-info buffer buf-len) (let* ((sample (hash-ref buf-info 'sample)) @@ -46,6 +47,11 @@ (channels (hash-ref buf-info 'channels)) (bytes-per-sample-all-channels (* channels bytes-per-sample)) (duration (hash-ref buf-info 'duration)) + (cond-seek (λ () + (when (= (round current-seconds) 10) + (when (and (= current-file-id 3) (not seeked)) + (set! seeked #t) + (audio-seek current-audio-h 97.0))))) ) ;(displayln buf-info) (when (eq? ao-h #f) @@ -74,9 +80,7 @@ (let* ((buf-size (ao-bufsize-async ao-h)) (buf-seconds (exact->inexact (/ buf-size bytes-per-sample-all-channels rate)))) (second-printer buf-seconds) - (when (= (round current-seconds) 10) - (when (= current-file-id 3) - (audio-seek current-audio-h 97.0))) + (cond-seek) (when (> buf-seconds 5) (letrec ((waiter (λ () (let ((buf-seconds-left (exact->inexact @@ -98,9 +102,7 @@ (ao-set-volume! ao-h 150)) (when (= (round current-seconds) 40) (ao-set-volume! ao-h 100)) - (when (= (round current-seconds) 10) - (when (= current-file-id 3) - (audio-seek current-audio-h 97.0))) + (cond-seek) (waiter))))) )) (waiter))))